zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [BUG] E02 test failure / ztst *> issue
Date: Wed, 11 Mar 2020 16:15:04 -0500	[thread overview]
Message-ID: <EE2A90A2-9105-4E92-A3B0-DFFCF5A18085@dana.is> (raw)

When i run E02 on master, on macOS, i get an failure for the new 'preserves
tracing' test (see output below). On my machine, `which` outputs the name of
the ヌ function without quoting.

I was going to just change it like this:

  ->$'\M-c\M-\C-C\M-\C-L' () {
  +*>(ヌ|$'\M-c\M-\C-C\M-\C-L') \(\) {

But that doesn't work the way i expected — it breaks the surrounding lines.
The documentation (B01) says this about `*>`:

  # Each line of a '>' and '?' chunk may be preceded by a '*', so the line
  # starts '*>' or '*?'.  This signifies that for any line with '*' in front
  # the actual output should be pattern matched against the corresponding
  # lines in the test output.

In actuality, if *any* `>` line is preceded by `*`, *all* of them are treated
as patterns to be matched against the corresponding lines in the output. Thus,
if the surrounding lines contain pattern meta-characters (which they do), they
need to be escaped to work correctly.

I'm not sure if the documentation is wrong or if the behaviour is. It seems
like it would be helpful if it worked the way it said, but it looks like we'd
have to pass pattern-containing line numbers or something to ZTST_diff for it
to do that. idk

dana


--- /tmp/zsh.ztst.28982/ztst.out	2020-03-11 15:57:36.000000000 -0500
+++ /tmp/zsh.ztst.28982/ztst.tout	2020-03-11 15:57:36.000000000 -0500
@@ -6,7 +6,7 @@
 	# traced
 	echo inner
 }
-$'\M-c\M-\C-C\M-\C-L' () {
+ヌ () {
 	# traced
 	echo inner
 }
Test ./E02xtrace.ztst failed: output differs from expected as shown above for:
  test_cases=(
      f            # baseline
      foo-bar      # Dash
      ヌ           # Meta (the UTF-8 representation of this character has an 0x83 byte)
      \$\'ba\\0z\' # Nul, escaped as though by ${(qqqq)}
  )
  for 1 in "$test_cases[@]"; do
    eval "
      ${1}() {
        ${1}() { echo inner }
      }
      functions -T ${1}
      ${1}
      which ${1}
    "
  done
Was testing: a function that redefines itself preserves tracing


             reply	other threads:[~2020-03-11 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 21:15 dana [this message]
2020-03-12  2:37 ` Jun T
2020-03-12 17:31   ` dana
2020-03-12 17:36     ` Peter Stephenson
2020-03-13 10:08     ` Jun T
2020-03-13 13:52       ` dana

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=EE2A90A2-9105-4E92-A3B0-DFFCF5A18085@dana.is \
    --to=dana@dana.is \
    --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).