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

Function TestUpdateMerge

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

Source from the content-addressed store, hash-verified

57}
58
59func TestUpdateMerge(t *testing.T) {
60 wb := SetupWorkbench(t)
61 defer wb.Close()
62
63 shellPid := strconv.Itoa(wb.LaunchFakeShell())
64
65 wb.RunCodCmd("init", shellPid, "bash")
66
67 tmpCat := wb.InTmpDataPath("foo")
68 wb.CopyFile("binaries/foo_v1.py", tmpCat)
69 wb.RunCodCmd("learn", "--", tmpCat, "--help")
70
71 out := wb.RunCodCmd("list")
72 parsed := wb.ParseCodListCommands(out)
73 require.Equal(t, len(parsed), 1)
74
75 wb.CopyFile("binaries/foo_v2.py", tmpCat)
76 wb.RunCodCmd("learn", "--", tmpCat, "gg", "--help")
77
78 out = wb.RunCodCmd("list")
79 parsed = wb.ParseCodListCommands(out)
80 require.Equal(
81 t,
82 []string{
83 "foo --help",
84 "foo gg --help",
85 }, parsed)
86
87 wb.RunCodCmd("update", "**")
88
89 out = wb.RunCodCmd("list")
90 parsed = wb.ParseCodListCommands(out)
91 require.Equal(t, 1, len(parsed))
92}
93
94func TestUpdateNoChange(t *testing.T) {
95 wb := SetupWorkbench(t)

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected