From c0d01a6fe0c67911650730cf13a2b9a0db16e59b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 6 Jan 2015 17:05:17 +0000 Subject: Fix command substitutions to parse contents as they are read in. Do this by refactoring misnamed lexsave()/lexrestore() to allow continuity of history and input. Add test. --- Test/D08cmdsubst.ztst | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'Test') diff --git a/Test/D08cmdsubst.ztst b/Test/D08cmdsubst.ztst index 5661b0aaa..a4c69a010 100644 --- a/Test/D08cmdsubst.ztst +++ b/Test/D08cmdsubst.ztst @@ -106,3 +106,45 @@ >34 >" >" OK + + echo $(case foo in + foo) + echo This test worked. + ;; + bar) + echo This test failed in a rather bizarre way. + ;; + *) + echo This test failed. + ;; + esac) +0:Parsing of command substitution with unmatched parentheses: case, basic +>This test worked. + + echo "$(case bar in + foo) + echo This test spoobed. + ;; + bar) + echo This test plurbled. + ;; + *) + echo This test bzonked. + ;; + esac)" +0:Parsing of command substitution with unmatched parentheses: case with quotes +>This test plurbled. + + echo before $( + echo start; echo unpretentious | + while read line; do + case $line in + u*) + print Word began with u + print and ended with a crunch + ;; + esac + done | sed -e 's/Word/Universe/'; echo end + ) after +0:Parsing of command substitution with ummatched parentheses: with frills +>before start Universe began with u and ended with a crunch end after -- cgit 1.4.1