diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 22:16:38 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-11 00:10:20 -0700 |
commit | c96cf1c0e26c1d10561709cb663973772f4cb044 (patch) | |
tree | 4a2b34f8bfd4f22ea04f9cea21acb84cba3bda06 | |
parent | 6bd144e0f53d840d496d057738446fe34872490b (diff) | |
download | perl-c96cf1c0e26c1d10561709cb663973772f4cb044.tar.gz |
Make Deparse.t more tolerant of our @F vs our(@F)
Currently B::Deparse deparses ‘our @F;’ as ‘our @F;’, but ‘our @F =...’
as ‘our(@F) = ...’, adding parentheses. For split-to-array, it just
happens to omit the parentheses, because there is no list op for it
to process, and it is when processing a list op that it decides to put
them there. While it could be changed to omit the parentheses for the
list or add them for split-to-array, for now just make the test more
tolerant, as this is just a cosmetic difference.
-rw-r--r-- | lib/B/Deparse.t | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 9a280a20dc..21e6cdc967 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -127,7 +127,7 @@ $a =~ s/.*possible typo.*\n//; # Remove warning line $a =~ s/.*-i used with no filenames.*\n//; # Remove warning line $a =~ s{\\340\\242}{\\s} if (ord("\\") == 224); # EBCDIC, cp 1047 or 037 $a =~ s{\\274\\242}{\\s} if (ord("\\") == 188); # $^O eq 'posix-bc' -$b = <<'EOF'; +$b = quotemeta <<'EOF'; BEGIN { $^I = ".bak"; } BEGIN { $^W = 1; } BEGIN { $/ = "\n"; $\ = "\n"; } @@ -137,7 +137,8 @@ LINE: while (defined($_ = <ARGV>)) { '???'; } EOF -is($a, $b, +$b =~ s/our\\\(\\\@F\\\)/our[( ]\@F\\)?/; # accept both our @F and our(@F) +like($a, qr/$b/, 'command line flags deparse as BEGIN blocks setting control variables'); $a = `$^X $path "-MO=Deparse" -e "use constant PI => 4" 2>&1`; |