mirror of
https://github.com/json-iterator/go.git
synced 2025-04-20 11:28:49 +02:00
gofmt
This commit is contained in:
parent
8d6662b81b
commit
fff342fd04
4
any.go
4
any.go
@ -3,11 +3,11 @@ package jsoniter
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Any generic object representation.
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_read_empty_array_as_any(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var boolConvertMap = map[string]bool{
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var floatConvertMap = map[string]float64{
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var intConvertMap = map[string]int{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package any_tests
|
||||
|
||||
import (
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_wrap_map(t *testing.T) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package any_tests
|
||||
|
||||
import (
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_read_null_as_any(t *testing.T) {
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_read_object_as_any(t *testing.T) {
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var stringConvertMap = map[string]string{
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// if must be valid is useless, just drop this test
|
||||
|
@ -3,8 +3,8 @@ package any_tests
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_wrap_and_valuetype_everything(t *testing.T) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_use_number_for_unmarshal(t *testing.T) {
|
||||
@ -23,7 +23,6 @@ func Test_customize_float_marshal(t *testing.T) {
|
||||
should.Equal("1.234568", str)
|
||||
}
|
||||
|
||||
|
||||
func Test_customize_tag_key(t *testing.T) {
|
||||
|
||||
type TestObject struct {
|
||||
|
@ -2,11 +2,11 @@ package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
"io/ioutil"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_disallowUnknownFields(t *testing.T) {
|
||||
@ -18,7 +18,6 @@ func Test_disallowUnknownFields(t *testing.T) {
|
||||
should.Error(decoder.Decode(&obj))
|
||||
}
|
||||
|
||||
|
||||
func Test_new_decoder(t *testing.T) {
|
||||
should := require.New(t)
|
||||
decoder1 := json.NewDecoder(bytes.NewBufferString(`[1][2]`))
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_new_encoder(t *testing.T) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
"bytes"
|
||||
"github.com/json-iterator/go"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Standard Encoder has trailing newline.
|
||||
|
@ -2,9 +2,9 @@ package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_marshal_indent(t *testing.T) {
|
||||
|
@ -2,10 +2,10 @@ package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
//func Test_large_file(t *testing.T) {
|
||||
|
@ -2,10 +2,10 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Config customize how the API should behave.
|
||||
|
@ -111,7 +111,6 @@ func ExampleMapKey() {
|
||||
|
||||
type MyKey string
|
||||
|
||||
|
||||
func (m *MyKey) MarshalText() ([]byte, error) {
|
||||
return []byte(strings.Replace(string(*m), "h", "H", -1)), nil
|
||||
}
|
||||
@ -120,4 +119,3 @@ func (m *MyKey) UnmarshalText(text []byte) error {
|
||||
*m = MyKey(text[:3])
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"unsafe"
|
||||
"time"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func Test_customize_type_decoder(t *testing.T) {
|
||||
@ -61,7 +61,6 @@ func Test_customize_field_decoder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func Test_recursive_empty_interface_customization(t *testing.T) {
|
||||
t.Skip()
|
||||
var obj interface{}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
"strconv"
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"testing"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type TestObject1 struct {
|
||||
|
@ -3,9 +3,9 @@ package misc_tests
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_empty_array(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_true(t *testing.T) {
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_read_big_float(t *testing.T) {
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_read_uint64_invalid(t *testing.T) {
|
||||
|
@ -2,10 +2,10 @@ package misc_tests
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_nil_non_empty_interface(t *testing.T) {
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_bad_case(t *testing.T) {
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strings"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_decode_TextMarshaler_key_map(t *testing.T) {
|
||||
|
@ -2,9 +2,9 @@ package misc_tests
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"reflect"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
type Level1 struct {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_read_null(t *testing.T) {
|
||||
|
@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"time"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Test_empty_object(t *testing.T) {
|
||||
|
@ -2,10 +2,10 @@ package misc_tests
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strings"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_jsoniter_RawMessage(t *testing.T) {
|
||||
|
@ -2,9 +2,9 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
// ValDecoder is an internal type registered to cache as needed.
|
||||
|
@ -2,9 +2,9 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
|
@ -2,8 +2,8 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"unsafe"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type dynamicEncoder struct {
|
||||
|
@ -2,12 +2,12 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
var typeDecoders = map[string]ValDecoder{}
|
||||
|
@ -2,9 +2,9 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
type Number string
|
||||
|
@ -1,9 +1,9 @@
|
||||
package jsoniter
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
"encoding/json"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()
|
||||
|
@ -1,11 +1,11 @@
|
||||
package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"sort"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package jsoniter
|
||||
|
||||
import (
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"unsafe"
|
||||
"encoding"
|
||||
"encoding/json"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem()
|
||||
|
@ -2,10 +2,10 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const ptrSize = 32 << uintptr(^uintptr(0)>>63)
|
||||
@ -418,7 +418,7 @@ func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
|
||||
case StringValue:
|
||||
encoding := base64.StdEncoding
|
||||
src := iter.SkipAndReturnBytes()
|
||||
src = src[1: len(src)-1]
|
||||
src = src[1 : len(src)-1]
|
||||
decodedLen := encoding.DecodedLen(len(src))
|
||||
dst := make([]byte, decodedLen)
|
||||
len, err := encoding.Decode(dst, src)
|
||||
|
@ -1,9 +1,9 @@
|
||||
package jsoniter
|
||||
|
||||
import (
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
|
@ -2,9 +2,9 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
|
@ -2,10 +2,10 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"strings"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder {
|
||||
|
@ -2,10 +2,10 @@ package jsoniter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"io"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
)
|
||||
|
||||
func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_skip_number_in_array(t *testing.T) {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io"
|
||||
"testing"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type testCase struct {
|
||||
|
@ -17,16 +17,16 @@ func init() {
|
||||
func writeFirstBuf(space []byte, v uint32) []byte {
|
||||
start := v >> 24
|
||||
if start == 0 {
|
||||
space = append(space, byte(v >> 16), byte(v >> 8))
|
||||
space = append(space, byte(v>>16), byte(v>>8))
|
||||
} else if start == 1 {
|
||||
space = append(space, byte(v >> 8))
|
||||
space = append(space, byte(v>>8))
|
||||
}
|
||||
space = append(space, byte(v))
|
||||
return space
|
||||
}
|
||||
|
||||
func writeBuf(buf []byte, v uint32) []byte {
|
||||
return append(buf, byte(v >> 16), byte(v >> 8), byte(v))
|
||||
return append(buf, byte(v>>16), byte(v>>8), byte(v))
|
||||
}
|
||||
|
||||
// WriteUint8 write uint8 to stream
|
||||
@ -91,7 +91,7 @@ func (stream *Stream) WriteUint32(val uint32) {
|
||||
stream.buf = writeFirstBuf(stream.buf, digits[q2])
|
||||
} else {
|
||||
r3 := q2 - q3*1000
|
||||
stream.buf = append(stream.buf, byte(q3 + '0'))
|
||||
stream.buf = append(stream.buf, byte(q3+'0'))
|
||||
stream.buf = writeBuf(stream.buf, digits[r3])
|
||||
}
|
||||
stream.buf = writeBuf(stream.buf, digits[r2])
|
||||
|
@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"encoding"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -26,7 +26,6 @@ func (k *stringKeyType) UnmarshalText(text []byte) error {
|
||||
var _ encoding.TextMarshaler = stringKeyType("")
|
||||
var _ encoding.TextUnmarshaler = new(stringKeyType)
|
||||
|
||||
|
||||
type structKeyType struct {
|
||||
X string
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package test
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type StringMarshaler string
|
||||
|
@ -1,10 +1,10 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"encoding/base64"
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type structMarshaler struct {
|
||||
|
@ -91,7 +91,6 @@ func (p *jsonMarshaler) UnmarshalJSON(input []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
type jsonMarshalerMap map[int]int
|
||||
|
||||
func (p *jsonMarshalerMap) MarshalJSON() ([]byte, error) {
|
||||
@ -117,7 +116,6 @@ func (p *textMarshaler) UnmarshalText(input []byte) error {
|
||||
|
||||
type textMarshalerMap map[int]int
|
||||
|
||||
|
||||
func (p *textMarshalerMap) MarshalText() ([]byte, error) {
|
||||
return []byte(`{}`), nil
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"encoding"
|
||||
"bytes"
|
||||
"encoding"
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -2,9 +2,9 @@ package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding"
|
||||
"encoding/base64"
|
||||
"strings"
|
||||
"encoding"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -1,15 +1,15 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"reflect"
|
||||
"fmt"
|
||||
"github.com/google/gofuzz"
|
||||
"strings"
|
||||
"github.com/json-iterator/go"
|
||||
"encoding/json"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/google/gofuzz"
|
||||
"github.com/json-iterator/go"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testCases []interface{}
|
||||
|
@ -66,12 +66,12 @@ func init() {
|
||||
}{"hello"},
|
||||
struct {
|
||||
Field interface{}
|
||||
}{struct{
|
||||
}{struct {
|
||||
field chan int
|
||||
}{}},
|
||||
struct {
|
||||
Field interface{}
|
||||
}{struct{
|
||||
}{struct {
|
||||
Field *int
|
||||
}{pInt(100)}},
|
||||
)
|
||||
|
@ -1,13 +1,13 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strconv"
|
||||
"bytes"
|
||||
"github.com/json-iterator/go"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_read_float(t *testing.T) {
|
||||
@ -50,7 +50,6 @@ func Test_read_float(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func Test_write_float32(t *testing.T) {
|
||||
vals := []float32{0, 1, -1, 99, 0xff, 0xfff, 0xffff, 0xfffff, 0xffffff, 0x4ffffff, 0xfffffff,
|
||||
-0x4ffffff, -0xfffffff, 1.2345, 1.23456, 1.234567, 1.001}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"strconv"
|
||||
"fmt"
|
||||
"testing"
|
||||
"bytes"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -158,7 +158,6 @@ func Test_read_int64(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func Test_write_uint8(t *testing.T) {
|
||||
vals := []uint8{0, 1, 11, 111, 255}
|
||||
for _, val := range vals {
|
||||
|
@ -3,11 +3,11 @@ package test
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io"
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func Test_missing_object_end(t *testing.T) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -26,7 +26,7 @@ func init() {
|
||||
},
|
||||
nilMap,
|
||||
&nilMap,
|
||||
map[string]*json.RawMessage{"hello":pRawMessage(json.RawMessage("[]"))},
|
||||
map[string]*json.RawMessage{"hello": pRawMessage(json.RawMessage("[]"))},
|
||||
)
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (*map[string]string)(nil),
|
||||
|
@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -17,10 +17,10 @@ func init() {
|
||||
tmOfStructInt{},
|
||||
&tm2,
|
||||
map[tmOfStruct]int{
|
||||
tmOfStruct{}: 100,
|
||||
{}: 100,
|
||||
},
|
||||
map[*tmOfStruct]int{
|
||||
&tmOfStruct{}: 100,
|
||||
{}: 100,
|
||||
},
|
||||
map[encoding.TextMarshaler]int{
|
||||
tm1: 100,
|
||||
@ -47,7 +47,6 @@ func (q *jmOfStruct) UnmarshalJSON(value []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
type tmOfStruct struct {
|
||||
F2 chan []byte
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/json-iterator/go"
|
||||
"encoding/json"
|
||||
"github.com/json-iterator/go"
|
||||
"testing"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"time"
|
||||
"encoding/json"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"encoding/json"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/json-iterator/go"
|
||||
"fmt"
|
||||
"github.com/json-iterator/go"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/v2pro/plz/reflect2"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type unmarshalCase struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user