mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 10:12:06 +03:00
44 lines
579 B
Go
44 lines
579 B
Go
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))
|
|
}
|
|
}
|