aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-12-12 21:55:07 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-12-12 22:25:10 +0300
commit4967f99474a4040ba150eb04995de06342252718 (patch)
treec9c118836513a8fab6e9fcfb25be5d404338bca7 /vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go
parent2ce9cccb9b0bdd4cd7a3491dc5cbf8687cda51de (diff)
downloadydb-4967f99474a4040ba150eb04995de06342252718.tar.gz
YQ Connector: prepare code base for S3 integration
1. Кодовая база Коннектора переписана с помощью Go дженериков так, чтобы добавление нового источника данных (в частности S3 + csv) максимально переиспользовало имеющийся код (чтобы сохранялась логика нарезания на блоки данных, учёт трафика и пр.) 2. API Connector расширено для работы с S3, но ещё пока не протестировано.
Diffstat (limited to 'vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go')
-rw-r--r--vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go b/vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go
new file mode 100644
index 0000000000..d9fbd4ba82
--- /dev/null
+++ b/vendor/github.com/aws/smithy-go/encoding/json/encoder_test.go
@@ -0,0 +1,34 @@
+package json_test
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/aws/smithy-go/encoding/json"
+)
+
+func TestEncoder(t *testing.T) {
+ encoder := json.NewEncoder()
+
+ object := encoder.Object()
+
+ object.Key("stringKey").String("stringValue")
+ object.Key("integerKey").Long(1024)
+ object.Key("floatKey").Double(3.14)
+
+ subObj := object.Key("foo").Object()
+
+ subObj.Key("byteSlice").Base64EncodeBytes([]byte("foo bar"))
+ subObj.Close()
+
+ object.Close()
+
+ e := []byte(`{"stringKey":"stringValue","integerKey":1024,"floatKey":3.14,"foo":{"byteSlice":"Zm9vIGJhcg=="}}`)
+ if a := encoder.Bytes(); bytes.Compare(e, a) != 0 {
+ t.Errorf("expected %+q, but got %+q", e, a)
+ }
+
+ if a := encoder.String(); string(e) != a {
+ t.Errorf("expected %s, but got %s", e, a)
+ }
+}