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

Function TestNullArray

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

Source from the content-addressed store, hash-verified

1169}
1170
1171func TestNullArray(t *testing.T) {
1172 n := len(Get(`{"data":null}`, "data").Array())
1173 if n != 0 {
1174 t.Fatalf("expected '%v', got '%v'", 0, n)
1175 }
1176 n = len(Get(`{}`, "data").Array())
1177 if n != 0 {
1178 t.Fatalf("expected '%v', got '%v'", 0, n)
1179 }
1180 n = len(Get(`{"data":[]}`, "data").Array())
1181 if n != 0 {
1182 t.Fatalf("expected '%v', got '%v'", 0, n)
1183 }
1184 n = len(Get(`{"data":[null]}`, "data").Array())
1185 if n != 1 {
1186 t.Fatalf("expected '%v', got '%v'", 1, n)
1187 }
1188}
1189
1190func TestIssue54(t *testing.T) {
1191 var r []Result

Callers

nothing calls this directly

Calls 2

GetFunction · 0.85
ArrayMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…