[Bps-public-commit] r13444 - in Carp-REPL: . lib/Carp t
sartak at bestpractical.com
sartak at bestpractical.com
Fri Jun 20 02:49:49 EDT 2008
Author: sartak
Date: Fri Jun 20 02:49:49 2008
New Revision: 13444
Modified:
Carp-REPL/ (props changed)
Carp-REPL/lib/Carp/REPL.pm
Carp-REPL/lib/Devel/REPL/Plugin/Carp/REPL.pm
Carp-REPL/t/07-frame.t
Log:
r62893 at dhcp32: sartak | 2008-06-20 01:49:44 -0500
Add support for :top and :bottom
Modified: Carp-REPL/lib/Carp/REPL.pm
==============================================================================
--- Carp-REPL/lib/Carp/REPL.pm (original)
+++ Carp-REPL/lib/Carp/REPL.pm Fri Jun 20 02:49:49 2008
@@ -192,6 +192,14 @@
Moves one frame down in the stack.
+=item * :top
+
+Moves to the top frame of the stack.
+
+=item * :bottom
+
+Moves to the bottom frame of the stack.
+
=item * :t
Redisplay the stack trace.
Modified: Carp-REPL/lib/Devel/REPL/Plugin/Carp/REPL.pm
==============================================================================
--- Carp-REPL/lib/Devel/REPL/Plugin/Carp/REPL.pm (original)
+++ Carp-REPL/lib/Devel/REPL/Plugin/Carp/REPL.pm Fri Jun 20 02:49:49 2008
@@ -71,22 +71,32 @@
return if !defined($line) || $line =~ /^\s*:q\s*/;
- if ($line =~ /^\s*:b?t\s*/) {
+ if ($line =~ /^\s*:b?t\b/) {
print $self->backtrace;
return '';
}
- if ($line =~ /^\s*:up?\s*/) {
+ if ($line =~ /^\s*:top\b/) {
+ $self->frame(@{ $self->packages } - 1);
+ return '';
+ }
+
+ if ($line =~ /^\s*:bot(?:tom)?\b/) {
+ $self->frame(0);
+ return '';
+ }
+
+ if ($line =~ /^\s*:up?\b/) {
$self->frame($self->frame + 1);
return '';
}
- if ($line =~ /^\s*:d(?:own)?\s*/) {
+ if ($line =~ /^\s*:d(?:own)?\b/) {
$self->frame($self->frame - 1);
return '';
}
- if ($line =~ /^\s*:l(?:ist)?\s*/) {
+ if ($line =~ /^\s*:l(?:ist)?\b/) {
my ($package, $file, $num) = @{$self->packages->[$self->frame]};
open my $handle, '<', $file or do {
warn "Unable to open $file for reading: $!\n";
Modified: Carp-REPL/t/07-frame.t
==============================================================================
--- Carp-REPL/t/07-frame.t (original)
+++ Carp-REPL/t/07-frame.t Fri Jun 20 02:49:49 2008
@@ -1,7 +1,7 @@
#!perl
use strict;
use warnings;
-use Test::More tests => 48;
+use Test::More tests => 54;
use Test::Expect;
expect_run
@@ -76,3 +76,13 @@
expect_like(qr{^ 5: main::fib called at t/scripts/07-frame\.pl:9\.}m);
expect_like(qr{^ 6: main::fib called at t/scripts/07-frame\.pl:9\.}m);
expect_like(qr{^ 7: main::fib called at t/scripts/07-frame\.pl:12\.}m);
+
+expect_send(':bottom');
+expect_like(qr{\bNow at t/scripts/07-frame\.pl:8 \(frame 0\)\.});
+
+expect_send('$m');
+expect_like(qr/^\s*\$m\s*$/m);
+
+expect_send(':top');
+expect_like(qr{\bNow at t/scripts/07-frame\.pl:12 \(frame 7\)\.});
+
More information about the Bps-public-commit
mailing list