diff options
Diffstat (limited to 'commands/ls_test.go')
-rw-r--r-- | commands/ls_test.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/commands/ls_test.go b/commands/ls_test.go new file mode 100644 index 00000000..aff94e03 --- /dev/null +++ b/commands/ls_test.go @@ -0,0 +1,43 @@ +package commands + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_repairQuery(t *testing.T) { + cases := []struct { + args []string + output string + }{ + { + []string{""}, + "", + }, + { + []string{"foo"}, + "foo", + }, + { + []string{"foo", "bar"}, + "foo bar", + }, + { + []string{"foo bar", "baz"}, + "\"foo bar\" baz", + }, + { + []string{"foo:bar", "baz"}, + "foo:bar baz", + }, + { + []string{"foo:bar boo", "baz"}, + "foo:\"bar boo\" baz", + }, + } + + for _, tc := range cases { + require.Equal(t, tc.output, repairQuery(tc.args)) + } +} |