(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestGitHubWorkflowShell(t *testing.T) { |
| 28 | t.Parallel() |
| 29 | |
| 30 | repeatItem := func(item string, count int) []string { |
| 31 | ret := make([]string, 0, count) |
| 32 | for i := 0; i < count; i++ { |
| 33 | ret = append(ret, item) |
| 34 | } |
| 35 | return ret |
| 36 | } |
| 37 | |
| 38 | tests := []struct { |
| 39 | name string |
| 40 | filename string |
| 41 | // The shells used in each step, listed in order that the steps are listed in the file |
| 42 | expectedShells []string |
| 43 | }{ |
| 44 | { |
| 45 | name: "all windows, shell specified in step", |
| 46 | filename: "../testdata/.github/workflows/github-workflow-shells-all-windows-bash.yaml", |
| 47 | expectedShells: []string{"bash"}, |
| 48 | }, |
| 49 | { |
| 50 | name: "all windows, OSes listed in matrix.os", |
| 51 | filename: "../testdata/.github/workflows/github-workflow-shells-all-windows-matrix.yaml", |
| 52 | expectedShells: []string{"pwsh"}, |
| 53 | }, |
| 54 | { |
| 55 | name: "all windows, OSes listed in matrix.include", |
| 56 | filename: "../testdata/.github/workflows/github-workflow-shells-all-windows-matrix-include.yaml", |
| 57 | expectedShells: []string{"pwsh"}, |
| 58 | }, |
| 59 | { |
| 60 | name: "all windows, empty matrix.include", |
| 61 | filename: "../testdata/.github/workflows/github-workflow-shells-all-windows-matrix-include-empty.yaml", |
| 62 | expectedShells: []string{"pwsh"}, |
| 63 | }, |
| 64 | { |
| 65 | name: "all windows", |
| 66 | filename: "../testdata/.github/workflows/github-workflow-shells-all-windows.yaml", |
| 67 | expectedShells: []string{"pwsh"}, |
| 68 | }, |
| 69 | { |
| 70 | name: "macOS defaults to bash", |
| 71 | filename: "../testdata/.github/workflows/github-workflow-shells-default-macos.yaml", |
| 72 | expectedShells: []string{"bash"}, |
| 73 | }, |
| 74 | { |
| 75 | name: "ubuntu defaults to bash", |
| 76 | filename: "../testdata/.github/workflows/github-workflow-shells-default-ubuntu.yaml", |
| 77 | expectedShells: []string{"bash"}, |
| 78 | }, |
| 79 | { |
| 80 | name: "windows defaults to pwsh", |
| 81 | filename: "../testdata/.github/workflows/github-workflow-shells-default-windows.yaml", |
| 82 | expectedShells: []string{"pwsh"}, |
| 83 | }, |
| 84 | { |
nothing calls this directly
no test coverage detected