feat: convertString

This commit is contained in:
debugtalk
2021-10-03 23:49:04 +08:00
parent 2515d31316
commit 3b99b57eea
2 changed files with 38 additions and 12 deletions

View File

@@ -407,3 +407,24 @@ func TestParseDataStringWithFunctions(t *testing.T) {
t.Fail()
}
}
func TestConvertString(t *testing.T) {
testData := []struct {
raw interface{}
expect interface{}
}{
{"", ""},
{"abc", "abc"},
{"123", "123"},
{123, "123"},
{1.23, "1.23"},
{nil, "<nil>"},
}
for _, data := range testData {
value := convertString(data.raw)
if !assert.Equal(t, data.expect, value) {
t.Fail()
}
}
}