(t *testing.T)
| 243 | } |
| 244 | |
| 245 | func TestValidateFixtureRepositoryDeclaration(t *testing.T) { |
| 246 | tests := []struct { |
| 247 | name string |
| 248 | content string |
| 249 | wantErr string |
| 250 | }{ |
| 251 | { |
| 252 | name: "shared", |
| 253 | content: "fixture-repo shared REPO\n", |
| 254 | }, |
| 255 | { |
| 256 | name: "isolated", |
| 257 | content: "fixture-repo isolated REPO\n", |
| 258 | }, |
| 259 | { |
| 260 | name: "none", |
| 261 | content: "fixture-repo none\n", |
| 262 | }, |
| 263 | { |
| 264 | name: "missing", |
| 265 | content: "", |
| 266 | wantErr: "choose one:\n fixture-repo shared REPO\n fixture-repo isolated REPO\n fixture-repo none", |
| 267 | }, |
| 268 | { |
| 269 | name: "multiple", |
| 270 | content: "fixture-repo shared REPO\nfixture-repo isolated OTHER_REPO\n", |
| 271 | wantErr: "choose one:\n fixture-repo shared REPO\n fixture-repo isolated REPO\n fixture-repo none", |
| 272 | }, |
| 273 | { |
| 274 | name: "invalid mode", |
| 275 | content: "fixture-repo pristine REPO\n", |
| 276 | wantErr: "choose one:\n fixture-repo shared REPO\n fixture-repo isolated REPO\n fixture-repo none", |
| 277 | }, |
| 278 | { |
| 279 | name: "invalid environment variable", |
| 280 | content: "fixture-repo shared repo\n", |
| 281 | wantErr: "for example:\n fixture-repo shared REPO", |
| 282 | }, |
| 283 | { |
| 284 | name: "managed fixture creates repository", |
| 285 | content: "fixture-repo isolated REPO\nexec gh repo create $ORG/example --private\n", |
| 286 | wantErr: "either remove gh repo create or use:\n fixture-repo none", |
| 287 | }, |
| 288 | { |
| 289 | name: "managed fixture conditionally creates repository", |
| 290 | content: "fixture-repo shared REPO\n[windows] ! exec gh repo create $ORG/example --private\n", |
| 291 | wantErr: "either remove gh repo create or use:\n fixture-repo none", |
| 292 | }, |
| 293 | { |
| 294 | name: "ignores archive contents", |
| 295 | content: "fixture-repo none\n\n" + |
| 296 | "-- script.sh --\n" + |
| 297 | "fixture-repo shared REPO\n", |
| 298 | }, |
| 299 | } |
| 300 | |
| 301 | for _, tt := range tests { |
| 302 | t.Run(tt.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected