about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2023-06-22 13:36:40 -0700
committerBart Schaefer <schaefer@zsh.org>2023-06-22 13:36:40 -0700
commit4345eed1fe5dd6c881b948331cfa8f4a48beda42 (patch)
tree9f97cb82b069adcad8b7fc71fae88c23e5ef1182 /Test
parente7a8dbb16c6c779211c56ecd20cd82ecc138ed2a (diff)
downloadzsh-4345eed1fe5dd6c881b948331cfa8f4a48beda42.tar.gz
zsh-4345eed1fe5dd6c881b948331cfa8f4a48beda42.tar.xz
zsh-4345eed1fe5dd6c881b948331cfa8f4a48beda42.zip
51887: namespaces recognized in math, incorrect usages rejected.
Diffstat (limited to 'Test')
-rw-r--r--Test/K02parameter.ztst52
1 files changed, 50 insertions, 2 deletions
diff --git a/Test/K02parameter.ztst b/Test/K02parameter.ztst
index 8a1be1e36..0b1a8dd4a 100644
--- a/Test/K02parameter.ztst
+++ b/Test/K02parameter.ztst
@@ -100,7 +100,55 @@ F:Braces are required
 >.k02.array
 >characters
 
+  k.=empty
   k.2=test
-  print ${k.2}
+  print ${k.} ${k.2}
 0:Parse without leading dot (future proofing)
->test
+>empty test
+
+  .k=OK
+  print ${.k}
+0:Bare namespace is usable (ksh compatibility)
+>OK
+
+  .k.=empty
+1:Namespace must precede an identifier, assignment
+?(eval):1: not an identifier: .k.
+
+  typeset .k.=empty
+1:Namespace must precede an identifier, typeset
+?(eval):typeset:1: not valid in this context: .k.
+
+  print ${.k.}
+1:Namespace must precede an identifier, reference
+?(eval):1: bad substitution
+
+  .2.b=not
+1:Namespace identifier must not begin with a digit, assignment
+?(eval):1: not an identifier: .2.b
+
+  typeset .2.b=not
+1:Namespace identifier must not begin with a digit, typeset
+?(eval):typeset:1: not valid in this context: .2.b
+
+  print ${.2.b}
+1:Namespace identifier must not begin with a digit, reference
+?(eval):1: bad substitution
+
+  .not.2b=question
+1:Identifier starting with a digit must be all digits, assignment
+?(eval):1: not an identifier: .not.2b
+
+  typeset .not.2b=question
+1:Identifier starting with a digit must be all digits, typeset
+?(eval):typeset:1: not valid in this context: .not.2b
+
+  print ${.not.2b}
+1:Identifier starting with a digit must be all digits, reference
+?(eval):1: bad substitution
+
+  integer .var.d=0
+  float .var.f=.2
+  print $((.var.x = ++.var.d - -.var.f))
+0:Namespaces in math context
+>1.2