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

Function TestNewCmdEdit

pkg/cmd/gist/edit/edit_test.go:40–138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestNewCmdEdit(t *testing.T) {
41 tests := []struct {
42 name string
43 cli string
44 wants EditOptions
45 wantsErr bool
46 }{
47 {
48 name: "no flags",
49 cli: "123",
50 wants: EditOptions{
51 Selector: "123",
52 },
53 },
54 {
55 name: "filename",
56 cli: "123 --filename cool.md",
57 wants: EditOptions{
58 Selector: "123",
59 EditFilename: "cool.md",
60 },
61 },
62 {
63 name: "add",
64 cli: "123 --add cool.md",
65 wants: EditOptions{
66 Selector: "123",
67 AddFilename: "cool.md",
68 },
69 },
70 {
71 name: "add with source",
72 cli: "123 --add cool.md -",
73 wants: EditOptions{
74 Selector: "123",
75 AddFilename: "cool.md",
76 SourceFile: "-",
77 },
78 },
79 {
80 name: "description",
81 cli: `123 --desc "my new description"`,
82 wants: EditOptions{
83 Selector: "123",
84 Description: "my new description",
85 },
86 },
87 {
88 name: "remove",
89 cli: "123 --remove cool.md",
90 wants: EditOptions{
91 Selector: "123",
92 RemoveFilename: "cool.md",
93 },
94 },
95 {
96 name: "add and remove are mutually exclusive",
97 cli: "123 --add cool.md --remove great.md",

Callers

nothing calls this directly

Calls 4

EqualMethod · 0.80
NewCmdEditFunction · 0.70
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected