aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-05-26 05:16:44 -0500
committerRob Landley <rob@landley.net>2020-05-26 05:16:44 -0500
commitbc6ce6628c2517aa419b5551b8d378da794b84f2 (patch)
tree872cb366c9fb5f0afbbda3d0f7d4d8f849890637
parentd3f83232d49e26f53121fc1f797118080a0fdf73 (diff)
downloadtoybox-bc6ce6628c2517aa419b5551b8d378da794b84f2.tar.gz
More sh tests.
-rw-r--r--tests/sh.test7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/sh.test b/tests/sh.test
index 429b7706..7bab1a60 100644
--- a/tests/sh.test
+++ b/tests/sh.test
@@ -73,6 +73,7 @@ testing 'default exports' \
export EVAL="$SH -c"
testing "smoketest" "echo hello" "hello\n" "" ""
+testing "line break" $'ec\\\nho hello' 'hello\n' '' ''
testing "eval" "eval echo hello" "hello\n" "" ""
testing "eval2" "eval 'echo hello'; echo $?" "hello\n0\n" "" ""
testing "eval3" 'X="echo hello"; eval "$X"' "hello\n" "" ""
@@ -311,6 +312,12 @@ testing '$LINENO 2' $'echo $LINENO\necho $LINENO' '0\n1\n' '' ''
testing '$EUID' 'echo $EUID' "$(id -u)\n" '' ''
testing '$UID' 'echo $UID' "$(id -ur)\n" '' ''
+testing 'readonly for' \
+ 'readonly i; for i in one two three; do echo $i; done 2>/dev/null; echo $?' \
+ '1\n' '' ''
+testing 'readonly {}<' \
+ 'readonly i; echo hello 2>/dev/null {i}</dev/null; echo $?' '1\n' '' ''
+
testing '$_ 1' 'echo walrus; echo $_' 'walrus\nwalrus\n' '' ''
testing '$_ 2' 'unset _; echo $_' '_\n' '' ''