MCPcopy Create free account
hub / github.com/dim-an/cod / TestExampleConfiguration

Function TestExampleConfiguration

test/example_configuration_test.go:26–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestExampleConfiguration(t *testing.T) {
27 wb := SetupWorkbench(t)
28 defer wb.Close()
29
30 wb.RunCodCmd("example-config", "--create")
31
32 _, err := wb.UncheckedRunCodCmd("example-config", "--create")
33 require.Error(t, err)
34
35 shellPidInt := wb.LaunchFakeShell()
36 shellPid := strconv.Itoa(shellPidInt)
37 wb.RunCodCmd("init", shellPid, "bash")
38 wb.RunCodCmd("learn", "--", "binaries/cat.py", "--help")
39 out := wb.RunCodCmd("api", "complete-words", shellPid, "--", "1", "binaries/cat.py", "-")
40
41 scan := bufio.NewScanner(strings.NewReader(out))
42 var lines []string
43 for scan.Scan() {
44 lines = append(lines, scan.Text())
45 }
46 require.Nil(t, scan.Err())
47
48 require.Equal(t, []string{
49 "-A",
50 "--show-all",
51 "-b",
52 "--number-nonblank",
53 "-n",
54 "-e",
55 "-E",
56 "--show-ends",
57 "--number",
58 "-s",
59 "--squeeze-blank",
60 "-t",
61 "-T",
62 "--show-tabs",
63 "-u",
64 "-v",
65 "--show-nonprinting",
66 "--help",
67 "--version",
68 }, lines)
69}

Callers

nothing calls this directly

Calls 7

SetupWorkbenchFunction · 0.85
RunCodCmdMethod · 0.80
UncheckedRunCodCmdMethod · 0.80
LaunchFakeShellMethod · 0.80
ErrMethod · 0.80
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected