mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-22 21:41:01 +01:00
Add test for importing history entries from fish
This commit is contained in:
parent
319b5723a7
commit
ebb6b36b34
@ -1477,6 +1477,7 @@ func testInitialHistoryImport(t *testing.T, tester shellTester) {
|
||||
defer testutils.BackupAndRestore(t)()
|
||||
|
||||
// Record some commands before installing hishtory
|
||||
captureTerminalOutputWithShellName(t, tester, "fish", []string{"echo SPACE fishcommand ENTER"})
|
||||
randomCmdUuid := uuid.Must(uuid.NewRandom()).String()
|
||||
randomCmd := fmt.Sprintf(`echo %v-foo
|
||||
echo %v-bar`, randomCmdUuid, randomCmdUuid)
|
||||
@ -1509,7 +1510,7 @@ echo %v-bar`, randomCmdUuid, randomCmdUuid)
|
||||
|
||||
// Check that the previously recorded commands are in hishtory
|
||||
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail`)
|
||||
expectedOutput = fmt.Sprintf("hishtory export %s\necho %s-foo\necho %s-bar\n/tmp/client install \nhishtory export %s\nstdincommand\necho stdincommand | hishtory import\n", randomCmdUuid, randomCmdUuid, randomCmdUuid, randomCmdUuid)
|
||||
expectedOutput = fmt.Sprintf("hishtory export %s\necho %s-foo\necho %s-bar\n/tmp/client install \nhishtory export %s\necho fishcommand\nstdincommand\necho stdincommand | hishtory import\n", randomCmdUuid, randomCmdUuid, randomCmdUuid, randomCmdUuid)
|
||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
||||
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user