1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

object cannot covert to int/float in php, so change covert result to zero

This commit is contained in:
Xargin
2017-07-04 00:53:10 +08:00
parent d8dbf14af4
commit ac8dd56dfb
3 changed files with 14 additions and 42 deletions

View File

@ -1,8 +1,9 @@
package jsoniter
import (
"github.com/json-iterator/go/require"
"testing"
"github.com/json-iterator/go/require"
)
func Test_read_object_as_any(t *testing.T) {
@ -18,7 +19,7 @@ func Test_read_object_as_any(t *testing.T) {
should.Equal(2, len(any.Keys()))
should.Equal(2, any.Size())
should.True(any.ToBool())
should.Equal(1, any.ToInt())
should.Equal(0, any.ToInt())
should.Equal(Object, any.ValueType())
should.Nil(any.LastError())
should.Equal("b", any.GetObject()["a"].ToString())