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

Function TestLearn

test/learn_test.go:30–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

SetupWorkbenchFunction · 0.85
LaunchFakeShellMethod · 0.80
RunCodCmdMethod · 0.80
ErrMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected