commands/which01.sh: Fix test for debian.
RFC PATCH 1/1 commands/which01.sh: Fix test for debian.
The which binary on Debian comes from debianutils package and not from the which package (like it is on the most of the distros). It does not support most of the options, which is fine, since the test produces TCONF for these but also returns relative path instead of absolute one.
So this patch adds alternate version for the expected path and the test passes if at least one of them matches.
Fixes #151.
--- testcases/commands/which/which01.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
testcases/commands/which/which01.sh +9 -4
@@ -42,8 +42,13 @@ which_verify() { until [ -z "$1" ] do - grep -q "$1" temp - if [ $? -ne 0 ]; then + found="no" + for i in $1; do + if grep -q "$i" temp; then + found="yes" + fi + done + if [ "$found" != "yes" ]; then echo "'$1' not found in:" cat temp echo
@@ -93,9 +98,9 @@ which_test() do_test() { case $1 in - 1) which_test "" "pname" "$PWD/pname";; + 1) which_test "" "pname" "$PWD/pname ./pname";; 2) which_test "--all" "pname" "$PWD/bin/pname" "$PWD/pname";; - 3) which_test "-a" "pname" "$PWD/bin/pname" "$PWD/pname";; + 3) which_test "-a" "pname" "$PWD/bin/pname ./bin/pname" "$PWD/pname ./pname";; 4) which_test "--read-alias" "pname" "pname='pname -i'" "$PWD/pname";; 5) which_test "-i" "pname" "pname='pname -i'" "$PWD/pname";; 6) alias which='which --read-alias';
Signature · 1 line
2.10.2
RFC PATCH 1/1 commands/which01.sh: Fix test for debian.
----- Original Message -----
Quoted 11 lines
The which binary on Debian comes from debianutils package and not from the which package (like it is on the most of the distros). It does not support most of the options, which is fine, since the test produces TCONF for these but also returns relative path instead of absolute one.
So this patch adds alternate version for the expected path and the test passes if at least one of them matches.
Fixes #151.
Signed-off-by Cyril Hrubis <[email protected]>
No objections - I think we used same approach in file test. I'd add also that note about POSIX not defining it to commit message.
Regards,
Jan
RFC PATCH 1/1 commands/which01.sh: Fix test for debian.
Hi!
Quoted 2 lines
No objections - I think we used same approach in file test. I'd add also that note about POSIX not defining it to commit message.
I've rewritten the commit description a bit to include this piece of information and pushed.
Signature · 2 lines
Cyril Hrubis [email protected]