In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/582a8ad99532af5c8db4e42c8880618fbce41c6d?hp=54441887138b19f99225ea1c9caf2602ff2083ab>
- Log ----------------------------------------------------------------- commit 582a8ad99532af5c8db4e42c8880618fbce41c6d Author: James E Keenan <jkee...@cpan.org> Date: Sat Sep 2 22:28:20 2017 -0400 Add tests for 'p' and 'x' commands without subsequent whitespace. Tests pass on perl-5.16.3 but should fail (until source code is corrected) on subsequent versions. For: RT #120174 M MANIFEST M lib/perl5db.t A lib/perl5db/t/rt-120174 commit 7fdd4f080863703d44282c6988834455d1290405 Author: Smylers <smyl...@stripey.com> Date: Wed Sep 6 12:32:09 2017 +0100 Debugger cmds not requiring spaces Make debugger commands like these work again, not requiring a space between a single-letter command and a following argument which starts with punctuation: p$^V x@ARGV x\@ARGV x\%INC Regressions were in d478d7a0 and 8f144dfc. M lib/perl5db.pl ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 + lib/perl5db.pl | 7 ++-- lib/perl5db.t | 86 ++++++++++++++++++++++++++++++++++++++++++++++++- lib/perl5db/t/rt-120174 | 4 +++ 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 lib/perl5db/t/rt-120174 diff --git a/MANIFEST b/MANIFEST index 6b1daa36b9..e0997b0dd6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4607,6 +4607,7 @@ lib/perl5db/t/lvalue-bug Tests for the Perl debugger lib/perl5db/t/MyModule.pm Tests for the Perl debugger lib/perl5db/t/proxy-constants Tests for the Perl debugger lib/perl5db/t/rt-104168 Tests for the Perl debugger +lib/perl5db/t/rt-120174 Tests for the Perl debugger lib/perl5db/t/rt-121509-restart-after-chdir Tests for the Perl debugger lib/perl5db/t/rt-61222 Tests for the Perl debugger lib/perl5db/t/rt-66110 Tests for the Perl debugger diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 265b4441f3..d0c707e829 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -529,7 +529,7 @@ BEGIN { use vars qw($VERSION $header); # bump to X.XX in blead, only use X.XX_XX in maint -$VERSION = '1.51'; +$VERSION = '1.52'; $header = "perl5db.pl version $VERSION"; @@ -1871,7 +1871,10 @@ sub _DB__trim_command_and_return_first_component { $cmd =~ s/\A\s+//s; # trim annoying leading whitespace $cmd =~ s/\s+\z//s; # trim annoying trailing whitespace - my ($verb, $args) = $cmd =~ m{\A(\S*)\s*(.*)}s; + # A single-character debugger command can be immediately followed by its + # argument if they aren't both alphanumeric; otherwise require space + # between commands and arguments: + my ($verb, $args) = $cmd =~ m{\A(.\b|\S*)\s*(.*)}s; $obj->cmd_verb($verb); $obj->cmd_args($args); diff --git a/lib/perl5db.t b/lib/perl5db.t index a2dccc6fd3..3d432ad52e 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -31,7 +31,7 @@ BEGIN { $ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu } -plan(123); +plan(127); my $rc_filename = '.perldb'; @@ -2817,6 +2817,90 @@ SKIP: ); } +{ + # perl 5 RT #120174 - 'p' command + my $wrapper = DebugWrap->new( + { + cmds => + [ + 'b 2', + 'c', + 'p@abc', + 'q', + ], + prog => '../lib/perl5db/t/rt-120174', + } + ); + + $wrapper->contents_like( + qr/1234/, + q/RT 120174: p command can be invoked without space after 'p'/, + ); +} + +{ + # perl 5 RT #120174 - 'x' command on array + my $wrapper = DebugWrap->new( + { + cmds => + [ + 'b 2', + 'c', + 'x@abc', + 'q', + ], + prog => '../lib/perl5db/t/rt-120174', + } + ); + + $wrapper->contents_like( + qr/0\s+1\n1\s+2\n2\s+3\n3\s+4/ms, + q/RT 120174: x command can be invoked without space after 'x' before array/, + ); +} + +{ + # perl 5 RT #120174 - 'x' command on array ref + my $wrapper = DebugWrap->new( + { + cmds => + [ + 'b 2', + 'c', + 'x\@abc', + 'q', + ], + prog => '../lib/perl5db/t/rt-120174', + } + ); + + $wrapper->contents_like( + qr/\s+0\s+1\n\s+1\s+2\n\s+2\s+3\n\s+3\s+4/ms, + q/RT 120174: x command can be invoked without space after 'x' before array ref/, + ); +} + +{ + # perl 5 RT #120174 - 'x' command on hash ref + my $wrapper = DebugWrap->new( + { + cmds => + [ + 'b 4', + 'c', + 'x\%xyz', + 'q', + ], + prog => '../lib/perl5db/t/rt-120174', + } + ); + + $wrapper->contents_like( + qr/\s+'alpha'\s+=>\s+'beta'\n\s+'gamma'\s+=>\s+'delta'/ms, + q/RT 120174: x command can be invoked without space after 'x' before hash ref/, + ); +} + END { 1 while unlink ($rc_filename, $out_fn); } diff --git a/lib/perl5db/t/rt-120174 b/lib/perl5db/t/rt-120174 new file mode 100644 index 0000000000..c79c851069 --- /dev/null +++ b/lib/perl5db/t/rt-120174 @@ -0,0 +1,4 @@ +@abc = (1..4); +print "hello world\n"; +%xyz = ( 'alpha' => 'beta', 'gamma' => 'delta' ); +print "goodbye world\n"; -- Perl5 Master Repository