With a test.
lib/perl5db/t/rt-104168 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
+lib/perl5db/t/source-cmd-test-no-q.perldb TTests for the Perl debugger
lib/perl5db/t/source-cmd-test.perldb TTests for the Perl debugger
lib/perl5db/t/symbol-table-bug Tests for the Perl debugger
lib/perl5db/t/taint Tests for the Perl debugger
# Localize to prevent it from being smashed in the program being debugged.
local $.;
+ # If there are stacked filehandles to read from ...
+ # (Handle it before the typeahead, because we may call source/etc. from
+ # the typeahead.)
+ while (@cmdfhs) {
+
+ # Read from the last one in the stack.
+ my $line = CORE::readline( $cmdfhs[-1] );
+
+ # If we got a line ...
+ defined $line
+ ? ( print $OUT ">> $line" and return $line ) # Echo and return
+ : close pop @cmdfhs; # Pop and close
+ } ## end while (@cmdfhs)
+
# Pull a line out of the typeahead if there's stuff there.
if (@typeahead) {
local $frame = 0;
local $doret = -2;
- # If there are stacked filehandles to read from ...
- while (@cmdfhs) {
-
- # Read from the last one in the stack.
- my $line = CORE::readline( $cmdfhs[-1] );
-
- # If we got a line ...
- defined $line
- ? ( print $OUT ">> $line" and return $line ) # Echo and return
- : close pop @cmdfhs; # Pop and close
- } ## end while (@cmdfhs)
-
# Nothing on the filehandle stack. Socket?
if ( ref $OUT and UNIVERSAL::isa( $OUT, 'IO::Socket::INET' ) ) {
}
}
-plan(80);
+plan(81);
my $rc_filename = '.perldb';
#msx,
'Test the source command (along with l)',
);
+}
+
+# Test the 'source' command being traversed from withing typeahead.
+{
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ 'source ../lib/perl5db/t/source-cmd-test-no-q.perldb',
+ 'q',
+ ],
+ prog => '../lib/perl5db/t/disable-breakpoints-1',
+ }
+ );
- print $wrapper->get_output(), "\n";
+ $wrapper->contents_like(qr#
+ ^3:\s+my\ \$dummy\ =\ 0;\n
+ 4\s*\n
+ 5:\s+\$x\ =\ "FirstVal";\n
+ 6\s*\n
+ 7:\s+\$dummy\+\+;\n
+ 8\s*\n
+ 9:\s+\$x\ =\ "SecondVal";\n
+ 10\s*\n
+ #msx,
+ 'Test the source command inside a typeahead',
+ );
}
END {