1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00
This commit is contained in:
Tao Wen
2018-02-24 22:04:41 +08:00
parent 8d6662b81b
commit fff342fd04
72 changed files with 165 additions and 176 deletions

View File

@ -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) {

View File

@ -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())
}
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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) {

View File

@ -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))
}
}

View File

@ -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{}