aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-10-19 18:56:59 -0500
committerRob Landley <rob@landley.net>2020-10-19 18:56:59 -0500
commitd0d4107534ac1b7c6ebf8d1e194d7c58ed0e5c52 (patch)
tree5caa353a5918ab275eea1bdc169fc73d1f7f8f04 /tests
parent273c9e72c1a578915cc4db6a83ca5e0f6a1771f4 (diff)
downloadtoybox-d0d4107534ac1b7c6ebf8d1e194d7c58ed0e5c52.tar.gz
More tests, and a workaround to pass one of them.
(The bug is that "echo hello \" followed by just enter should end the $PS2 state but it persists when the line is empty because resulting collated line still ends with \ so it wants another line.)
Diffstat (limited to 'tests')
-rw-r--r--tests/sh.test7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/sh.test b/tests/sh.test
index 516e0c82..67921c1a 100644
--- a/tests/sh.test
+++ b/tests/sh.test
@@ -197,7 +197,8 @@ testing "case" 'for i in A C J B; do case "$i" in A) echo got A ;; B) echo and B
testing "case newlines" \
$'case i\n\nin\n\na) echo one\n\n;;\n\ni)\n\necho two\n\n;;\n\nesac' \
"two\n" "" ""
-
+testing 'loop in && ||' \
+ 'false && for i in a b c; do echo $i; done || echo no' 'no\n' '' ''
testing "continue" 'for i in a b c; do for j in d e f; do echo $i $j; continue 2; done; done' \
"a d\nb d\nc d\n" "" ""
@@ -475,6 +476,10 @@ shxpect '[+(]) overlap priority' I$'shopt -s extglob\n' E"$P" \
shxpect '${a?b} sets err, stops cmdline eval' \
I$': ${a?b} ${c:=d}\n' E E"$P" I$'echo $?$c\n' O$'1\n'
+testing 'source file' 'source input' 'hello\n' 'echo hello \\\n' ''
+testing '. file' '. input' 'hello\n' 'echo hello \\\n' ''
+testing 'source no newline' 'source input' 'hello \\\n' 'echo hello \\' ''
+
# TODO finish variable list from shell init
# $# $? $- $$ $! $0