MCPcopy Create free account
hub / github.com/cli/cli / TestIsGitHubActions

Function TestIsGitHubActions

internal/ci/ci_test.go:34–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestIsGitHubActions(t *testing.T) {
35 tests := []struct {
36 name string
37 value string
38 set bool
39 want bool
40 }{
41 {name: "unset", set: false, want: false},
42 {name: "true", value: "true", set: true, want: true},
43 {name: "false", value: "false", set: true, want: false},
44 {name: "empty", value: "", set: true, want: false},
45 {name: "other value", value: "yes", set: true, want: false},
46 }
47 for _, tt := range tests {
48 t.Run(tt.name, func(t *testing.T) {
49 t.Setenv("GITHUB_ACTIONS", "")
50 if tt.set {
51 t.Setenv("GITHUB_ACTIONS", tt.value)
52 }
53 assert.Equal(t, tt.want, IsGitHubActions())
54 })
55 }
56}

Callers

nothing calls this directly

Calls 3

IsGitHubActionsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected