mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-26 02:40:05 +08:00
feat: convertString
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user