You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-15 22:50:24 +02:00
gofmt
This commit is contained in:
@ -8,13 +8,13 @@ func init() {
|
||||
[2]*float64{},
|
||||
)
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (*[0]int)(nil),
|
||||
ptr: (*[0]int)(nil),
|
||||
input: `[1]`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*[1]int)(nil),
|
||||
ptr: (*[1]int)(nil),
|
||||
input: `[2]`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*[1]int)(nil),
|
||||
ptr: (*[1]int)(nil),
|
||||
input: `[]`,
|
||||
})
|
||||
}
|
||||
|
@ -8,16 +8,16 @@ func init() {
|
||||
return &val
|
||||
}
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (**interface{})(nil),
|
||||
ptr: (**interface{})(nil),
|
||||
input: `"hello"`,
|
||||
}, unmarshalCase{
|
||||
ptr: (**interface{})(nil),
|
||||
ptr: (**interface{})(nil),
|
||||
input: `1e1`,
|
||||
}, unmarshalCase{
|
||||
ptr: (**interface{})(nil),
|
||||
ptr: (**interface{})(nil),
|
||||
input: `1.0e1`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*[]interface{})(nil),
|
||||
ptr: (*[]interface{})(nil),
|
||||
input: `[1.0e1]`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*struct {
|
||||
@ -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}
|
||||
@ -127,4 +126,4 @@ func Test_write_float64(t *testing.T) {
|
||||
stream = jsoniter.NewStream(jsoniter.ConfigDefault, nil, 0)
|
||||
stream.WriteFloat64(float64(0.0000001))
|
||||
should.Equal("1e-07", string(stream.Buffer()))
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
pCloser2("hello"),
|
||||
)
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (*[]io.Closer)(nil),
|
||||
ptr: (*[]io.Closer)(nil),
|
||||
input: "[null]",
|
||||
}, unmarshalCase{
|
||||
obj: func() interface{} {
|
||||
|
@ -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 {
|
||||
@ -417,4 +416,4 @@ func Test_write_int64(t *testing.T) {
|
||||
stream.Flush()
|
||||
should.Nil(stream.Error)
|
||||
should.Equal("a4294967295", buf.String())
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
@ -223,4 +223,4 @@ func Test_EmptyInput(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Errorf("Expected error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"encoding/json"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -26,16 +26,16 @@ 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),
|
||||
ptr: (*map[string]string)(nil),
|
||||
input: `{"k\"ey": "val"}`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*map[string]string)(nil),
|
||||
ptr: (*map[string]string)(nil),
|
||||
input: `null`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*map[string]*json.RawMessage)(nil),
|
||||
ptr: (*map[string]*json.RawMessage)(nil),
|
||||
input: "{\"test\":[{\"key\":\"value\"}]}",
|
||||
})
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -17,20 +17,20 @@ func init() {
|
||||
tmOfStructInt{},
|
||||
&tm2,
|
||||
map[tmOfStruct]int{
|
||||
tmOfStruct{}: 100,
|
||||
{}: 100,
|
||||
},
|
||||
map[*tmOfStruct]int{
|
||||
&tmOfStruct{}: 100,
|
||||
{}: 100,
|
||||
},
|
||||
map[encoding.TextMarshaler]int{
|
||||
tm1: 100,
|
||||
},
|
||||
)
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (*tmOfMap)(nil),
|
||||
ptr: (*tmOfMap)(nil),
|
||||
input: `"{1:2}"`,
|
||||
}, unmarshalCase{
|
||||
ptr: (*tmOfMapPtr)(nil),
|
||||
ptr: (*tmOfMapPtr)(nil),
|
||||
input: `"{1:2}"`,
|
||||
})
|
||||
}
|
||||
@ -47,7 +47,6 @@ func (q *jmOfStruct) UnmarshalJSON(value []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
type tmOfStruct struct {
|
||||
F2 chan []byte
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ func init() {
|
||||
json.RawMessage("{}"),
|
||||
)
|
||||
unmarshalCases = append(unmarshalCases, unmarshalCase{
|
||||
ptr: (*json.RawMessage)(nil),
|
||||
ptr: (*json.RawMessage)(nil),
|
||||
input: `[1,2,3]`,
|
||||
})
|
||||
}
|
||||
|
@ -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,18 +1,18 @@
|
||||
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 {
|
||||
obj func() interface{}
|
||||
ptr interface{}
|
||||
input string
|
||||
obj func() interface{}
|
||||
ptr interface{}
|
||||
input string
|
||||
selected bool
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ var marshalCases = []interface{}{
|
||||
nil,
|
||||
}
|
||||
|
||||
type selectedMarshalCase struct {
|
||||
type selectedMarshalCase struct {
|
||||
marshalCase interface{}
|
||||
}
|
||||
|
||||
@ -77,4 +77,4 @@ func Test_marshal(t *testing.T) {
|
||||
should.Equal(string(output1), string(output2))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user