(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func 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 | |
| 94 | func TestUpdateNoChange(t *testing.T) { |
| 95 | wb := SetupWorkbench(t) |
nothing calls this directly
no test coverage detected