mirror of
https://github.com/docker/cli.git
synced 2026-01-15 07:40:57 +03:00
Add test coverage for pkg/stringutils
Signed-off-by: Vincent Demeester <vincent@sbr.pm> Upstream-commit: 6c36572e8b77bd7a4e8c1afa5be00fb4e7618c12 Component: engine
This commit is contained in:
@@ -85,3 +85,21 @@ func TestInSlice(t *testing.T) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user