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

Function TestLearnListRemove

test/list_test.go:49–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestLearnListRemove(t *testing.T) {
50 wb := SetupWorkbench(t)
51 defer wb.Close()
52
53 shellPid := wb.LaunchFakeShell()
54
55 wb.RunCodCmd("init", strconv.Itoa(shellPid), "bash")
56
57 wb.RunCodCmd("learn", "--", "binaries/cat.py", "--help")
58 wb.RunCodCmd("learn", "--", "binaries/naval-fate.py", "--help")
59
60 out := wb.RunCodCmd("list")
61
62 commands := wb.ParseCodListCommands(out)
63
64 require.Equal(t,
65 []string{
66 "binaries/cat.py --help",
67 "binaries/naval-fate.py --help",
68 },
69 commands,
70 )
71
72 wb.RunCodCmd("remove", "1")
73 out = wb.RunCodCmd("list")
74 commands = wb.ParseCodListCommands(out)
75
76 require.Equal(t,
77 []string{
78 "binaries/naval-fate.py --help",
79 },
80 commands,
81 )
82
83 wb.RunCodCmd("remove", "2")
84 out = wb.RunCodCmd("list")
85 require.Equal(t, "", out)
86}
87
88func TestLearnListBasenameSelector(t *testing.T) {
89 wb := SetupWorkbench(t)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected