don't parse the options that should be passed to fish scripts

This commit makes fish_parse_opt stop at first non-option argument,
which expected as fish script name and pass the remaining argument to
that script. I also updated the test cases.
This commit is contained in:
Grissiom
2010-10-03 11:46:26 +08:00
parent 8910226d2f
commit 27df727ca1
6 changed files with 55 additions and 7 deletions

View File

@@ -4,6 +4,43 @@
# instad of using autotest to provide additional
# testing for fish. :-)
if [ "$argv" != '-n' ]
# 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
echo $status >top.tmp.status
set res ok
if diff top.tmp.out top.out >/dev/null
else
set res fail
echo Output differs for file test.fish
end
if diff top.tmp.err top.err >/dev/null
else
set res fail
echo Error output differs for file test.fish
end
if test (cat top.tmp.status) = (cat top.status)
else
set res fail
echo Exit status differs for file test.fish
end
if test $res = ok;
echo File test.fish tested ok
else
echo File test.fish failed tests
end;
exit
end
echo Testing high level script functionality
for i in *.in

6
tests/top.err Normal file
View File

@@ -0,0 +1,6 @@
fish: Expected redirection specification, got token of type '$i'
/usr/local/src/grissioms-fish-shell/tests/test.fish (line 51): ../fish <$i >tmp.out ^tmp.err
^
fish: Expected redirection specification, got token of type '$i'
/usr/local/src/grissioms-fish-shell/tests/test.fish (line 51): ../fish <$i >tmp.out ^tmp.err
^

6
tests/top.out Normal file
View File

@@ -0,0 +1,6 @@
Testing high level script functionality
File test1.in tested ok
File test2.in tested ok
File test3.in tested ok
File test4.in tested ok
File test5.in tested ok

1
tests/top.status Normal file
View File

@@ -0,0 +1 @@
0