Branch: refs/heads/yves/escape_reg_mesg_test_names
  Home:   https://github.com/Perl/perl5
  Commit: 2504a6243931da019ae687824641dab0741ef4d4
      
https://github.com/Perl/perl5/commit/2504a6243931da019ae687824641dab0741ef4d4
  Author: Yves Orton <demer...@gmail.com>
  Date:   2024-02-18 (Sun, 18 Feb 2024)

  Changed paths:
    M t/re/reg_mesg.t
    M t/test.pl

  Log Message:
  -----------
  t/re/reg_mesg.t - escape non-visible codepoints in test names

In GH #21993 James Keenan pointed out that this test scrambles the
terminal by outputting raw utf8, possibly malformed as part of the test
names. This makes it hard to understand what is going on with the test.
This patch fixes the test names and other output so that the code
snippets we output are escaped in a similar (but not identical) fashion
to that used by the regex debugger.  The output uses a % symbol instead
of a backslash, and supports multiple codepoints in one escape. So
chr(1).chr(2).chr(3) would output "%x{01+02+03}". (The difference with
the regex debugger is it does not output multiple codepoints in one
escape, mostly because doing so in C is a bit harder than in perl.)

We use a custom sub to do the escaping so that we do not use the regex
engine at all, as we use this for testing the regex engine. This sub
is available via t/test.pl as display_rx(), complementing the existing
_q(), _qq() and display() functions.

See https://github.com/Perl/perl5/pull/21993#issuecomment-1945981506
for details of the problems James observed.

With this patch the output should not break any terminals.



To unsubscribe from these emails, change your notification settings at 
https://github.com/Perl/perl5/settings/notifications

Reply via email to