MCPcopy Index your code
hub / github.com/ossf/scorecard / TestGitHubWorkflowShell

Function TestGitHubWorkflowShell

checks/fileparser/github_workflow_test.go:27–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func 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 {

Callers

nothing calls this directly

Calls 2

GetShellForStepFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected