mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 20:04:30 +08:00
c3ef23b10f
Before running a command, we add the command to history, so that if the command causes us to exit it's still captured in history. But that command should not be considered part of history when expanding the history within the command itself. For example, `echo $history[1]` should be the previously run command, not `echo $history[1]` itself. Fixes #2028
36 lines
942 B
Plaintext
36 lines
942 B
Plaintext
# vim: set filetype=expect:
|
|
#
|
|
# General tests that don't belong elsewhere
|
|
|
|
spawn $fish
|
|
|
|
expect_prompt
|
|
|
|
# ensure the Apple key () is typeable
|
|
send_line "echo "
|
|
expect_prompt "" {} unmatched {
|
|
puts stderr "Couldn't type apple key ()"
|
|
}
|
|
|
|
# check that history is returned in the right order (#2028)
|
|
# this hist_command nonsense is the cleanest way to send the $ char
|
|
set hist_command "echo \$history\[1\]"
|
|
|
|
# first send 'echo stuff'
|
|
send_line "echo stuff"
|
|
expect_prompt "stuff" {} unmatched {
|
|
puts stderr "Couldn't find expected output 'stuff'"
|
|
}
|
|
|
|
# last history item should be 'echo stuff'
|
|
send_line $hist_command
|
|
expect_prompt "echo stuff" {} unmatched {
|
|
puts stderr "Couldn't find expected output 'echo stuff'"
|
|
}
|
|
|
|
# last history command should be the one that printed the history
|
|
send_line $hist_command
|
|
expect_prompt -re {echo .history.*} {} unmatched {
|
|
puts stderr "Couldn't find expected output $hist_command"
|
|
}
|