Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[BUG] E02 test failure / ztst *> issue



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



Messages sorted by: Reverse Date, Date, Thread, Author