1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-21 23:07:33 +02:00
This commit is contained in:
Tao Wen
2016-12-11 15:53:35 +08:00
parent 2895fe2215
commit 3e47c79b7e
6 changed files with 190 additions and 80 deletions

View File

@ -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()
}
}