From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH 2/3] Tests for named references
Date: Tue, 7 Feb 2023 00:33:55 +0000 [thread overview]
Message-ID: <20230207003355.GB4460@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAH+w=7aMXx7dewojkF+9nqwi1QdgHdBn0g1vMcgYqGc1mY7Gow@mail.gmail.com>
Bart Schaefer wrote on Sun, Feb 05, 2023 at 18:24:58 -0800:
> Forgot to mention in patch #1 email that I decided not to create a
> "nameref" built-in yet.
>
> Here are the test cases, I covered everything I could think of. If
> you see something I missed, let me know.
> diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
> new file mode 100644
> index 000000000..b38831100
> --- /dev/null
> +++ b/Test/K01nameref.ztst
Add "K:" to Test/README?
> @@ -0,0 +1,439 @@
> +# Tests for the zsh/param/private module
Copy-pasto.
> +%prep
> +
> + # Required in order to declare an unset hash for substitution test
> + setopt TYPESET_TO_UNSET
> +
> + : ${ZTST_continue:=1}
> +
> +%test
> +
> + typeset -n ptr=var
> + typeset var=value
> + unset ptr
> + typeset -p var
> +0:unset via nameref
> +
So this expects «typeset -p var» to return 0 and have no output. Are
these the correct expectations?
> + typeset -n ptr2='path[2]'
> + print -r -- $ptr2
> +0d:nameref to array element
> +>${path[2]}
> +
Did you mean "0q" rather than "0d"?
I guess we should make the test harness warn (at least) when the "d"
flag is present and expected stdout is not empty.
⋮
> +%clean
How about tests for assigning to a nameref-to-hash? (Entire hash, not
hash element) Or are these implied by the "assign to array" and "expand
nameref-to-hash" tests.
Also, in 1/3 you wrote "attempting to add an attribute to a named
reference generates a warning", but I don't see a single test expecting
a non-empty stderr?
>
Haven't reviewed the V10private.ztst tests or the other two patches in
this series.
Cheers,
Daniel
P.S. I wonder if it'd be useful to write a scriptlet that takes
a one-liner in argv and emits on stdout a test that runs the one-liner and
expects its current exitcode/stdout/stderr. The idea is to use it
along the lines of «Test/generate 'pwd' >> Test/B42pwd.ztst».
next prev parent reply other threads:[~2023-02-07 0:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 2:24 Bart Schaefer
2023-02-07 0:33 ` Daniel Shahaf [this message]
2023-02-07 3:24 ` Bart Schaefer
2023-02-07 9:28 ` Daniel Shahaf
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=20230207003355.GB4460@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--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).