|
|
@@ -158,6 +158,27 @@ func Test_encode_byte_array(t *testing.T) {
|
|
|
should.Equal(`"AQID"`, string(bytes))
|
|
|
}
|
|
|
|
|
|
+func Test_encode_empty_byte_array(t *testing.T) {
|
|
|
+ should := require.New(t)
|
|
|
+ bytes, err := json.Marshal([]byte{})
|
|
|
+ should.Nil(err)
|
|
|
+ should.Equal(`""`, string(bytes))
|
|
|
+ bytes, err = jsoniter.Marshal([]byte{})
|
|
|
+ should.Nil(err)
|
|
|
+ should.Equal(`""`, string(bytes))
|
|
|
+}
|
|
|
+
|
|
|
+func Test_encode_nil_byte_array(t *testing.T) {
|
|
|
+ should := require.New(t)
|
|
|
+ var nilSlice []byte
|
|
|
+ bytes, err := json.Marshal(nilSlice)
|
|
|
+ should.Nil(err)
|
|
|
+ should.Equal(`null`, string(bytes))
|
|
|
+ bytes, err = jsoniter.Marshal(nilSlice)
|
|
|
+ should.Nil(err)
|
|
|
+ should.Equal(`null`, string(bytes))
|
|
|
+}
|
|
|
+
|
|
|
func Test_decode_byte_array_from_base64(t *testing.T) {
|
|
|
should := require.New(t)
|
|
|
data := []byte{}
|