1
0
mirror of https://github.com/json-iterator/go.git synced 2026-05-16 08:58:12 +02:00
Files
json-iterator/compatible_test.go
T

21 lines
431 B
Go
Raw Normal View History

2017-10-26 15:15:34 +08:00
package jsoniter
import (
"bytes"
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
// Standard Encoder has trailing newline.
func TestEncoderHasTrailingNewline(t *testing.T) {
should := require.New(t)
var buf, stdbuf bytes.Buffer
enc := ConfigCompatibleWithStandardLibrary.NewEncoder(&buf)
enc.Encode(1)
stdenc := json.NewEncoder(&stdbuf)
stdenc.Encode(1)
should.Equal(stdbuf.Bytes(), buf.Bytes())
}