mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05: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
					
				@ -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:    "",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user