1package commands
 2
 3import (
 4	"testing"
 5
 6	"github.com/stretchr/testify/require"
 7)
 8
 9func Test_repairQuery(t *testing.T) {
10	cases := []struct {
11		args   []string
12		output string
13	}{
14		{
15			[]string{""},
16			"",
17		},
18		{
19			[]string{"foo"},
20			"foo",
21		},
22		{
23			[]string{"foo", "bar"},
24			"foo bar",
25		},
26		{
27			[]string{"foo bar", "baz"},
28			"\"foo bar\" baz",
29		},
30		{
31			[]string{"foo:bar", "baz"},
32			"foo:bar baz",
33		},
34		{
35			[]string{"foo:bar boo", "baz"},
36			"foo:\"bar boo\" baz",
37		},
38	}
39
40	for _, tc := range cases {
41		require.Equal(t, tc.output, repairQuery(tc.args))
42	}
43}