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

Function TestUpdateReplace

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

Source from the content-addressed store, hash-verified

24)
25
26func TestUpdateReplace(t *testing.T) {
27 wb := SetupWorkbench(t)
28 defer wb.Close()
29
30 shellPid := strconv.Itoa(wb.LaunchFakeShell())
31
32 wb.RunCodCmd("init", shellPid, "bash")
33
34 tmpCat := wb.InTmpDataPath("foo")
35 wb.CopyFile("binaries/foo_v1.py", tmpCat)
36 wb.RunCodCmd("learn", "--", tmpCat, "--help")
37 out := wb.RunCodCmd("api", "complete-words", shellPid, "--", "1", tmpCat, "--")
38 completions := wb.SplitLines(out)
39 sort.Strings(completions)
40 require.Equal(t, []string{"--bar1", "--foo1"}, completions)
41
42 wb.CopyFile("binaries/foo_v2.py", tmpCat)
43 wb.RunCodCmd("update", "**")
44
45 out = wb.RunCodCmd("list")
46 parsed := wb.ParseCodListCommands(out)
47 require.Equal(t,
48 []string{
49 "foo --help",
50 },
51 parsed)
52
53 out = wb.RunCodCmd("api", "complete-words", shellPid, "--", "1", tmpCat, "--")
54 completions = wb.SplitLines(out)
55 sort.Strings(completions)
56 require.Equal(t, []string{"--bar2", "--foo2", "--qux2"}, completions)
57}
58
59func TestUpdateMerge(t *testing.T) {
60 wb := SetupWorkbench(t)

Callers

nothing calls this directly

Calls 8

SetupWorkbenchFunction · 0.85
LaunchFakeShellMethod · 0.80
RunCodCmdMethod · 0.80
InTmpDataPathMethod · 0.80
CopyFileMethod · 0.80
SplitLinesMethod · 0.80
ParseCodListCommandsMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected