mirror of https://github.com/tidwall/gjson.git
added extra test
This commit is contained in:
parent
3e35b37021
commit
b7e578ec72
|
@ -119,7 +119,8 @@ var basicJSON = `{"age":100, "name":{"here":"B\\\"R"},
|
||||||
"email": "cccc"
|
"email": "cccc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"firstName": 1002.3
|
"firstName": 1002.3,
|
||||||
|
"age": 101
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -128,6 +129,11 @@ var basicJSON = `{"age":100, "name":{"here":"B\\\"R"},
|
||||||
func TestBasic(t *testing.T) {
|
func TestBasic(t *testing.T) {
|
||||||
var mtok Result
|
var mtok Result
|
||||||
|
|
||||||
|
mtok = Get(basicJSON, `loggy.programmers.#[age=101].firstName`)
|
||||||
|
if mtok.String() != "1002.3" {
|
||||||
|
t.Fatalf("expected %v, got %v", "1002,3", mtok.String())
|
||||||
|
}
|
||||||
|
|
||||||
mtok = Get(basicJSON, `loggy.programmers.#[firstName == "Brett"].email`)
|
mtok = Get(basicJSON, `loggy.programmers.#[firstName == "Brett"].email`)
|
||||||
if mtok.String() != "aaaa" {
|
if mtok.String() != "aaaa" {
|
||||||
t.Fatalf("expected %v, got %v", "aaaa", mtok.String())
|
t.Fatalf("expected %v, got %v", "aaaa", mtok.String())
|
||||||
|
|
Loading…
Reference in New Issue