MCPcopy Index your code
hub / github.com/cli/cli / Test_NewCmdDiff

Function Test_NewCmdDiff

pkg/cmd/pr/diff/diff_test.go:24–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func Test_NewCmdDiff(t *testing.T) {
25 tests := []struct {
26 name string
27 args string
28 isTTY bool
29 want DiffOptions
30 wantErr string
31 }{
32 {
33 name: "name only",
34 args: "--name-only",
35 want: DiffOptions{
36 NameOnly: true,
37 },
38 },
39 {
40 name: "number argument",
41 args: "123",
42 isTTY: true,
43 want: DiffOptions{
44 SelectorArg: "123",
45 UseColor: true,
46 },
47 },
48 {
49 name: "no argument",
50 args: "",
51 isTTY: true,
52 want: DiffOptions{
53 SelectorArg: "",
54 UseColor: true,
55 },
56 },
57 {
58 name: "no color when redirected",
59 args: "",
60 isTTY: false,
61 want: DiffOptions{
62 SelectorArg: "",
63 UseColor: false,
64 },
65 },
66 {
67 name: "force color",
68 args: "--color always",
69 isTTY: false,
70 want: DiffOptions{
71 SelectorArg: "",
72 UseColor: true,
73 },
74 },
75 {
76 name: "disable color",
77 args: "--color never",
78 isTTY: true,
79 want: DiffOptions{
80 SelectorArg: "",
81 UseColor: false,

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewCmdDiffFunction · 0.85
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
SetColorEnabledMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected