MCPcopy
hub / github.com/tidwall/gjson / TestDuplicateKeys

Function TestDuplicateKeys

gjson_test.go:1322–1335  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1320}
1321
1322func TestDuplicateKeys(t *testing.T) {
1323 // this is valid json according to the JSON spec
1324 var json = `{"name": "Alex","name": "Peter"}`
1325 if Parse(json).Get("name").String() !=
1326 Parse(json).Map()["name"].String() {
1327 t.Fatalf("expected '%v', got '%v'",
1328 Parse(json).Get("name").String(),
1329 Parse(json).Map()["name"].String(),
1330 )
1331 }
1332 if !Valid(json) {
1333 t.Fatal("should be valid")
1334 }
1335}
1336
1337func TestArrayValues(t *testing.T) {
1338 var json = `{"array": ["PERSON1","PERSON2",0],}`

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.85
ValidFunction · 0.85
GetMethod · 0.80
MapMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…