Commit 794d2711 authored by Matthew Holt's avatar Matthew Holt

Remove extra tests that were Linux-specific

These tests with the backslash seem to assert that shlex (our Unix shell parsing library) is working properly, not our wrapper function (that parses commands for both Windows and non-Windows). These tests break on Windows so I have removed them.
parent 29362e45
...@@ -118,49 +118,28 @@ func TestSplitCommandAndArgs(t *testing.T) { ...@@ -118,49 +118,28 @@ func TestSplitCommandAndArgs(t *testing.T) {
expectedArgs: []string{`arg1 arg1`}, expectedArgs: []string{`arg1 arg1`},
expectedErrContent: ``, expectedErrContent: ``,
}, },
// Test case 4 - command with single argument with space character - escaped // Test case 5 - command with comments
{
input: `command arg1\ arg1`,
expectedCommand: `command`,
expectedArgs: []string{`arg1 arg1`},
expectedErrContent: ``,
},
// Test case 6 - command with escaped quote character
{
input: `command "arg1 \" arg1"`,
expectedCommand: `command`,
expectedArgs: []string{`arg1 " arg1`},
expectedErrContent: ``,
},
// Test case 7 - command with escaped backslash
{
input: `command '\arg1'`,
expectedCommand: `command`,
expectedArgs: []string{`\arg1`},
expectedErrContent: ``,
},
// Test case 8 - command with comments
{ {
input: `command arg1 #comment1 comment2`, input: `command arg1 #comment1 comment2`,
expectedCommand: `command`, expectedCommand: `command`,
expectedArgs: []string{`arg1`}, expectedArgs: []string{`arg1`},
expectedErrContent: "", expectedErrContent: "",
}, },
// Test case 9 - command with multiple spaces and tab character // Test case 6 - command with multiple spaces and tab character
{ {
input: "command arg1 arg2\targ3", input: "command arg1 arg2\targ3",
expectedCommand: `command`, expectedCommand: `command`,
expectedArgs: []string{`arg1`, `arg2`, "arg3"}, expectedArgs: []string{`arg1`, `arg2`, "arg3"},
expectedErrContent: "", expectedErrContent: "",
}, },
// Test case 10 - command with unclosed quotes // Test case 7 - command with unclosed quotes
{ {
input: `command "arg1 arg2`, input: `command "arg1 arg2`,
expectedCommand: "", expectedCommand: "",
expectedArgs: nil, expectedArgs: nil,
expectedErrContent: parseErrorContent, expectedErrContent: parseErrorContent,
}, },
// Test case 11 - command with unclosed quotes // Test case 8 - command with unclosed quotes
{ {
input: `command 'arg1 arg2"`, input: `command 'arg1 arg2"`,
expectedCommand: "", expectedCommand: "",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment