MCPcopy Index your code
hub / github.com/tidwall/gjson / TestMap

Function TestMap

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

Source from the content-addressed store, hash-verified

424 ParseBytes([]byte(`{"ok":"bad`)).ForEach(nil)
425}
426func TestMap(t *testing.T) {
427 assert(t, len(ParseBytes([]byte(`"asdf"`)).Map()) == 0)
428 assert(t, ParseBytes([]byte(`{"asdf":"ghjk"`)).Map()["asdf"].String() ==
429 "ghjk")
430 assert(t, len(Result{Type: JSON, Raw: "**invalid**"}.Map()) == 0)
431 assert(t, Result{Type: JSON, Raw: "**invalid**"}.Value() == nil)
432 assert(t, Result{Type: JSON, Raw: "{"}.Map() != nil)
433}
434func TestBasic1(t *testing.T) {
435 mtok := get(basicJSON, `loggy.programmers`)
436 var count int

Callers

nothing calls this directly

Calls 5

assertFunction · 0.85
ParseBytesFunction · 0.85
MapMethod · 0.80
ValueMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…