From d0d4107534ac1b7c6ebf8d1e194d7c58ed0e5c52 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Mon, 19 Oct 2020 18:56:59 -0500
Subject: 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.)
---
 tests/sh.test | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'tests')

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
-- 
cgit v1.2.3