Skip to content

Commit 582a8ad

Browse files
jkeenanarc
authored andcommitted
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
1 parent 7fdd4f0 commit 582a8ad

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

MANIFEST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4607,6 +4607,7 @@ lib/perl5db/t/lvalue-bug Tests for the Perl debugger
46074607
lib/perl5db/t/MyModule.pm Tests for the Perl debugger
46084608
lib/perl5db/t/proxy-constants Tests for the Perl debugger
46094609
lib/perl5db/t/rt-104168 Tests for the Perl debugger
4610+
lib/perl5db/t/rt-120174 Tests for the Perl debugger
46104611
lib/perl5db/t/rt-121509-restart-after-chdir Tests for the Perl debugger
46114612
lib/perl5db/t/rt-61222 Tests for the Perl debugger
46124613
lib/perl5db/t/rt-66110 Tests for the Perl debugger

lib/perl5db.t

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ BEGIN {
3131
$ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
3232
}
3333

34-
plan(123);
34+
plan(127);
3535

3636
my $rc_filename = '.perldb';
3737

@@ -2817,6 +2817,90 @@ SKIP:
28172817
);
28182818
}
28192819

2820+
{
2821+
# perl 5 RT #120174 - 'p' command
2822+
my $wrapper = DebugWrap->new(
2823+
{
2824+
cmds =>
2825+
[
2826+
'b 2',
2827+
'c',
2828+
'p@abc',
2829+
'q',
2830+
],
2831+
prog => '../lib/perl5db/t/rt-120174',
2832+
}
2833+
);
2834+
2835+
$wrapper->contents_like(
2836+
qr/1234/,
2837+
q/RT 120174: p command can be invoked without space after 'p'/,
2838+
);
2839+
}
2840+
2841+
{
2842+
# perl 5 RT #120174 - 'x' command on array
2843+
my $wrapper = DebugWrap->new(
2844+
{
2845+
cmds =>
2846+
[
2847+
'b 2',
2848+
'c',
2849+
'x@abc',
2850+
'q',
2851+
],
2852+
prog => '../lib/perl5db/t/rt-120174',
2853+
}
2854+
);
2855+
2856+
$wrapper->contents_like(
2857+
qr/0\s+1\n1\s+2\n2\s+3\n3\s+4/ms,
2858+
q/RT 120174: x command can be invoked without space after 'x' before array/,
2859+
);
2860+
}
2861+
2862+
{
2863+
# perl 5 RT #120174 - 'x' command on array ref
2864+
my $wrapper = DebugWrap->new(
2865+
{
2866+
cmds =>
2867+
[
2868+
'b 2',
2869+
'c',
2870+
'x\@abc',
2871+
'q',
2872+
],
2873+
prog => '../lib/perl5db/t/rt-120174',
2874+
}
2875+
);
2876+
2877+
$wrapper->contents_like(
2878+
qr/\s+0\s+1\n\s+1\s+2\n\s+2\s+3\n\s+3\s+4/ms,
2879+
q/RT 120174: x command can be invoked without space after 'x' before array ref/,
2880+
);
2881+
}
2882+
2883+
{
2884+
# perl 5 RT #120174 - 'x' command on hash ref
2885+
my $wrapper = DebugWrap->new(
2886+
{
2887+
cmds =>
2888+
[
2889+
'b 4',
2890+
'c',
2891+
'x\%xyz',
2892+
'q',
2893+
],
2894+
prog => '../lib/perl5db/t/rt-120174',
2895+
}
2896+
);
2897+
2898+
$wrapper->contents_like(
2899+
qr/\s+'alpha'\s+=>\s+'beta'\n\s+'gamma'\s+=>\s+'delta'/ms,
2900+
q/RT 120174: x command can be invoked without space after 'x' before hash ref/,
2901+
);
2902+
}
2903+
28202904
END {
28212905
1 while unlink ($rc_filename, $out_fn);
28222906
}

lib/perl5db/t/rt-120174

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@abc = (1..4);
2+
print "hello world\n";
3+
%xyz = ( 'alpha' => 'beta', 'gamma' => 'delta' );
4+
print "goodbye world\n";

0 commit comments

Comments
 (0)