summaryrefslogtreecommitdiff
path: root/lib/perl5db.t
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2011-09-04 12:29:59 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-04 17:17:19 -0700
commite09195afbb882765b006957aee1cc366505ea987 (patch)
treeb86d16cec80014ccd0d752f0203e850b8e332ab3 /lib/perl5db.t
parent72b09cff8561f44fdff6ea0ff31492936aa30261 (diff)
downloadperl-e09195afbb882765b006957aee1cc366505ea987.tar.gz
Add enable/disable commands for breakpoints in perl -d
Diffstat (limited to 'lib/perl5db.t')
-rw-r--r--lib/perl5db.t81
1 files changed, 80 insertions, 1 deletions
diff --git a/lib/perl5db.t b/lib/perl5db.t
index e275356541..c8eb63e45e 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(11);
+plan(14);
my $rc_filename = '.perldb';
@@ -246,9 +246,88 @@ EOF
}
+# Testing that we can disable a breakpoint at a numeric line.
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'b 7',
+ 'b 11',
+ 'disable 7',
+ 'c',
+ q/print "X={$x}\n";/,
+ 'c',
+ 'q',
+ );
+
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/disable-breakpoints-1'); +
+ like($output, qr/
+ X=\{SecondVal\}
+ /msx,
+ "Can set breakpoint in a line.");
+}
+
+# Testing that we can re-enable a breakpoint at a numeric line.
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'b 8',
+ 'b 24',
+ 'disable 24',
+ 'c',
+ 'enable 24',
+ 'c',
+ q/print "X={$x}\n";/,
+ 'c',
+ 'q',
+ );
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/disable-breakpoints-2');
+ like($output, qr/
+ X=\{SecondValOneHundred\}
+ /msx,
+ "Can set breakpoint in a line.");
+}
# clean up.
+# Disable and enable for breakpoints on outer files.
+{
+ rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+ push (@DB::typeahead,
+ 'b 10',
+ 'b ../lib/perl5db/t/EnableModule.pm:14',
+ 'disable ../lib/perl5db/t/EnableModule.pm:14',
+ 'c',
+ 'enable ../lib/perl5db/t/EnableModule.pm:14',
+ 'c',
+ q/print "X={$x}\n";/,
+ 'c',
+ 'q',
+ );
+
+}
+EOF
+
+ my $output = runperl(switches => [ '-d', '-I', '../lib/perl5db/t', ], stderr => 1, progfile => '../lib/perl5db/t/disable-breakpoints-3'); +
+ like($output, qr/
+ X=\{SecondValTwoHundred\}
+ /msx,
+ "Can set breakpoint in a line.");
+}
END {
1 while unlink ($rc_filename, $out_fn);
}