(t *testing.T)
| 112 | } |
| 113 | |
| 114 | func 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 | |
| 145 | func TestMergeLearn(t *testing.T) { |
| 146 | wb := SetupWorkbench(t) |
nothing calls this directly
no test coverage detected