(t *testing.T)
| 155 | } |
| 156 | |
| 157 | func TestShellJoinArgs(t *testing.T) { |
| 158 | tests := []struct { |
| 159 | name string |
| 160 | input []string |
| 161 | expected string |
| 162 | }{ |
| 163 | { |
| 164 | name: "simple arguments", |
| 165 | input: []string{"git", "status"}, |
| 166 | expected: "git status", |
| 167 | }, |
| 168 | { |
| 169 | name: "arguments with special characters", |
| 170 | input: []string{"--allow-tool", "shell(git add:*)", "--allow-tool", "shell(git commit:*)"}, |
| 171 | expected: "--allow-tool 'shell(git add:*)' --allow-tool 'shell(git commit:*)'", |
| 172 | }, |
| 173 | { |
| 174 | name: "mixed arguments", |
| 175 | input: []string{"copilot", "--add-dir", "/tmp/gh-aw/", "--allow-tool", "shell(*.txt)"}, |
| 176 | expected: "copilot --add-dir /tmp/gh-aw/ --allow-tool 'shell(*.txt)'", |
| 177 | }, |
| 178 | { |
| 179 | name: "prompt with pre-quoted instruction is now properly escaped by shellJoinArgs", |
| 180 | input: []string{"copilot", "--add-dir", "/tmp/gh-aw/", "--prompt", "\"$INSTRUCTION\""}, |
| 181 | expected: "copilot --add-dir /tmp/gh-aw/ --prompt '\"$INSTRUCTION\"'", |
| 182 | }, |
| 183 | { |
| 184 | name: "allow-domains with GitHub Actions expression uses double quotes", |
| 185 | input: []string{"--allow-domains", "${{ env.MCP_ENV == 'staging' && env.MCP_URL_STAGING || env.MCP_URL_PROD }},errors.code.visualstudio.com"}, |
| 186 | expected: `--allow-domains "${{ env.MCP_ENV == 'staging' && env.MCP_URL_STAGING || env.MCP_URL_PROD }},errors.code.visualstudio.com"`, |
| 187 | }, |
| 188 | } |
| 189 | |
| 190 | for _, tt := range tests { |
| 191 | t.Run(tt.name, func(t *testing.T) { |
| 192 | result := shellJoinArgs(tt.input) |
| 193 | if result != tt.expected { |
| 194 | t.Errorf("shellJoinArgs(%q) = %q, expected %q", tt.input, result, tt.expected) |
| 195 | } |
| 196 | }) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | func TestBuildDockerCommandWithExpandableVars(t *testing.T) { |
| 201 | tests := []struct { |
nothing calls this directly
no test coverage detected