MCPcopy
hub / github.com/cli/cli / Test_NewCmdCheck

Function Test_NewCmdCheck

pkg/cmd/ruleset/check/check_test.go:20–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func Test_NewCmdCheck(t *testing.T) {
21 tests := []struct {
22 name string
23 args string
24 isTTY bool
25 want CheckOptions
26 wantErr string
27 }{
28 {
29 name: "no arguments",
30 args: "",
31 isTTY: true,
32 want: CheckOptions{
33 Branch: "",
34 Default: false,
35 WebMode: false,
36 },
37 },
38 {
39 name: "branch name",
40 args: "my-branch",
41 isTTY: true,
42 want: CheckOptions{
43 Branch: "my-branch",
44 Default: false,
45 WebMode: false,
46 },
47 },
48 {
49 name: "default",
50 args: "--default=true",
51 isTTY: true,
52 want: CheckOptions{
53 Branch: "",
54 Default: true,
55 WebMode: false,
56 },
57 },
58 {
59 name: "web mode",
60 args: "--web",
61 isTTY: true,
62 want: CheckOptions{
63 Branch: "",
64 Default: false,
65 WebMode: true,
66 },
67 },
68 {
69 name: "both --default and branch name specified",
70 args: "--default asdf",
71 isTTY: true,
72 wantErr: "specify only one of `--default` or a branch name",
73 },
74 }
75
76 for _, tt := range tests {
77 t.Run(tt.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
NewCmdCheckFunction · 0.85
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected