diff options
-rw-r--r-- | tests/sh.test | 7 | ||||
-rw-r--r-- | toys/pending/sh.c | 2 |
2 files changed, 7 insertions, 2 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 diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 5590812a..784c7a01 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -3560,7 +3560,7 @@ void source_main(void) break; } - if (1!=(prompt = parse_line(new ? : "", &scratch))) { + if (1!=(prompt = parse_line(new ? : " ", &scratch))) { if (!prompt) run_function(scratch.pipeline); free_function(&scratch); if (!new) { |