This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
XS-APItest/t/locale.t - deal with indented values properly
authorYves Orton <demerphq@gmail.com>
Tue, 6 Sep 2022 10:07:25 +0000 (12:07 +0200)
committerJames E Keenan <jkeenan@cpan.org>
Fri, 30 Dec 2022 17:44:32 +0000 (12:44 -0500)
The old code used a regex that would split on exactly one space, so if
the data was changed to have more than one then it would get absorbed
into the name that was parsed out of the header file, leading the code
to test for things like "FOO ", which of course don't exist. Likely this
could have caused other issues too, but the defines in practice are
single symbols.

ext/XS-APItest/t/locale.t

index 1a14fb4..b8eb09a 100644 (file)
@@ -152,7 +152,7 @@ SKIP: {
         chomp;
         next unless / - \d+ $ /x;
         s/ ^ \# \s* define \s*//x;
-        m/ (.*) \  (.*) /x;
+        m/ (\S+) \s+ (.*) /x;
         $items{$1} = ($has_nl_langinfo)
                      ? $1       # Yields 'YESSTR'
                      : $2;      # Yields -54