Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug in test scripts "q" flag
- X-seq: zsh-workers 54044
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Bug in test scripts "q" flag
- Date: Fri, 7 Nov 2025 15:57:20 -0800
- Archived-at: <https://zsh.org/workers/54044>
- List-id: <zsh-workers.zsh.org>
Adding some special-case tests for "typeset -n".
Had this:
###
edgecase() ( local -n x=$1; typeset -p x; print -r $x )
edgecase \$; edgecase '$[1]'
0q:references to $$
>typeset -n x='$'
>$$
>typeset -n x='\$[1]'
>
###
Ignore for the moment the bug (?) that
() { typeset -n x='$[1]'; print $x }
prints nothing instead of printing the first digit of $$. The bug for
purposes of this post is that the blank line output by
print -r $x
does not match the output spec when the "0q" is used. I ended up with this:
###
edgecase() ( local -n x=$1; typeset -p x; print -r $x )
edgecase \$; edgecase '$[1]'
0q:references to $$
>typeset -n x='$'
>$$
>typeset -n x='\$[1]'
>$nothing
###
Here, "q" expands $nothing to, well, nothing, and thereby keeps the
final line of the expected output and successfully matches the blank
line from the final "print". It would be preferable if the former
spec were usable, but I'm not sure what in ztst.zsh to change to
preserve the line.
Un-ignoring the x='$[1]' bug again, I may in the final analysis
instead add the "f" flag like so:
###
edgecase \$; edgecase '$[1]'
0qf:references to $$
>typeset -n x='$'
>$$
>typeset -n x='\$[1]'
>$$[1]
###
Just in case it does end up fixed at some point.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author