about summary refs log tree commit diff
path: root/Test/A01grammar.ztst
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-18 09:56:00 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-18 09:56:00 +0100
commit52aeb9aaeb4799b760138a7c34b18ede4b47242a (patch)
tree0da193cbc61ac0000ae0bad210619276f63dccd5 /Test/A01grammar.ztst
parent34a1489f436d95bc2404f8e371130a469cbccebe (diff)
downloadzsh-52aeb9aaeb4799b760138a7c34b18ede4b47242a.tar.gz
zsh-52aeb9aaeb4799b760138a7c34b18ede4b47242a.tar.xz
zsh-52aeb9aaeb4799b760138a7c34b18ede4b47242a.zip
35168: Improve parsing of case patterns.
"|" is now found properly by looking for words that come
from the lexical analyser, rather than hacking a pattern
returned in one dollop.

Update some completion functions that need extra quoting
as a result.

Add test for new parsing.

Update version number to 5.0.8-dev-3 because of wordcode
incompatibility.
Diffstat (limited to 'Test/A01grammar.ztst')
-rw-r--r--Test/A01grammar.ztst39
1 files changed, 39 insertions, 0 deletions
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 2de291906..1ba0a54d7 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -572,6 +572,7 @@
   $ZTST_testdir/../Src/zsh -f myscript
 127q:PATHSCRIPT option not used.
 ?$ZTST_testdir/../Src/zsh: can't open input file: myscript
+# '
 
   $ZTST_testdir/../Src/zsh -fc 'echo $0; echo $1' myargzero myargone
 0:$0 is traditionally if bizarrely set to the first argument with -c
@@ -611,3 +612,41 @@
 >BEGIN
 >mytrue
 >END
+
+  fn() {
+    case $1 in
+      ( one | two | three )
+      print Matched $1
+      ;;
+      ( fo* | fi* | si* )
+      print Pattern matched $1
+      ;;
+      ( []x | a[b]* )
+      print Character class matched $1
+      ;;
+    esac
+  }
+  which fn
+  fn one
+  fn two
+  fn three
+  fn four
+  fn five
+  fn six
+  fn abecedinarian
+  fn xylophone
+0: case word handling
+>fn () {
+>	case $1 in
+>		(one | two | three) print Matched $1 ;;
+>		(fo* | fi* | si*) print Pattern matched $1 ;;
+>		([]x | a[b]*) print Character class matched $1 ;;
+>	esac
+>}
+>Matched one
+>Matched two
+>Matched three
+>Pattern matched four
+>Pattern matched five
+>Pattern matched six
+>Character class matched abecedinarian