diff --git a/strings.go b/strings.go index 6524088..9b482df 100644 --- a/strings.go +++ b/strings.go @@ -23,7 +23,7 @@ type Strings struct { value string } -func Compile(a ...string) Strings { +func CompileStrings(a ...string) Strings { if len(a) <= 0 { return Strings{ value:"[]", diff --git a/strings_marshaljson_test.go b/strings_marshaljson_test.go index 5c6bb72..f7eeeac 100644 --- a/strings_marshaljson_test.go +++ b/strings_marshaljson_test.go @@ -22,34 +22,34 @@ func TestString_MarshalJSON(t *testing.T) { { - Strings: jsonstr.Compile("apple"), + Strings: jsonstr.CompileStrings("apple"), Expected: `["apple"]`, }, { - Strings: jsonstr.Compile("apple", "banana"), + Strings: jsonstr.CompileStrings("apple", "banana"), Expected: `["apple","banana"]`, }, { - Strings: jsonstr.Compile("apple", "banana", "cherry"), + Strings: jsonstr.CompileStrings("apple", "banana", "cherry"), Expected: `["apple","banana","cherry"]`, }, { - Strings: jsonstr.Compile("😈"), + Strings: jsonstr.CompileStrings("😈"), Expected: `["😈"]`, }, { - Strings: jsonstr.Compile("😈", "🙂🙁"), + Strings: jsonstr.CompileStrings("😈", "🙂🙁"), Expected: `["😈","🙂🙁"]`, }, { - Strings: jsonstr.Compile("😈", "🙂🙁", ""), + Strings: jsonstr.CompileStrings("😈", "🙂🙁", ""), Expected: `["😈","🙂🙁",""]`, }, { - Strings: jsonstr.Compile("😈", "🙂🙁", "", "٠١٢٣۴۵۶٧٨٩"), + Strings: jsonstr.CompileStrings("😈", "🙂🙁", "", "٠١٢٣۴۵۶٧٨٩"), Expected: `["😈","🙂🙁","","٠١٢٣۴۵۶٧٨٩"]`, }, } diff --git a/strings_unmarshaljson_test.go b/strings_unmarshaljson_test.go index 07eb731..84e740e 100644 --- a/strings_unmarshaljson_test.go +++ b/strings_unmarshaljson_test.go @@ -30,42 +30,42 @@ func TestString_UnmarshalJSON(t *testing.T) { { - JSON: `["apple"]`, - Expected: jsonstr.Compile("apple"), + JSON: `["apple"]`, + Expected: jsonstr.CompileStrings("apple"), }, { - JSON: `["apple","banana"]`, - Expected: jsonstr.Compile("apple","banana"), + JSON: `["apple","banana"]`, + Expected: jsonstr.CompileStrings("apple","banana"), }, { - JSON: `["apple","banana","cherry"]`, - Expected: jsonstr.Compile("apple","banana","cherry"), + JSON: `["apple","banana","cherry"]`, + Expected: jsonstr.CompileStrings("apple","banana","cherry"), }, { - JSON: `["😈"]`, - Expected: jsonstr.Compile("😈"), + JSON: `["😈"]`, + Expected: jsonstr.CompileStrings("😈"), }, { - JSON: `["😈","🙂🙁"]`, - Expected: jsonstr.Compile("😈","🙂🙁"), + JSON: `["😈","🙂🙁"]`, + Expected: jsonstr.CompileStrings("😈","🙂🙁"), }, { - JSON: `["😈","🙂🙁",""]`, - Expected: jsonstr.Compile("😈","🙂🙁",""), + JSON: `["😈","🙂🙁",""]`, + Expected: jsonstr.CompileStrings("😈","🙂🙁",""), }, { - JSON: `["😈","🙂🙁","","٠١٢٣۴۵۶٧٨٩"]`, - Expected: jsonstr.Compile("😈","🙂🙁","","٠١٢٣۴۵۶٧٨٩"), + JSON: `["😈","🙂🙁","","٠١٢٣۴۵۶٧٨٩"]`, + Expected: jsonstr.CompileStrings("😈","🙂🙁","","٠١٢٣۴۵۶٧٨٩"), }, { - JSON: `["1","two", "THREE", "iv", "۵"]`, - Expected: jsonstr.Compile("1","two", "THREE", "iv", "۵"), + JSON: `["1","two", "THREE", "iv", "۵"]`, + Expected: jsonstr.CompileStrings("1","two", "THREE", "iv", "۵"), }, }