zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: "bad substitution" error for ${a[b]}
Date: Thu, 16 Jul 2015 13:47:02 -0700	[thread overview]
Message-ID: <150716134702.ZM650@torch.brasslantern.com> (raw)
In-Reply-To: <20150716093031.745437e3@pwslap01u.europe.root.pri>

On Jul 16,  9:30am, Peter Stephenson wrote:
}
} [...] we could do with taking some of the parameter substitution test
} cases and feeding them through NO_EXEC.

Any suggestions which ones?  The only thing that should have changed
with 35799 is subscript handling.

The following caes all work, but of course "work" means "do nothing at
all" -- so I guess the point is just to assert that there are no errors?


diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index ca3f06c..16279b8 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -362,6 +362,20 @@
   echo ${unset_var?Not an error})
 0:NO_EXEC should not test for unset variables
 
+  (setopt noexec
+  : ${${string%[aeiou]*}/(#m)?(#e)/${(U)MATCH}}  Rule 1
+  : ${array[4,5][1][2,3]}                        Rule 2
+  : ${${(P)foo[1,6]}[1,3]}                       Rule 3
+  : "${${(@)array}[1,2]}"                        Rule 5
+  : "${(@)${(@)array}[1,2]#?}"                   Rule 6
+  : ${(el.20..X.)${bar}}                         Rule 11 success case)
+0:NO_EXEC handles parameter substitution examples
+
+  (setopt noexec
+  : ${(el.20..X.)$bar}                           Rule 11 failure case)
+1:NO_EXEC does recognize bad substitution syntax
+*?* bad substitution
+
   setopt NO_eval_lineno
   eval 'print $LINENO'
   setopt eval_lineno


  reply	other threads:[~2015-07-16 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 20:03 Jason L Tibbitts III
2015-07-16  0:09 ` Bart Schaefer
2015-07-16  8:30   ` Peter Stephenson
2015-07-16 20:47     ` Bart Schaefer [this message]
2015-07-17 19:30       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150716134702.ZM650@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).