Enhance jsonvalue_test.go with edge case tests - #64060
Open
Deniz Güney Yıldırım (denizguney) wants to merge 2 commits into
Open
Enhance jsonvalue_test.go with edge case tests#64060Deniz Güney Yıldırım (denizguney) wants to merge 2 commits into
Deniz Güney Yıldırım (denizguney) wants to merge 2 commits into
Conversation
Add unit tests covering edge cases for `jsonvalueToAny`, including empty objects (`{}`), boolean types, and floating-point values to ensure robust parsing across various data structures.
Copilot started reviewing on behalf of
Deniz Güney Yıldırım (denizguney)
August 27, 2026 20:02
View session
Comment on lines
+36
to
+48
|
|
||
| var edgeValue packagejson.JSONValue | ||
| err = json.Unmarshal([]byte(`{"emptyObj":{},"boolVal":true,"floatVal":3.14}`), &edgeValue) | ||
| assert.NilError(t, err) | ||
|
|
||
| edgeRoot := jsonValueToAny(edgeValue).(*collections.OrderedMap[string, any]) | ||
|
|
||
|
|
||
| emptyObj := edgeRoot.GetOrZero("emptyObj").(*collections.OrderedMap[string, any]) | ||
| assert.Equal(t, len(slices.Collect(emptyObj.Keys())), 0) | ||
|
|
||
|
|
||
| assert.Equal(t, edgeRoot.GetOrZero("boolVal"), true) |
Fix Go formatting check by removing whitespace-only blank lines in jsonvalue_test.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add unit tests covering edge cases for
jsonvalueToAny, including empty objects ({}), boolean types, and floating-point values to ensure robust parsing across various data structures.Fixes #