Merge pull request #13589 from vdemeester/pkg-stringutils-test-coverage

Add test coverage for pkg/stringutils
This commit is contained in:
Alexander Morozov 2015-05-29 13:38:12 -07:00
commit 90c414b594

View file

@ -85,3 +85,21 @@ func TestInSlice(t *testing.T) {
t.Fatalf("Expected string notinslice not to be in slice") t.Fatalf("Expected string notinslice not to be in slice")
} }
} }
func TestShellQuoteArgumentsEmpty(t *testing.T) {
actual := ShellQuoteArguments([]string{})
expected := ""
if actual != expected {
t.Fatalf("Expected an empty string")
}
}
func TestShellQuoteArguments(t *testing.T) {
simpleString := "simpleString"
complexString := "This is a 'more' complex $tring with some special char *"
actual := ShellQuoteArguments([]string{simpleString, complexString})
expected := "simpleString 'This is a '\\''more'\\'' complex $tring with some special char *'"
if actual != expected {
t.Fatalf("Expected \"%v\", got \"%v\"", expected, actual)
}
}