From b742998a2671818ceb5295d1a3f2f2c062a39028 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 2 Dec 2018 16:53:03 -0600 Subject: Teach testcmd to say short name rather than full path. --- scripts/test.sh | 4 +++- tests/test.test | 26 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 490750cc..f7ad4a1e 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -129,7 +129,9 @@ testcmd() { wrong_args "$@" - testing "$1" "$C $2" "$3" "$4" "$5" + X="$1" + [ -z "$X" ] && X="$CMDNAME $2" + testing "$X" "$C $2" "$3" "$4" "$5" } # Recursively grab an executable and all the libraries needed to run it. diff --git a/tests/test.test b/tests/test.test index 8b60c0bd..7f574f08 100644 --- a/tests/test.test +++ b/tests/test.test @@ -44,16 +44,16 @@ rmdir d # TODO: Test rwx gu t -testing "" "$C '' || echo yes" "yes\n" "" "" -testing "" "$C a && echo yes" "yes\n" "" "" -testing "-n" "$C -n '' || echo yes" "yes\n" "" "" -testing "-n2" "$C -n a && echo yes" "yes\n" "" "" -testing "-z" "$C -z '' && echo yes" "yes\n" "" "" -testing "-z2" "$C -z a || echo yes" "yes\n" "" "" -testing "" "$C a = b || echo yes" "yes\n" "" "" -testing "" "$C '' = '' && echo yes" "yes\n" "" "" -testing "a != b" "$C a != b && echo yes" "yes\n" "" "" -testing "a != b" "$C a != a || echo yes" "yes\n" "" "" +testcmd "" "'' || echo yes" "yes\n" "" "" +testcmd "" "a && echo yes" "yes\n" "" "" +testcmd "-n" "-n '' || echo yes" "yes\n" "" "" +testcmd "-n2" "-n a && echo yes" "yes\n" "" "" +testcmd "-z" "-z '' && echo yes" "yes\n" "" "" +testcmd "-z2" "-z a || echo yes" "yes\n" "" "" +testcmd "" "a = b || echo yes" "yes\n" "" "" +testcmd "" "'' = '' && echo yes" "yes\n" "" "" +testcmd "a != b" "a != b && echo yes" "yes\n" "" "" +testcmd "a != b" "a != a || echo yes" "yes\n" "" "" arith_test() { @@ -80,3 +80,9 @@ testing "-le" "arith_test -le" "le" "" "" # -e == -a -o -d != -o # \( "x" \) -a \) == \) # \( ! ! ! -e \) \) + +# // () -a (() -a () -o ()) -o () +# // x -a ( x -o x ) -a x +# // x -o ( x -a x ) -a x -o x + +# trailing ! and ( -- cgit v1.2.3