mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-24 15:58:52 +01:00
Test table display for fish too
This commit is contained in:
parent
de99d60f7c
commit
cdd7f60f0c
@ -1698,6 +1698,7 @@ func TestFish(t *testing.T) {
|
||||
installHishtory(t, tester, "")
|
||||
|
||||
// Test recording in fish
|
||||
testutils.Check(t, os.Chdir("/"))
|
||||
out := captureTerminalOutputWithShellName(t, tester, "fish", []string{
|
||||
"echo SPACE foo ENTER",
|
||||
"ENTER",
|
||||
@ -1709,11 +1710,17 @@ func TestFish(t *testing.T) {
|
||||
})
|
||||
compareGoldens(t, out, "TestFish-capturedPane")
|
||||
|
||||
// Check export
|
||||
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail | grep -v ps`)
|
||||
expectedOutput := "echo foo\necho bar\nls /tmp/\nls /bar/ &\n"
|
||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
||||
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
|
||||
}
|
||||
|
||||
// Check a table to see some other metadata
|
||||
tester.RunInteractiveShell(t, `hishtory config-set displayed-columns CWD Hostname 'Exit Code' Command`)
|
||||
out = hishtoryQuery(t, tester, "-pipefail")
|
||||
compareGoldens(t, out, "TestFish-table")
|
||||
}
|
||||
|
||||
func normalizeHostnames(data string) string {
|
||||
|
@ -1,19 +1,19 @@
|
||||
Welcome to fish, the friendly interactive shell
|
||||
Type help for instructions on how to use fish
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> echo foo
|
||||
david@Davids-MacBook-Air /> echo foo
|
||||
foo
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)>
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> echo baz
|
||||
david@Davids-MacBook-Air />
|
||||
david@Davids-MacBook-Air /> echo baz
|
||||
baz
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> echo bar
|
||||
david@Davids-MacBook-Air /> echo bar
|
||||
bar
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> ls /tmp/
|
||||
david@Davids-MacBook-Air /> ls /tmp/
|
||||
client* com.google.Keystone/ powerlog/ tmux-501/
|
||||
com.apple.launchd.vphqfEpkYH/ fseventsd-uuid server*
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> echo foobar
|
||||
david@Davids-MacBook-Air /> echo foobar
|
||||
foobar
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master)> ls /bar/ &
|
||||
david@Davids-MacBook-Air /> ls /bar/ &
|
||||
ls: /bar/: No such file or directory
|
||||
|
||||
fish: Job 1, 'ls /bar/ &' has ended
|
||||
david@Davids-MacBook-Air ~/c/hishtory (master) [1]>
|
||||
david@Davids-MacBook-Air / [1]>
|
6
client/lib/goldens/TestFish-table
Normal file
6
client/lib/goldens/TestFish-table
Normal file
@ -0,0 +1,6 @@
|
||||
CWD Hostname Exit Code Command
|
||||
/ ghaction-runner-hostname 0 hishtory config-set displayed-columns CWD Hostname 'Exit Code' Command
|
||||
/ ghaction-runner-hostname 1 ls /bar/ &
|
||||
/ ghaction-runner-hostname 0 ls /tmp/
|
||||
/ ghaction-runner-hostname 0 echo bar
|
||||
/ ghaction-runner-hostname 0 echo foo
|
Loading…
Reference in New Issue
Block a user