Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for multiple backslashes in JSONPointer #640

Merged
merged 3 commits into from Nov 2, 2021

Conversation

katldewitt
Copy link
Contributor

[#561]Queries involving keys containing four backslashes ("\\") failing.

Summary of Issue

jimblackler noticed that different behavior occurs between parsing a string to create JSONObject and querying a JSONObject using JSONPointer(). There is not special handling for JSONPoiner \s in querying as mentioned in the fix for #588 .

I do think the documentation needs to be updated from

""           // the whole document
"/foo"       ["bar", "baz"]
"/foo/0"     "bar"
"/"          0
"/a~1b"      1
"/c%d"       2
"/e^f"       3
"/g|h"       4
"/i\\j"      5
"/k\"l"      6
"/ "         7
"/m~0n"      8`

to

""           // the whole document
"/foo"       ["bar", "baz"]
"/foo/0"     "bar"
"/"          0
"/a~1b"      1
"/c%d"       2
"/e^f"       3
"/g|h"       4
"/i\j"       5 // Change to demonstrate intended behavior
"/k\"l"      6
"/ "         7
"/m~0n"      8`

Summary of Changes

  • Additional unit test that clarifies backslash behavior differences between JSONObject() and JSONPointer()

Expected Behavior

  • No regression behavior
  • All unit tests pass

context: the backslash unit tests cannot be in the complete document as uriFragmentNotationRoot() will fail due to backslash handling
@stleary
Copy link
Owner

stleary commented Oct 29, 2021

What problem does this code solve?
Adds unit test to demonstrate existing JSONPointer behavior

Risks
N/A

Changes to the API?
No

Will this require a new release?
No

Should the documentation be updated?
Yes, this can be done in a separate PR

Does it break the unit tests?
No

Was any code refactored in this commit?
No

Review status
APPROVED

@stleary
Copy link
Owner

stleary commented Oct 29, 2021

Starting 3-day comment window

@stleary stleary merged commit d6227c8 into stleary:master Nov 2, 2021
@stleary stleary changed the title Address #561: Add unit tests for multiple backslashes Unit tests for multiple backslashes in JSONPointer Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants