You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-21 23:07:33 +02:00
fix any
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package jsoniter
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Test_read_string_as_any(t *testing.T) {
|
||||
iter := ParseString(`[1, {"hello": "world"}, 2]`)
|
||||
@ -25,3 +28,12 @@ func Test_read_int_as_any(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func Test_read_any_from_nested(t *testing.T) {
|
||||
iter := ParseString(`{"numbers": ["1", "2", ["3", "4"]]}`)
|
||||
val := iter.ReadAny()
|
||||
if val.ToInt("numbers", 2, 0) != 3 {
|
||||
fmt.Println(val.Error)
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user