mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-26 18:23:27 +01:00
Refactor fish tests to use the existing API
This commit is contained in:
parent
0e70347c0d
commit
de99d60f7c
@ -1698,34 +1698,16 @@ func TestFish(t *testing.T) {
|
|||||||
installHishtory(t, tester, "")
|
installHishtory(t, tester, "")
|
||||||
|
|
||||||
// Test recording in fish
|
// Test recording in fish
|
||||||
fishLocation, err := exec.LookPath("fish")
|
out := captureTerminalOutputWithShellName(t, tester, "fish", []string{
|
||||||
if err != nil {
|
"echo SPACE foo ENTER",
|
||||||
t.Fatalf("fish is not installed")
|
"ENTER",
|
||||||
}
|
"SPACE echo SPACE baz ENTER",
|
||||||
// TODO: migrate this to the wrapper function
|
"echo SPACE bar ENTER",
|
||||||
out := tester.RunInteractiveShell(t, ` export SHELL=`+fishLocation+`
|
"ls SPACE /tmp/ ENTER",
|
||||||
tmux kill-session -t foo || true
|
"SPACE echo SPACE foobar ENTER",
|
||||||
tmux -u new-session -d -x 200 -y 50 -s foo
|
"ls SPACE /bar/ SPACE '&' ENTER",
|
||||||
tmux send -t foo ps -p $$ ENTER
|
})
|
||||||
sleep 0.5
|
compareGoldens(t, out, "TestFish-capturedPane")
|
||||||
tmux send -t foo echo SPACE foo ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux send -t foo ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux send -t foo SPACE echo SPACE baz ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux send -t foo echo SPACE bar ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux send -t foo ls SPACE /tmp/ ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux send -t foo SPACE echo SPACE foobar ENTER
|
|
||||||
tmux send -t foo ls SPACE /bar/ SPACE '&' ENTER
|
|
||||||
sleep 0.5
|
|
||||||
tmux capture-pane -p
|
|
||||||
tmux kill-session -t foo`)
|
|
||||||
if !strings.Contains(out, "fish") {
|
|
||||||
t.Fatalf("unexpected shell")
|
|
||||||
}
|
|
||||||
|
|
||||||
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail | grep -v ps`)
|
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail | grep -v ps`)
|
||||||
expectedOutput := "echo foo\necho bar\nls /tmp/\nls /bar/ &\n"
|
expectedOutput := "echo foo\necho bar\nls /tmp/\nls /bar/ &\n"
|
||||||
|
19
client/lib/goldens/TestFish-capturedPane
Normal file
19
client/lib/goldens/TestFish-capturedPane
Normal file
@ -0,0 +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
|
||||||
|
foo
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master)>
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master)> echo baz
|
||||||
|
baz
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master)> echo bar
|
||||||
|
bar
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master)> 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
|
||||||
|
foobar
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master)> ls /bar/ &
|
||||||
|
ls: /bar/: No such file or directory
|
||||||
|
|
||||||
|
fish: Job 1, 'ls /bar/ &' has ended
|
||||||
|
david@Davids-MacBook-Air ~/c/hishtory (master) [1]>
|
Loading…
Reference in New Issue
Block a user