mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-01 00:23:48 +03:00
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.
This commit is contained in:
parent
29362e45bc
commit
794d271152
1 changed files with 4 additions and 25 deletions
|
@ -118,49 +118,28 @@ func TestSplitCommandAndArgs(t *testing.T) {
|
|||
expectedArgs: []string{`arg1 arg1`},
|
||||
expectedErrContent: ``,
|
||||
},
|
||||
// Test case 4 - command with single argument with space character - escaped
|
||||
{
|
||||
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
|
||||
// Test case 5 - command with comments
|
||||
{
|
||||
input: `command arg1 #comment1 comment2`,
|
||||
expectedCommand: `command`,
|
||||
expectedArgs: []string{`arg1`},
|
||||
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",
|
||||
expectedCommand: `command`,
|
||||
expectedArgs: []string{`arg1`, `arg2`, "arg3"},
|
||||
expectedErrContent: "",
|
||||
},
|
||||
// Test case 10 - command with unclosed quotes
|
||||
// Test case 7 - command with unclosed quotes
|
||||
{
|
||||
input: `command "arg1 arg2`,
|
||||
expectedCommand: "",
|
||||
expectedArgs: nil,
|
||||
expectedErrContent: parseErrorContent,
|
||||
},
|
||||
// Test case 11 - command with unclosed quotes
|
||||
// Test case 8 - command with unclosed quotes
|
||||
{
|
||||
input: `command 'arg1 arg2"`,
|
||||
expectedCommand: "",
|
||||
|
|
Loading…
Reference in a new issue