2005-09-20 13:31:55 +00:00
|
|
|
#!/usr/local/bin/fish
|
|
|
|
#
|
|
|
|
# Main loop of the test suite. I wrote this
|
2010-09-18 02:18:26 +00:00
|
|
|
# instad of using autotest to provide additional
|
2005-09-20 13:31:55 +00:00
|
|
|
# testing for fish. :-)
|
|
|
|
|
2010-10-03 03:46:26 +00:00
|
|
|
|
|
|
|
if [ "$argv" != '-n' ]
|
2014-09-05 05:26:10 +00:00
|
|
|
set -l res ok
|
2010-10-03 03:46:26 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
# begin...end has bug in error redirecting...
|
|
|
|
begin
|
|
|
|
../fish -n ./test.fish ^top.tmp.err
|
|
|
|
../fish -n ./test.fish -n ^^top.tmp.err
|
|
|
|
../fish ./test.fish -n ^^top.tmp.err
|
|
|
|
end | tee top.tmp.out
|
|
|
|
set -l tmp_status $status
|
|
|
|
if not diff top.tmp.out top.out >/dev/null
|
|
|
|
set res fail
|
|
|
|
echo "Output differs for file test.fish. Diff follows:"
|
|
|
|
diff -u top.out top.tmp.out
|
|
|
|
end
|
2010-10-03 03:46:26 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if not diff top.tmp.err top.err >/dev/null
|
|
|
|
set res fail
|
|
|
|
echo "Error output differs for file test.fish. Diff follows:"
|
|
|
|
diff -u top.err top.tmp.err
|
|
|
|
end
|
2010-10-03 03:46:26 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if test $tmp_status -ne (cat top.status)
|
|
|
|
set res fail
|
|
|
|
echo "Exit status differs for file test.fish"
|
|
|
|
end
|
2013-01-14 00:33:40 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if not ../fish -p /dev/null -c 'echo testing' >/dev/null
|
|
|
|
set res fail
|
|
|
|
echo "Profiling failed"
|
|
|
|
end
|
|
|
|
|
|
|
|
if test $res = ok
|
|
|
|
echo "File test.fish tested ok"
|
2014-01-13 09:14:24 +00:00
|
|
|
exit 0
|
2014-09-05 05:26:10 +00:00
|
|
|
else
|
|
|
|
echo "File test.fish failed tests"
|
2014-01-13 09:14:24 +00:00
|
|
|
exit 1
|
2014-09-05 05:26:10 +00:00
|
|
|
end
|
2010-10-03 03:46:26 +00:00
|
|
|
end
|
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
echo "Testing high level script functionality"
|
2005-09-20 13:31:55 +00:00
|
|
|
|
|
|
|
for i in *.in
|
2014-09-05 05:26:10 +00:00
|
|
|
set -l res ok
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
set -l base (basename $i .in)
|
|
|
|
set template_out (basename $i .in).out
|
|
|
|
set template_err (basename $i .in).err
|
|
|
|
set template_status (basename $i .in).status
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
../fish <$i >tmp.out ^tmp.err
|
|
|
|
set -l tmp_status $status
|
|
|
|
if not diff tmp.out $base.out >/dev/null
|
|
|
|
set res fail
|
|
|
|
echo "Output differs for file $i. Diff follows:"
|
|
|
|
diff -u tmp.out $base.out
|
|
|
|
end
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if not diff tmp.err $base.err >/dev/null
|
|
|
|
set res fail
|
|
|
|
echo "Error output differs for file $i. Diff follows:"
|
|
|
|
diff -u tmp.err $base.err
|
|
|
|
end
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if test $tmp_status -ne (cat $template_status)
|
|
|
|
set res fail
|
|
|
|
echo "Exit status differs for file $i"
|
|
|
|
end
|
2005-09-20 13:31:55 +00:00
|
|
|
|
2014-09-05 05:26:10 +00:00
|
|
|
if test $res = ok
|
|
|
|
echo "File $i tested ok"
|
|
|
|
else
|
|
|
|
echo "File $i failed tests"
|
|
|
|
end
|
2005-09-20 13:31:55 +00:00
|
|
|
end
|