mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 08:43:09 -03:00
Remove expect
This should remove the last bits of expect from the codebase.
This commit is contained in:
@@ -22,12 +22,10 @@ cd (dirname (status -f))
|
||||
set -gx TERM xterm
|
||||
set -e ITERM_PROFILE
|
||||
|
||||
# Test files specified on commandline, or all *.expect files.
|
||||
# Test files specified on commandline, or all pexpect files.
|
||||
if set -q argv[1]
|
||||
set expect_files_to_test $argv.expect
|
||||
set pexpect_files_to_test pexpects/$argv.py
|
||||
else
|
||||
set expect_files_to_test *.expect
|
||||
set pexpect_files_to_test pexpects/*.py
|
||||
end
|
||||
|
||||
@@ -36,54 +34,6 @@ or exit
|
||||
cat interactive.config >>$XDG_CONFIG_HOME/fish/config.fish
|
||||
|
||||
say -o cyan "Testing interactive functionality"
|
||||
function test_expect_file
|
||||
return
|
||||
set -l file $argv[1]
|
||||
echo -n "Testing file $file ... "
|
||||
set starttime (timestamp)
|
||||
begin
|
||||
set -lx TERM dumb
|
||||
expect -n -c 'source interactive.expect.rc' -f $file >$file.tmp.out 2>$file.tmp.err
|
||||
end
|
||||
set -l exit_status $status
|
||||
set -l res ok
|
||||
set test_duration (delta $starttime)
|
||||
mv -f interactive.tmp.log $file.tmp.log
|
||||
|
||||
diff $file.tmp.out $file.out >/dev/null
|
||||
set -l out_status $status
|
||||
diff $file.tmp.err $file.err >/dev/null
|
||||
set -l err_status $status
|
||||
|
||||
if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0
|
||||
printf '%s\n' (set_color green)ok(set_color normal)" ($test_duration $unit)"
|
||||
# clean up tmp files
|
||||
rm -f $file.tmp.{err,out,log}
|
||||
return 0
|
||||
else
|
||||
say red fail
|
||||
if test $out_status -ne 0
|
||||
say yellow "Output differs for file $file. Diff follows:"
|
||||
colordiff -u $file.out $file.tmp.out
|
||||
end
|
||||
if test $err_status -ne 0
|
||||
say yellow "Error output differs for file $file. Diff follows:"
|
||||
colordiff -u $file.err $file.tmp.err
|
||||
end
|
||||
if test $exit_status -ne 0
|
||||
say yellow "Exit status differs for file $file."
|
||||
echo "Unexpected test exit status $exit_status."
|
||||
end
|
||||
if set -q SHOW_INTERACTIVE_LOG
|
||||
# dump the interactive log
|
||||
# primarily for use in travis where we can't check it manually
|
||||
say yellow "Log for file $file:"
|
||||
cat $file.tmp.log
|
||||
end
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function test_pexpect_file
|
||||
set -l file $argv[1]
|
||||
echo -n "Testing file $file ... "
|
||||
@@ -122,20 +72,6 @@ for i in $pexpect_files_to_test
|
||||
end
|
||||
end
|
||||
|
||||
if not type -q expect
|
||||
say red "expect tests disabled: `expect` not found"
|
||||
set expect_files_to_test
|
||||
end
|
||||
for i in $expect_files_to_test
|
||||
if not test_expect_file $i
|
||||
say -o cyan "Rerunning test $i"
|
||||
rm -f $i.tmp.*
|
||||
if not test_expect_file $i
|
||||
set failed $failed $i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set failed (count $failed)
|
||||
if test $failed -eq 0
|
||||
say green "All interactive tests completed successfully"
|
||||
|
||||
Reference in New Issue
Block a user