1
0
mirror of https://github.com/json-iterator/go.git synced 2025-12-20 23:30:38 +02:00

consolidate more tests

This commit is contained in:
Tao Wen
2018-02-13 20:58:29 +08:00
parent c3b6c1e845
commit 761ce8cce2
18 changed files with 237 additions and 276 deletions

20
api_tests/encoder_test.go Normal file
View File

@@ -0,0 +1,20 @@
package test
import (
"testing"
"github.com/stretchr/testify/require"
"bytes"
"github.com/json-iterator/go"
"encoding/json"
)
// Standard Encoder has trailing newline.
func TestEncoderHasTrailingNewline(t *testing.T) {
should := require.New(t)
var buf, stdbuf bytes.Buffer
enc := jsoniter.ConfigCompatibleWithStandardLibrary.NewEncoder(&buf)
enc.Encode(1)
stdenc := json.NewEncoder(&stdbuf)
stdenc.Encode(1)
should.Equal(stdbuf.Bytes(), buf.Bytes())
}