1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-03 07:56:42 -05:00
v2fly/common/serial/string_json_test.go
2016-05-24 21:55:46 +02:00

29 lines
520 B
Go

// +build json
package serial_test
import (
"encoding/json"
"testing"
. "github.com/v2ray/v2ray-core/common/serial"
"github.com/v2ray/v2ray-core/testing/assert"
)
func TestInvalidStringTJson(t *testing.T) {
assert := assert.On(t)
var s StringT
err := json.Unmarshal([]byte("1"), &s)
assert.Error(err).IsNotNil()
}
func TestStringTParsing(t *testing.T) {
assert := assert.On(t)
var s StringT
err := json.Unmarshal([]byte("\"1\""), &s)
assert.Error(err).IsNil()
assert.String(s.String()).Equals("1")
}