1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

write object

This commit is contained in:
Tao Wen
2017-01-07 22:08:45 +08:00
parent 5e50b3e11c
commit 21549b9fd8
4 changed files with 113 additions and 6 deletions

View File

@ -1,6 +1,10 @@
package jsoniter
import "testing"
import (
"testing"
"bytes"
"github.com/json-iterator/go/require"
)
func Test_true(t *testing.T) {
iter := ParseString(`true`)
@ -15,3 +19,15 @@ func Test_false(t *testing.T) {
t.FailNow()
}
}
func Test_write_true_false(t *testing.T) {
should := require.New(t)
buf := &bytes.Buffer{}
stream := NewStream(buf, 4096)
stream.WriteTrue()
stream.WriteFalse()
stream.Flush()
should.Nil(stream.Error)
should.Equal("truefalse", buf.String())
}