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

Function TestLearnFromPATH

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

Source from the content-addressed store, hash-verified

112}
113
114func TestLearnFromPATH(t *testing.T) {
115 wb := SetupWorkbench(t)
116 defer wb.Close()
117
118 shellPid := strconv.Itoa(wb.LaunchFakeShell())
119
120 wb.RunCodCmd("init", shellPid, "bash")
121
122 tmpBinDir := wb.InTmpDataPath("bin")
123 err := os.Mkdir(tmpBinDir, 0755)
124 require.NoError(t, err)
125
126 binCat := filepath.Join(tmpBinDir, "cat.py")
127 wb.CopyFile("binaries/cat.py", binCat)
128
129 modifiedEnv := map[string]string{
130 "PATH": fmt.Sprintf("%s:%s", tmpBinDir, os.Getenv("PATH")),
131 }
132 wb.RunCodCmdModifiedEnv(modifiedEnv, "learn", "--", "cat.py", "--help")
133
134 out := wb.RunCodCmd("list")
135 parsed := wb.ParseCodListMap(out)
136 require.Equal(
137 t,
138 map[int]string{
139 1: "bin/cat.py --help",
140 },
141 parsed,
142 )
143}
144
145func TestMergeLearn(t *testing.T) {
146 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
RunCodCmdModifiedEnvMethod · 0.80
ParseCodListMapMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected