Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisstocuz committed Feb 18, 2024
1 parent 568515c commit bbccb4d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ast/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ func TestIndexOrGet(t *testing.T) {
}
}

func TestIndexOrGetWithIdx(t *testing.T) {
root, _ := NewParser(`{"a":1,"b":2}`).Parse()
b, idx := root.IndexOrGetWithIdx(0, "b")
if v, err := b.Int64(); err != nil || v != int64(2) {
t.Fatal(b, idx)
}
if idx != 1 {
t.Fatal(b, idx)
}
}

func TestTypeCast(t *testing.T) {
type tcase struct {
method string
Expand Down

0 comments on commit bbccb4d

Please sign in to comment.