You've already forked json-iterator
							
							
				mirror of
				https://github.com/json-iterator/go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	gofmt
This commit is contained in:
		
							
								
								
									
										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) { | ||||
| @@ -120,4 +120,4 @@ func Test_object_wrapper_any_get_all(t *testing.T) { | ||||
| 	should.NotContains(any.Keys(), "Field3") | ||||
|  | ||||
| 	//should.Contains(any.GetObject()["Field1"].GetArray()[0], 1) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
| @@ -45,4 +44,4 @@ func Test_read_large_number_as_interface(t *testing.T) { | ||||
| 	output, err := jsoniter.MarshalToString(val) | ||||
| 	should.Nil(err) | ||||
| 	should.Equal(`123456789123456789123456789`, output) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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. | ||||
| @@ -17,4 +17,4 @@ func TestEncoderHasTrailingNewline(t *testing.T) { | ||||
| 	stdenc := json.NewEncoder(&stdbuf) | ||||
| 	stdenc.Encode(1) | ||||
| 	should.Equal(stdbuf.Bytes(), buf.Bytes()) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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{} | ||||
| @@ -98,4 +97,4 @@ func Test_read_custom_interface(t *testing.T) { | ||||
| 	err := jsoniter.UnmarshalFromString(`"hello"`, &val) | ||||
| 	should.Nil(err) | ||||
| 	should.Equal("hello", val.Hello()) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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) { | ||||
| @@ -44,4 +44,4 @@ func Test_write_val_bool(t *testing.T) { | ||||
| 	should.Equal(stream.Buffered(), 0) | ||||
| 	should.Nil(stream.Error) | ||||
| 	should.Equal("true", buf.String()) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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) { | ||||
| @@ -129,4 +129,4 @@ func Test_reader_and_load_more(t *testing.T) { | ||||
| 	decoder := jsoniter.ConfigCompatibleWithStandardLibrary.NewDecoder(reader) | ||||
| 	obj := TestObject{} | ||||
| 	should.Nil(decoder.Decode(&obj)) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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) { | ||||
| @@ -45,18 +45,18 @@ func Test_marshal_invalid_json_raw_message(t *testing.T) { | ||||
| func Test_raw_message_memory_not_copied_issue(t *testing.T) { | ||||
| 	jsonStream := `{"name":"xxxxx","bundle_id":"com.zonst.majiang","app_platform":"ios","app_category":"100103", "budget_day":1000,"bidding_min":1,"bidding_max":2,"bidding_type":"CPM", "freq":{"open":true,"type":"day","num":100},"speed":1, "targeting":{"vendor":{"open":true,"list":["zonst"]}, "geo_code":{"open":true,"list":["156110100"]},"app_category":{"open":true,"list":["100101"]}, "day_parting":{"open":true,"list":["100409","100410"]},"device_type":{"open":true,"list":["ipad"]}, "os_version":{"open":true,"list":[10]},"carrier":{"open":true,"list":["mobile"]}, "network":{"open":true,"list":["4G"]}},"url":{"tracking_imp_url":"http://www.baidu.com", "tracking_clk_url":"http://www.baidu.com","jump_url":"http://www.baidu.com","deep_link_url":"http://www.baidu.com"}}` | ||||
| 	type IteratorObject struct { | ||||
| 		Name        *string     `json:"name"` | ||||
| 		BundleId    *string     `json:"bundle_id"` | ||||
| 		AppCategory *string     `json:"app_category"` | ||||
| 		AppPlatform *string     `json:"app_platform"` | ||||
| 		BudgetDay   *float32    `json:"budget_day"` | ||||
| 		BiddingMax  *float32    `json:"bidding_max"` | ||||
| 		BiddingMin  *float32    `json:"bidding_min"` | ||||
| 		BiddingType *string     `json:"bidding_type"` | ||||
| 		Name        *string              `json:"name"` | ||||
| 		BundleId    *string              `json:"bundle_id"` | ||||
| 		AppCategory *string              `json:"app_category"` | ||||
| 		AppPlatform *string              `json:"app_platform"` | ||||
| 		BudgetDay   *float32             `json:"budget_day"` | ||||
| 		BiddingMax  *float32             `json:"bidding_max"` | ||||
| 		BiddingMin  *float32             `json:"bidding_min"` | ||||
| 		BiddingType *string              `json:"bidding_type"` | ||||
| 		Freq        *jsoniter.RawMessage `json:"freq"` | ||||
| 		Targeting   *jsoniter.RawMessage `json:"targeting"` | ||||
| 		Url         *jsoniter.RawMessage `json:"url"` | ||||
| 		Speed       *int        `json:"speed" db:"speed"` | ||||
| 		Speed       *int                 `json:"speed" db:"speed"` | ||||
| 	} | ||||
|  | ||||
| 	obj := &IteratorObject{} | ||||
|   | ||||
| @@ -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{} | ||||
| @@ -18,8 +18,8 @@ var extensions = []Extension{} | ||||
|  | ||||
| // StructDescriptor describe how should we encode/decode the struct | ||||
| type StructDescriptor struct { | ||||
| 	Type               reflect2.Type | ||||
| 	Fields             []*Binding | ||||
| 	Type   reflect2.Type | ||||
| 	Fields []*Binding | ||||
| } | ||||
|  | ||||
| // GetField get one field from the descriptor by its name. | ||||
| @@ -387,8 +387,8 @@ func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { | ||||
| } | ||||
| func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { | ||||
| 	structDescriptor := &StructDescriptor{ | ||||
| 		Type:               typ, | ||||
| 		Fields:             bindings, | ||||
| 		Type:   typ, | ||||
| 		Fields: bindings, | ||||
| 	} | ||||
| 	for _, extension := range extensions { | ||||
| 		extension.UpdateStructDescriptor(structDescriptor) | ||||
|   | ||||
| @@ -2,9 +2,9 @@ package jsoniter | ||||
|  | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"github.com/v2pro/plz/reflect2" | ||||
| 	"strconv" | ||||
| 	"unsafe" | ||||
| 	"github.com/v2pro/plz/reflect2" | ||||
| ) | ||||
|  | ||||
| type Number string | ||||
| @@ -109,4 +109,4 @@ func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { | ||||
|  | ||||
| func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { | ||||
| 	return len(*((*Number)(ptr))) == 0 | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| package jsoniter | ||||
|  | ||||
| import ( | ||||
| 	"unsafe" | ||||
| 	"encoding/json" | ||||
| 	"github.com/v2pro/plz/reflect2" | ||||
| 	"unsafe" | ||||
| ) | ||||
|  | ||||
| var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() | ||||
| @@ -57,4 +57,4 @@ func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) | ||||
|  | ||||
| func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { | ||||
| 	return len(*((*RawMessage)(ptr))) == 0 | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
| @@ -405,7 +405,7 @@ func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { | ||||
| } | ||||
|  | ||||
| type base64Codec struct { | ||||
| 	sliceType *reflect2.UnsafeSliceType | ||||
| 	sliceType    *reflect2.UnsafeSliceType | ||||
| 	sliceDecoder ValDecoder | ||||
| } | ||||
|  | ||||
| @@ -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 { | ||||
| @@ -1031,4 +1031,4 @@ func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterato | ||||
| 		iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) | ||||
| 		return | ||||
| 	} | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -14,4 +14,4 @@ func init() { | ||||
| 			`"\t"`,     // valid | ||||
| 		}, | ||||
| 	}) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -16,4 +16,4 @@ func init() { | ||||
| 			`{abc}`, // invalid | ||||
| 		}, | ||||
| 	}) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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]) | ||||
|   | ||||
| @@ -60,4 +60,4 @@ func init() { | ||||
| } | ||||
|  | ||||
| type structEmpty struct{} | ||||
| type arrayAlis [4]stringAlias | ||||
| type arrayAlis [4]stringAlias | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -41,4 +40,4 @@ func (k *structKeyType) UnmarshalText(text []byte) error { | ||||
| } | ||||
|  | ||||
| var _ encoding.TextMarshaler = structKeyType{} | ||||
| var _ encoding.TextUnmarshaler = &structKeyType{} | ||||
| var _ encoding.TextUnmarshaler = &structKeyType{} | ||||
|   | ||||
| @@ -3,8 +3,8 @@ package test | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"encoding/base64" | ||||
| 	"strings" | ||||
| 	"encoding/json" | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| type StringMarshaler string | ||||
| @@ -49,4 +49,4 @@ var _ json.Unmarshaler = new(StringMarshaler) | ||||
|  | ||||
| func init() { | ||||
| 	testCases = append(testCases, (*StringMarshaler)(nil)) | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -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,11 +116,10 @@ func (p *textMarshaler) UnmarshalText(input []byte) error { | ||||
|  | ||||
| type textMarshalerMap map[int]int | ||||
|  | ||||
|  | ||||
| func (p *textMarshalerMap) MarshalText() ([]byte, error) { | ||||
| 	return []byte(`{}`), nil | ||||
| } | ||||
|  | ||||
| func (p *textMarshalerMap) UnmarshalText(input []byte) error { | ||||
| 	return nil | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -230,4 +230,4 @@ type EmbeddedPtrOption struct { | ||||
|  | ||||
| type EmbeddedPtr struct { | ||||
| 	EmbeddedPtrOption `json:","` | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -192,12 +192,12 @@ type StringFieldNameE struct { | ||||
| } | ||||
|  | ||||
| type StringFieldName struct { | ||||
| 	F1 string        `json:"F1"` | ||||
| 	F2 string        `json:"f2"` | ||||
| 	F3 string        `json:"-"` | ||||
| 	F4 string        `json:"-,"` | ||||
| 	F5 string        `json:","` | ||||
| 	F6 string        `json:""` | ||||
| 	F1               string `json:"F1"` | ||||
| 	F2               string `json:"f2"` | ||||
| 	F3               string `json:"-"` | ||||
| 	F4               string `json:"-,"` | ||||
| 	F5               string `json:","` | ||||
| 	F6               string `json:""` | ||||
| 	StringFieldNameE `json:"e"` | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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() { | ||||
| @@ -66,4 +66,4 @@ func (m *structTextMarshaler) UnmarshalText(text []byte) error { | ||||
| var _ encoding.TextMarshaler = structTextMarshaler{} | ||||
| var _ encoding.TextUnmarshaler = &structTextMarshaler{} | ||||
|  | ||||
| type structTextMarshalerAlias structTextMarshaler | ||||
| type structTextMarshalerAlias structTextMarshaler | ||||
|   | ||||
| @@ -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{} | ||||
|   | ||||
| @@ -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