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

Function TestBasic

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

Source from the content-addressed store, hash-verified

275}
276
277func TestBasic(t *testing.T) {
278 var mtok Result
279 mtok = get(basicJSON, `loggy.programmers.#[tag="good"].firstName`)
280 if mtok.String() != "Brett" {
281 t.Fatalf("expected %v, got %v", "Brett", mtok.String())
282 }
283 mtok = get(basicJSON, `loggy.programmers.#[tag="good"]#.firstName`)
284 if mtok.String() != `["Brett","Elliotte"]` {
285 t.Fatalf("expected %v, got %v", `["Brett","Elliotte"]`, mtok.String())
286 }
287}
288
289func TestIsArrayIsObject(t *testing.T) {
290 mtok := get(basicJSON, "loggy")

Callers

nothing calls this directly

Calls 2

StringMethod · 0.95
getFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…