aboutsummaryrefslogtreecommitdiff
path: root/tests/expr.test
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-03-20 20:39:27 -0500
committerRob Landley <rob@landley.net>2016-03-20 20:39:27 -0500
commit6aba814b28cddd45c7301c39dccd65b316eb5c82 (patch)
treeb9061ca0c52407c3d8c18f80e521e1dd4db3357c /tests/expr.test
parent4de04e83d7ff621062b8b5456a14f2f313a2639c (diff)
downloadtoybox-6aba814b28cddd45c7301c39dccd65b316eb5c82.tar.gz
Posix requires "" to be false, and 00 should be false, and -0 should be false.
Fix memory leaks in regex. Simplify regex check (if we matched, subexpression had to match). Don't exit() from a command, set exitval and return.
Diffstat (limited to 'tests/expr.test')
-rwxr-xr-xtests/expr.test3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/expr.test b/tests/expr.test
index c6dc261b..da3feea1 100755
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -19,6 +19,9 @@ testing "* % same priority" "expr 3 \* 2 % 4" "2\n" "" ""
testing "= > same priority" "expr 0 = 2 \> 3" "0\n" "" ""
testing "> = same priority" "expr 3 \> 2 = 1" "1\n" "" ""
+testing "00 | 1" "expr 00 \| 1" "1\n" "" ""
+testing "-0 | 1" "expr -0 \| 2" "2\n" "" ""
+testing '"" | 1' 'expr "" \| 3' "3\n" "" ""
testing "/ by zero" "expr 1 / 0 2>/dev/null; echo \$?" "2\n" "" ""
testing "% by zero" "expr 1 % 0 2>/dev/null; echo \$?" "2\n" "" ""