Skip to content

Add Edge-Case Tests for DeserializePathElement #316

@lalitc375

Description

@lalitc375

Background

As part of the migration to encoding/json/v2 in PR #292, we need to ensure that our deserialization logic remains robust and perfectly backward-compatible with the old json-iterator implementation.

Description

We need to develop new test cases to cover various edge scenarios for the DeserializePathElement function. This is critical to ensure robust error handling and correct behavior under unexpected inputs.

The scenarios that must be explicitly tested include:

  • Zero-length input: How does the function handle an empty string?
  • EOF conditions: What happens when the input stream unexpectedly ends?
  • Leading or trailing whitespace: Ensure whitespace around the value is handled identically to the previous implementation.
  • Multi-token inputs: Ensure inputs with multiple tokens fail as expected.

Goal

Capture the current behavior and prevent us from accidentally changing it. If these tests fail when we switch to json-iter (or json/v2), we'll be aware and can decide how to handle the differences the tests find.

Code Pointers

Metadata

  • Priority: P0
  • Complexity: Easy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions