From 9fd9d59f1bfa28a55cd59dd86e670a05bd4b7b43 Mon Sep 17 00:00:00 2001 From: steden <1470804@qq.com> Date: Wed, 20 Nov 2024 21:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8sonic=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/collection_test.go | 4 ++-- test/dictionary_test.go | 9 +++++---- test/list_test.go | 11 ++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/collection_test.go b/test/collection_test.go index be4f09f..9643c5a 100644 --- a/test/collection_test.go +++ b/test/collection_test.go @@ -1,9 +1,9 @@ package test import ( - "encoding/json" "testing" + "github.com/bytedance/sonic" "github.com/farseer-go/collections" "github.com/stretchr/testify/assert" ) @@ -78,7 +78,7 @@ func Test_collection_RemoveAll(t *testing.T) { func TestCollection_MarshalJSON(t *testing.T) { lst := collections.NewList[int](1, 2, 3, 6) strjson, _ := lst.MarshalJSON() - retjson, _ := json.Marshal(lst) + retjson, _ := sonic.Marshal(lst) assert.Equal(t, retjson, strjson) } diff --git a/test/dictionary_test.go b/test/dictionary_test.go index 8a46d67..a221faa 100644 --- a/test/dictionary_test.go +++ b/test/dictionary_test.go @@ -1,12 +1,13 @@ package test import ( - "encoding/json" "errors" "fmt" + "testing" + + "github.com/bytedance/sonic" "github.com/farseer-go/collections" "github.com/stretchr/testify/assert" - "testing" ) func Test_dictionary_Values(t *testing.T) { @@ -211,10 +212,10 @@ func TestDictionary_IsNil(t *testing.T) { func TestDictionaryJson(t *testing.T) { var dic collections.Dictionary[int, int] assert.True(t, dic.IsNil()) - marshal, _ := json.Marshal(dic) + marshal, _ := sonic.Marshal(dic) assert.Equal(t, "{}", string(marshal)) - _ = json.Unmarshal([]byte("{}"), &dic) + _ = sonic.Unmarshal([]byte("{}"), &dic) assert.False(t, dic.IsNil()) } diff --git a/test/list_test.go b/test/list_test.go index b1deddf..d284a7e 100644 --- a/test/list_test.go +++ b/test/list_test.go @@ -1,12 +1,13 @@ package test import ( - "encoding/json" + "reflect" + "testing" + + "github.com/bytedance/sonic" "github.com/farseer-go/collections" "github.com/farseer-go/fs/types" "github.com/stretchr/testify/assert" - "reflect" - "testing" ) func TestList_AsEnumerable(t *testing.T) { @@ -100,10 +101,10 @@ func TestNil(t *testing.T) { func TestListJson(t *testing.T) { var lst collections.List[int] - marshal, _ := json.Marshal(lst) + marshal, _ := sonic.Marshal(lst) assert.Equal(t, "[]", string(marshal)) - _ = json.Unmarshal([]byte("[]"), &lst) + _ = sonic.Unmarshal([]byte("[]"), &lst) assert.False(t, lst.IsNil()) }