mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 00:04:31 +08:00
4cf3e62643
This previously used /dev/tty to make sure we have `source` connected to a terminal. Only as it turns out, FreeBSD doesn't have that (https://builds.sr.ht/~faho/job/15308). So instead, let's just use the expect tests since stdin there is by definition a terminal.
64 lines
1.8 KiB
Plaintext
64 lines
1.8 KiB
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"
|
|
}
|
|
|
|
# Backslashes at end of comments (#1255)
|
|
# This backslash should NOT cause the line to continue
|
|
send_line "echo -n #comment\\"
|
|
expect_prompt
|
|
|
|
# a pipe at the end of the line (#1285)
|
|
send_line "echo hoge |\n cat"
|
|
expect_prompt "hoge" {} unmatched {
|
|
puts stderr "Error with a pipe at the end of the line"
|
|
}
|
|
send_line "echo hoge | \n cat"
|
|
expect_prompt "hoge" {} unmatched {
|
|
puts stderr "Error with a pipe at the end of the line with whitespaces"
|
|
}
|
|
send_line "echo hoge 2>| \n cat"
|
|
expect_prompt "hoge" {} unmatched {
|
|
puts stderr "Error with a pipe with redirection at the end of the line"
|
|
}
|
|
send_line "echo hoge >| \n cat"
|
|
expect_prompt "hoge" {} unmatched {
|
|
puts stderr "Error with a pipe with redirection at the end of the line"
|
|
}
|
|
|
|
send_line "source; or echo failed"
|
|
expect_prompt "failed" {} unmatched {
|
|
puts stderr "Error with sourcing from the terminal"
|
|
}
|