You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-21 23:07:33 +02:00
gofmt
This commit is contained in:
assert
feature_adapter.gofeature_any_array.gofeature_any_float.gofeature_any_int32.gofeature_any_int64.gofeature_any_nil.gofeature_any_object.gofeature_any_string.gofeature_any_uint64.gofeature_iter.gofeature_iter_array.gofeature_iter_float.gofeature_iter_int.gofeature_iter_object.gofeature_iter_skip.gofeature_iter_string.gofeature_reflect.gofeature_reflect_array.gofeature_reflect_map.gofeature_reflect_native.gofeature_reflect_object.gofeature_stream.gofeature_stream_float.gofeature_stream_int.gojsoniter_adapter_test.gojsoniter_array_test.gojsoniter_bool_test.gojsoniter_customize_test.gojsoniter_demo_test.gojsoniter_find_end_test.gojsoniter_float_test.gojsoniter_int_test.gojsoniter_interface_test.gojsoniter_map_test.gojsoniter_null_test.gojsoniter_object_test.gojsoniter_optional_test.gojsoniter_reflect_native_test.gojsoniter_reflect_struct_test.gojsoniter_reflect_test.gojsoniter_stream_test.gojsoniter_string_test.go@ -2,11 +2,11 @@ package jsoniter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"errors"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Unmarshal adapts to json/encoding Unmarshal API
|
// Unmarshal adapts to json/encoding Unmarshal API
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type arrayLazyAny struct {
|
type arrayLazyAny struct {
|
||||||
@ -44,7 +44,7 @@ func (any *arrayLazyAny) fillCacheUntil(target int) Any {
|
|||||||
return any.cache[target]
|
return any.cache[target]
|
||||||
}
|
}
|
||||||
iter := any.Parse()
|
iter := any.Parse()
|
||||||
if (len(any.remaining) == len(any.buf)) {
|
if len(any.remaining) == len(any.buf) {
|
||||||
iter.head++
|
iter.head++
|
||||||
c := iter.nextToken()
|
c := iter.nextToken()
|
||||||
if c != ']' {
|
if c != ']' {
|
||||||
|
@ -2,8 +2,8 @@ package jsoniter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"unsafe"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type float64LazyAny struct {
|
type float64LazyAny struct {
|
||||||
|
@ -2,8 +2,8 @@ package jsoniter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"unsafe"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type int64LazyAny struct {
|
type int64LazyAny struct {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type objectLazyAny struct {
|
type objectLazyAny struct {
|
||||||
|
@ -146,7 +146,6 @@ func (any *stringAny) Parse() *Iterator {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (any *stringAny) ValueType() ValueType {
|
func (any *stringAny) ValueType() ValueType {
|
||||||
return String
|
return String
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"io"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type uint64LazyAny struct {
|
type uint64LazyAny struct {
|
||||||
baseAny
|
baseAny
|
||||||
buf []byte
|
buf []byte
|
||||||
|
@ -276,4 +276,3 @@ func (iter *Iterator) ReadBase64() (ret []byte) {
|
|||||||
}
|
}
|
||||||
return ret[:n]
|
return ret[:n]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ func (iter *Iterator) ReadArray() (ret bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
|
func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
|
||||||
c := iter.nextToken()
|
c := iter.nextToken()
|
||||||
if c == '[' {
|
if c == '[' {
|
||||||
|
@ -2,12 +2,13 @@ package jsoniter
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"math/big"
|
||||||
"strconv"
|
"strconv"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"math/big"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var floatDigits []int8
|
var floatDigits []int8
|
||||||
|
|
||||||
const invalidCharForNumber = int8(-1)
|
const invalidCharForNumber = int8(-1)
|
||||||
const endOfNumber = int8(-2)
|
const endOfNumber = int8(-2)
|
||||||
const dotInNumber = int8(-3)
|
const dotInNumber = int8(-3)
|
||||||
@ -91,14 +92,14 @@ func (iter *Iterator) readPositiveFloat32() (ret float32) {
|
|||||||
if value > uint64SafeToMultiple10 {
|
if value > uint64SafeToMultiple10 {
|
||||||
return iter.readFloat32SlowPath()
|
return iter.readFloat32SlowPath()
|
||||||
}
|
}
|
||||||
value = (value << 3) + (value << 1) + uint64(ind); // value = value * 10 + ind;
|
value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind;
|
||||||
}
|
}
|
||||||
if c == '.' {
|
if c == '.' {
|
||||||
i++
|
i++
|
||||||
decimalPlaces := 0;
|
decimalPlaces := 0
|
||||||
for ; i < iter.tail; i++ {
|
for ; i < iter.tail; i++ {
|
||||||
c = iter.buf[i]
|
c = iter.buf[i]
|
||||||
ind := floatDigits[c];
|
ind := floatDigits[c]
|
||||||
switch ind {
|
switch ind {
|
||||||
case endOfNumber:
|
case endOfNumber:
|
||||||
if decimalPlaces > 0 && decimalPlaces < len(POW10) {
|
if decimalPlaces > 0 && decimalPlaces < len(POW10) {
|
||||||
@ -194,14 +195,14 @@ func (iter *Iterator) readPositiveFloat64() (ret float64) {
|
|||||||
if value > uint64SafeToMultiple10 {
|
if value > uint64SafeToMultiple10 {
|
||||||
return iter.readFloat64SlowPath()
|
return iter.readFloat64SlowPath()
|
||||||
}
|
}
|
||||||
value = (value << 3) + (value << 1) + uint64(ind); // value = value * 10 + ind;
|
value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind;
|
||||||
}
|
}
|
||||||
if c == '.' {
|
if c == '.' {
|
||||||
i++
|
i++
|
||||||
decimalPlaces := 0;
|
decimalPlaces := 0
|
||||||
for ; i < iter.tail; i++ {
|
for ; i < iter.tail; i++ {
|
||||||
c = iter.buf[i]
|
c = iter.buf[i]
|
||||||
ind := floatDigits[c];
|
ind := floatDigits[c]
|
||||||
switch ind {
|
switch ind {
|
||||||
case endOfNumber:
|
case endOfNumber:
|
||||||
if decimalPlaces > 0 && decimalPlaces < len(POW10) {
|
if decimalPlaces > 0 && decimalPlaces < len(POW10) {
|
||||||
|
@ -194,7 +194,7 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) {
|
|||||||
}
|
}
|
||||||
value = (value << 3) + (value << 1) + uint32(ind)
|
value = (value << 3) + (value << 1) + uint32(ind)
|
||||||
}
|
}
|
||||||
if (!iter.loadMore()) {
|
if !iter.loadMore() {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ func (iter *Iterator) readUint64(c byte) (ret uint64) {
|
|||||||
}
|
}
|
||||||
value = (value << 3) + (value << 1) + uint64(ind)
|
value = (value << 3) + (value << 1) + uint64(ind)
|
||||||
}
|
}
|
||||||
if (!iter.loadMore()) {
|
if !iter.loadMore() {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ func (iter *Iterator) ReadBool() (ret bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (iter *Iterator) SkipAndReturnBytes() []byte {
|
func (iter *Iterator) SkipAndReturnBytes() []byte {
|
||||||
if iter.reader != nil {
|
if iter.reader != nil {
|
||||||
panic("reader input does not support this api")
|
panic("reader input does not support this api")
|
||||||
@ -40,7 +39,6 @@ func (iter *Iterator) SkipAndReturnBytes() []byte {
|
|||||||
return iter.buf[before:after]
|
return iter.buf[before:after]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Skip skips a json object and positions to relatively the next json object
|
// Skip skips a json object and positions to relatively the next json object
|
||||||
func (iter *Iterator) Skip() {
|
func (iter *Iterator) Skip() {
|
||||||
c := iter.nextToken()
|
c := iter.nextToken()
|
||||||
@ -204,15 +202,15 @@ func (iter *Iterator) skipUntilBreak() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (iter *Iterator) skipFixedBytes(n int) {
|
func (iter *Iterator) skipFixedBytes(n int) {
|
||||||
iter.head += n;
|
iter.head += n
|
||||||
if (iter.head >= iter.tail) {
|
if iter.head >= iter.tail {
|
||||||
more := iter.head - iter.tail;
|
more := iter.head - iter.tail
|
||||||
if !iter.loadMore() {
|
if !iter.loadMore() {
|
||||||
if more > 0 {
|
if more > 0 {
|
||||||
iter.reportError("skipFixedBytes", "unexpected end");
|
iter.reportError("skipFixedBytes", "unexpected end")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
iter.head += more;
|
iter.head += more
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,12 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"encoding/json"
|
|
||||||
"encoding"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"reflect"
|
|
||||||
"io"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"reflect"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func decoderOfSlice(typ reflect.Type) (Decoder, error) {
|
func decoderOfSlice(typ reflect.Type) (Decoder, error) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"reflect"
|
|
||||||
"encoding/json"
|
|
||||||
"encoding"
|
"encoding"
|
||||||
|
"encoding/json"
|
||||||
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mapDecoder struct {
|
type mapDecoder struct {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
"encoding/json"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"encoding/json"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stringCodec struct {
|
type stringCodec struct {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"unsafe"
|
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func encoderOfStruct(typ reflect.Type) (Encoder, error) {
|
func encoderOfStruct(typ reflect.Type) (Encoder, error) {
|
||||||
@ -138,7 +138,7 @@ func EnableUnexportedStructFieldsSupport() {
|
|||||||
|
|
||||||
func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder) (Decoder, error) {
|
func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder) (Decoder, error) {
|
||||||
knownHash := map[int32]struct{}{
|
knownHash := map[int32]struct{}{
|
||||||
0: struct{}{},
|
0: {},
|
||||||
}
|
}
|
||||||
switch len(fields) {
|
switch len(fields) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -21,7 +21,7 @@ func (stream *Stream) WriteFloat32Lossy(val float32) {
|
|||||||
val = -val
|
val = -val
|
||||||
}
|
}
|
||||||
if val > 0x4ffffff {
|
if val > 0x4ffffff {
|
||||||
stream.WriteRaw(strconv.FormatFloat(float64(val), 'f', -1, 32));
|
stream.WriteRaw(strconv.FormatFloat(float64(val), 'f', -1, 32))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
precision := 6
|
precision := 6
|
||||||
@ -53,7 +53,7 @@ func (stream *Stream) WriteFloat64Lossy(val float64) {
|
|||||||
val = -val
|
val = -val
|
||||||
}
|
}
|
||||||
if val > 0x4ffffff {
|
if val > 0x4ffffff {
|
||||||
stream.WriteRaw(strconv.FormatFloat(val, 'f', -1, 64));
|
stream.WriteRaw(strconv.FormatFloat(val, 'f', -1, 64))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
precision := 6
|
precision := 6
|
||||||
|
@ -5,7 +5,7 @@ var DIGITS []uint32
|
|||||||
func init() {
|
func init() {
|
||||||
DIGITS = make([]uint32, 1000)
|
DIGITS = make([]uint32, 1000)
|
||||||
for i := uint32(0); i < 1000; i++ {
|
for i := uint32(0); i < 1000; i++ {
|
||||||
DIGITS[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i % 10 + '0';
|
DIGITS[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0'
|
||||||
if i < 10 {
|
if i < 10 {
|
||||||
DIGITS[i] += 2 << 24
|
DIGITS[i] += 2 << 24
|
||||||
} else if i < 100 {
|
} else if i < 100 {
|
||||||
@ -128,7 +128,7 @@ func (stream *Stream) WriteInt32(nval int32) {
|
|||||||
stream.ensure(11)
|
stream.ensure(11)
|
||||||
n := stream.n
|
n := stream.n
|
||||||
var val uint32
|
var val uint32
|
||||||
if (nval < 0) {
|
if nval < 0 {
|
||||||
val = uint32(-nval)
|
val = uint32(-nval)
|
||||||
stream.buf[n] = '-'
|
stream.buf[n] = '-'
|
||||||
n++
|
n++
|
||||||
@ -232,7 +232,7 @@ func (stream *Stream) WriteInt64(nval int64) {
|
|||||||
stream.ensure(20)
|
stream.ensure(20)
|
||||||
n := stream.n
|
n := stream.n
|
||||||
var val uint64
|
var val uint64
|
||||||
if (nval < 0) {
|
if nval < 0 {
|
||||||
val = uint64(-nval)
|
val = uint64(-nval)
|
||||||
stream.buf[n] = '-'
|
stream.buf[n] = '-'
|
||||||
n++
|
n++
|
||||||
@ -244,7 +244,7 @@ func (stream *Stream) WriteInt64(nval int64) {
|
|||||||
stream.n = writeFirstBuf(stream.buf, DIGITS[val], n)
|
stream.n = writeFirstBuf(stream.buf, DIGITS[val], n)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r1 := val - q1 * 1000;
|
r1 := val - q1*1000
|
||||||
q2 := q1 / 1000
|
q2 := q1 / 1000
|
||||||
if q2 == 0 {
|
if q2 == 0 {
|
||||||
n := writeFirstBuf(stream.buf, DIGITS[q1], n)
|
n := writeFirstBuf(stream.buf, DIGITS[q1], n)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"encoding/json"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_new_decoder(t *testing.T) {
|
func Test_new_decoder(t *testing.T) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
"io"
|
"io"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_empty_array(t *testing.T) {
|
func Test_empty_array(t *testing.T) {
|
||||||
@ -117,9 +117,9 @@ func Test_array_lazy_any_get_all(t *testing.T) {
|
|||||||
func Test_array_wrapper_any_get_all(t *testing.T) {
|
func Test_array_wrapper_any_get_all(t *testing.T) {
|
||||||
should := require.New(t)
|
should := require.New(t)
|
||||||
any := wrapArray([][]int{
|
any := wrapArray([][]int{
|
||||||
[]int{1, 2},
|
{1, 2},
|
||||||
[]int{3, 4},
|
{3, 4},
|
||||||
[]int{5, 6},
|
{5, 6},
|
||||||
})
|
})
|
||||||
should.Equal("[1,3,5]", any.Get('*', 0).ToString())
|
should.Equal("[1,3,5]", any.Get('*', 0).ToString())
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_true(t *testing.T) {
|
func Test_true(t *testing.T) {
|
||||||
@ -38,7 +38,6 @@ func Test_write_true_false(t *testing.T) {
|
|||||||
should.Equal("truefalse", buf.String())
|
should.Equal("truefalse", buf.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Test_write_val_bool(t *testing.T) {
|
func Test_write_val_bool(t *testing.T) {
|
||||||
should := require.New(t)
|
should := require.New(t)
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"encoding/json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_customize_type_decoder(t *testing.T) {
|
func Test_customize_type_decoder(t *testing.T) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_bind_api_demo(t *testing.T) {
|
func Test_bind_api_demo(t *testing.T) {
|
||||||
@ -84,4 +84,3 @@ func BenchmarkStdMarshal(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_string_end(t *testing.T) {
|
func Test_string_end(t *testing.T) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
"bytes"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_read_big_float(t *testing.T) {
|
func Test_read_big_float(t *testing.T) {
|
||||||
|
@ -3,12 +3,12 @@ package jsoniter
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"github.com/json-iterator/go/require"
|
||||||
"io/ioutil"
|
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"strconv"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_read_uint64_invalid(t *testing.T) {
|
func Test_read_uint64_invalid(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_read_map(t *testing.T) {
|
func Test_read_map(t *testing.T) {
|
||||||
@ -46,7 +46,7 @@ func Test_wrap_map(t *testing.T) {
|
|||||||
|
|
||||||
func Test_map_wrapper_any_get_all(t *testing.T) {
|
func Test_map_wrapper_any_get_all(t *testing.T) {
|
||||||
should := require.New(t)
|
should := require.New(t)
|
||||||
any := Wrap(map[string][]int{"Field1": []int{1, 2}})
|
any := Wrap(map[string][]int{"Field1": {1, 2}})
|
||||||
should.Equal(`{"Field1":1}`, any.Get('*', 0).ToString())
|
should.Equal(`{"Field1":1}`, any.Get('*', 0).ToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_read_null(t *testing.T) {
|
func Test_read_null(t *testing.T) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_empty_object(t *testing.T) {
|
func Test_empty_object(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_encode_optional_int_pointer(t *testing.T) {
|
func Test_encode_optional_int_pointer(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_reflect_str(t *testing.T) {
|
func Test_reflect_str(t *testing.T) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_decode_one_field_struct(t *testing.T) {
|
func Test_decode_one_field_struct(t *testing.T) {
|
||||||
|
@ -3,9 +3,9 @@ package jsoniter
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
"testing"
|
"testing"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_decode_slice(t *testing.T) {
|
func Test_decode_slice(t *testing.T) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package jsoniter
|
package jsoniter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_writeByte_should_grow_buffer(t *testing.T) {
|
func Test_writeByte_should_grow_buffer(t *testing.T) {
|
||||||
|
@ -3,9 +3,9 @@ package jsoniter
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
|
||||||
"github.com/json-iterator/go/require"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/json-iterator/go/require"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_read_normal_string(t *testing.T) {
|
func Test_read_normal_string(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user