MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / TestGenCodeCmd

Function TestGenCodeCmd

cmd/gencode_test.go:31–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29)
30
31func TestGenCodeCmd(t *testing.T) {
32 execT := execTestCmdFlags{
33 t: t,
34 cmd: genCodeCmd,
35 flagsMap: map[string]string{
36 "file": "test_gencode",
37 "name": "gitlabCmd",
38 "parent": "getCmd",
39 "short": "A short desc",
40 "max-args": "0",
41 "use": "gitlabgencode",
42 },
43 noParent: true,
44 }
45
46 // move to the root directory
47 // to detect hardcoded cmd/ file path in generateCode func
48 if err := os.Chdir("../"); err != nil {
49 glog.Fatal(err)
50 }
51 stdout, execResult := execT.executeCommand()
52 require.Equal(t, pass, execResult, printFlagsTable(execT.flagsMap, stdout))
53 if err := os.Remove("cmd/test_gencode.go"); err != nil {
54 glog.Fatal(err)
55 }
56 if err := os.Remove("cmd/test_gencode_test.go"); err != nil {
57 glog.Fatal(err)
58 }
59
60 // ensure to go back
61 err := os.Chdir("cmd")
62 tInfo(err)
63}

Callers

nothing calls this directly

Calls 3

executeCommandMethod · 0.95
printFlagsTableFunction · 0.85
tInfoFunction · 0.85

Tested by

no test coverage detected