Files
opencloud/ocis-pkg/conversions/strings_test.go
A.Unger c284b4d07b Add 'ocis-pkg/' from commit '72d605ba3857d0b972ddd72e226d8a5360fb480d'
git-subtree-dir: ocis-pkg
git-subtree-mainline: 4c12bed11b
git-subtree-split: 72d605ba38
2020-09-18 12:34:50 +02:00

36 lines
606 B
Go

package conversions
import "testing"
var scenarios = []struct {
name string
input string
separator string
out []string
}{
{
"comma separated input",
"a, b, c, d",
",",
[]string{"a", "b", "c", "d"},
}, {
"space separated input",
"a b c d",
" ",
[]string{"a", "b", "c", "d"},
},
}
func TestStringToSliceString(t *testing.T) {
for _, tt := range scenarios {
t.Run(tt.name, func(t *testing.T) {
s := StringToSliceString(tt.input, tt.separator)
for i, v := range tt.out {
if tt.out[i] != v {
t.Errorf("got %q, want %q", s, tt.out)
}
}
})
}
}