소스 검색

string list test

v2ray 9 년 전
부모
커밋
216faf587c
1개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 21 0
      common/serial/string_list_json_test.go

+ 21 - 0
common/serial/string_list_json_test.go

@@ -0,0 +1,21 @@
+// +build json
+
+package serial_test
+
+import (
+	"encoding/json"
+	"testing"
+
+	. "github.com/v2ray/v2ray-core/common/serial"
+	v2testing "github.com/v2ray/v2ray-core/testing"
+	"github.com/v2ray/v2ray-core/testing/assert"
+)
+
+func TestStringListUnmarshalError(t *testing.T) {
+	v2testing.Current(t)
+
+	rawJson := `1234`
+	list := new(StringLiteralList)
+	err := json.Unmarshal([]byte(rawJson), list)
+	assert.Error(err).IsNotNil()
+}