1
0
mirror of https://github.com/json-iterator/go.git synced 2025-07-12 23:50:19 +02:00

check null/true/false

This commit is contained in:
Tao Wen
2017-07-10 15:23:35 +08:00
parent c38e47d169
commit 0187038bad
7 changed files with 57 additions and 28 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"github.com/stretchr/testify/require"
"testing"
"io"
)
func Test_read_null(t *testing.T) {
@ -13,6 +14,12 @@ func Test_read_null(t *testing.T) {
should.True(iter.ReadNil())
iter = ParseString(ConfigDefault, `null`)
should.Nil(iter.Read())
iter = ParseString(ConfigDefault, `navy`)
iter.Read()
should.True(iter.Error != nil && iter.Error != io.EOF)
iter = ParseString(ConfigDefault, `navy`)
iter.ReadNil()
should.True(iter.Error != nil && iter.Error != io.EOF)
}
func Test_write_null(t *testing.T) {