14 if (! -c "/dev/null") {
15 print "1..0 # Skip: no /dev/null\n";
19 my $dev_tty = '/dev/tty';
20 $dev_tty = 'TT:' if ($^O eq 'VMS');
22 print "1..0 # Skip: no $dev_tty\n";
26 print "1..0 # Skip: \$ENV{PERL5DB} is already set to '$ENV{PERL5DB}'\n";
33 my $rc_filename = '.perldb';
36 open my $rc_fh, '>', $rc_filename
41 # overly permissive perms gives "Must not source insecure rcfile"
42 # and hangs at the DB(1> prompt
43 chmod 0644, $rc_filename;
50 open my $in, '<', $filename
51 or die "Cannot open '$filename' for slurping - $!";
61 my $out_fn = 'db.out';
65 return _slurp($out_fn);
69 # Test for Proxy constants
74 &parse_options("NonStop=0 ReadLine=0 TTY=db.out LineInfo=db.out");
86 my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/proxy-constants');
87 is($output, "", "proxy constant subroutines");
90 # [perl #66110] Call a subroutine inside a regex
92 local $ENV{PERLDB_OPTS} = "ReadLine=0 NonStop=1";
93 my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/rt-66110');
94 like($output, "All tests successful.", "[perl #66110]");
99 &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
102 push (@DB::typeahead,
117 my $self = bless {}, $class;
128 $self->{_cmds} = shift;
131 return $self->{_cmds};
138 $self->{_prog} = shift;
141 return $self->{_prog};
148 $self->{_output} = shift;
151 return $self->{_output};
160 $self->{_include_t} = shift;
163 return $self->{_include_t};
172 $self->{_stderr_val} = shift;
175 return $self->{_stderr_val};
184 $self->{field} = shift;
187 return $self->{field};
196 $self->{_switches} = shift;
199 return $self->{_switches};
208 $self->{_contents} = shift;
211 return $self->{_contents};
216 my ($self, $args) = @_;
218 my $cmds = $args->{cmds};
220 if (ref($cmds) ne 'ARRAY') {
221 die "cmds must be an array of commands.";
226 my $prog = $args->{prog};
228 if (ref($prog) ne '' or !defined($prog)) {
229 die "prog should be a path to a program file.";
234 $self->_include_t($args->{include_t} ? 1 : 0);
236 $self->_stderr_val(exists($args->{stderr}) ? $args->{stderr} : 1);
238 if (exists($args->{switches}))
240 $self->_switches($args->{switches});
250 my ($self, $str) = @_;
252 $str =~ s/(["\@\$\\])/\\$1/g;
262 my $rc = qq{&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");\n};
267 q#push (@DB::typeahead,#,
268 (map { $self->_quote($_) . "," } @{$self->_cmds()}),
274 # I guess two objects like that cannot be used at the same time.
282 ($self->_switches ? (@{$self->_switches()}) : ('-d')),
283 ($self->_include_t ? ('-I', '../lib/perl5db/t') : ())
285 (defined($self->_stderr_val())
286 ? (stderr => $self->_stderr_val())
289 progfile => $self->_prog()
292 $self->_output($output);
294 $self->_contents(::_out_contents());
301 return shift->_output();
305 my ($self, $re, $msg) = @_;
307 local $::Level = $::Level + 1;
308 ::like($self->_output(), $re, $msg);
312 my ($self, $re, $msg) = @_;
314 local $::Level = $::Level + 1;
315 ::unlike($self->_output(), $re, $msg);
319 my ($self, $re, $msg) = @_;
321 local $::Level = $::Level + 1;
322 ::like($self->_contents(), $re, $msg);
325 sub contents_unlike {
326 my ($self, $re, $msg) = @_;
328 local $::Level = $::Level + 1;
329 ::unlike($self->_contents(), $re, $msg);
335 local $ENV{PERLDB_OPTS} = "ReadLine=0";
336 my $target = '../lib/perl5db/t/eval-line-bug';
337 my $wrapper = DebugWrap->new(
347 "p \@{'main::_<$target'}",
353 $wrapper->contents_like(
355 'The ${main::_<filename} variable in the debugger was not destroyed',
359 sub _calc_generic_wrapper
363 my $extra_opts = delete($args->{extra_opts});
365 local $ENV{PERLDB_OPTS} = "ReadLine=0" . $extra_opts;
366 return DebugWrap->new(
368 cmds => delete($args->{cmds}),
369 prog => delete($args->{prog}),
375 sub _calc_new_var_wrapper
378 return _calc_generic_wrapper(
385 'x "new_var = <$new_var>\\n"',
393 sub _calc_threads_wrapper
397 return _calc_new_var_wrapper(
399 switches => [ '-dt', ],
407 _calc_new_var_wrapper({ prog => '../lib/perl5db/t/eval-line-bug'})
410 "no strict 'vars' in evaluated lines.",
415 _calc_new_var_wrapper(
417 prog => '../lib/perl5db/t/lvalue-bug',
422 'lvalue subs work in the debugger',
427 _calc_new_var_wrapper(
429 prog => '../lib/perl5db/t/symbol-table-bug',
430 extra_opts => "NonStop=1",
434 qr/Undefined symbols 0/,
435 'there are no undefined values in the symbol table',
441 if ( $Config{usethreads} ) {
442 skip('This perl has threads, skipping non-threaded debugger tests');
445 my $error = 'This Perl not built to support threads';
446 _calc_threads_wrapper(
448 prog => '../lib/perl5db/t/eval-line-bug',
452 'Perl debugger correctly complains that it was not built with threads',
459 if ( $Config{usethreads} ) {
460 _calc_threads_wrapper(
462 prog => '../lib/perl5db/t/symbol-table-bug',
465 qr/Undefined symbols 0/,
466 'there are no undefined values in the symbol table when running with thread support',
470 skip("This perl is not threaded, skipping threaded debugger tests");
476 local $ENV{PERLDB_OPTS};
477 my $wrapper = DebugWrap->new(
484 prog => '../lib/perl5db/t/rt-61222',
488 $wrapper->contents_unlike(qr/INCORRECT/, "[perl #61222]");
491 sub _calc_trace_wrapper
495 return _calc_generic_wrapper(
508 # [perl 104168] level option for tracing
510 my $wrapper = _calc_trace_wrapper({ prog => '../lib/perl5db/t/rt-104168' });
511 $wrapper->contents_like(qr/level 2/, "[perl #104168] - level 2 appears");
512 $wrapper->contents_unlike(qr/baz/, "[perl #104168] - no 'baz'");
517 my $wrapper = _calc_trace_wrapper(
519 prog => '../lib/perl5db/t/taint',
520 extra_opts => ' NonStop=1',
521 switches => [ '-d', '-T', ],
525 my $output = $wrapper->get_output();
526 chomp $output if $^O eq 'VMS'; # newline guaranteed at EOF
527 is($output, '[$^X][done]', "taint");
530 # Testing that we can set a line in the middle of the file.
532 my $wrapper = DebugWrap->new(
536 'b ../lib/perl5db/t/MyModule.pm:12',
538 q/do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }/,
543 prog => '../lib/perl5db/t/filename-line-breakpoint'
547 $wrapper->output_like(qr/
555 "Can set breakpoint in a line in the middle of the file.");
558 # Testing that we can set a breakpoint
560 my $wrapper = DebugWrap->new(
562 prog => '../lib/perl5db/t/breakpoint-bug',
567 q/do { use IO::Handle; STDOUT->autoflush(1); print "X={$x}\n"; }/,
574 $wrapper->output_like(
576 "Can set breakpoint in a line."
580 # Testing that we can disable a breakpoint at a numeric line.
582 my $wrapper = DebugWrap->new(
584 prog => '../lib/perl5db/t/disable-breakpoints-1',
591 q/print "X={$x}\n";/,
598 $wrapper->output_like(qr/X=\{SecondVal\}/ms,
599 "Can set breakpoint in a line.");
602 # Testing that we can re-enable a breakpoint at a numeric line.
604 my $wrapper = DebugWrap->new(
606 prog => '../lib/perl5db/t/disable-breakpoints-2',
615 q/print "X={$x}\n";/,
622 $wrapper->output_like(
624 X=\{SecondValOneHundred\}
626 "Can set breakpoint in a line."
631 # Disable and enable for breakpoints on outer files.
633 my $wrapper = DebugWrap->new(
638 'b ../lib/perl5db/t/EnableModule.pm:14',
639 'disable ../lib/perl5db/t/EnableModule.pm:14',
641 'enable ../lib/perl5db/t/EnableModule.pm:14',
643 q/print "X={$x}\n";/,
647 prog => '../lib/perl5db/t/disable-breakpoints-3',
652 $wrapper->output_like(qr/
653 X=\{SecondValTwoHundred\}
655 "Can set breakpoint in a line.");
658 # Testing that the prompt with the information appears.
660 my $wrapper = DebugWrap->new(
663 prog => '../lib/perl5db/t/disable-breakpoints-1',
667 $wrapper->contents_like(qr/
668 ^main::\([^\)]*\bdisable-breakpoints-1:2\):\n
669 2:\s+my\ \$x\ =\ "One";\n
671 "Prompt should display the first line of code.");
674 # Testing that R (restart) and "B *" work.
676 my $wrapper = DebugWrap->new(
686 q/print "X={$x};dummy={$dummy}\n";/,
689 prog => '../lib/perl5db/t/disable-breakpoints-1',
693 $wrapper->output_like(qr/
694 X=\{FirstVal\};dummy=\{1\}
696 "Restart and delete all breakpoints work properly.");
700 my $wrapper = DebugWrap->new(
705 q/print "X={$x}\n";/,
709 prog => '../lib/perl5db/t/disable-breakpoints-1',
713 $wrapper->output_like(qr/
716 "'c line_num' is working properly.");
720 my $wrapper = DebugWrap->new(
728 q/print "Exp={$exp}\n";/,
731 prog => '../lib/perl5db/t/break-on-dot',
735 $wrapper->output_like(qr/
738 "'b .' is working correctly.");
741 # Testing that the prompt with the information appears inside a subroutine call.
742 # See https://rt.perl.org/rt3/Ticket/Display.html?id=104820
744 my $wrapper = DebugWrap->new(
751 prog => '../lib/perl5db/t/with-subroutine',
755 $wrapper->contents_like(
757 ^main::back\([^\)\n]*\bwith-subroutine:15\):[\ \t]*\n
758 ^15:\s*print\ "hello\ back\\n";
760 "Prompt should display the line of code inside a subroutine.");
763 # Checking that the p command works.
765 my $wrapper = DebugWrap->new(
769 'p "<<<" . (4*6) . ">>>"',
772 prog => '../lib/perl5db/t/with-subroutine',
776 $wrapper->contents_like(
783 my $wrapper = DebugWrap->new(
790 prog => '../lib/perl5db/t/with-subroutine',
794 $wrapper->contents_like(
795 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
796 qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/ms,
801 # Tests for "T" (stack trace).
803 my $prog_fn = '../lib/perl5db/t/rt-104168';
804 my $wrapper = DebugWrap->new(
815 my $re_text = join('',
818 "%s = %s\\(\\) called from file " .
819 "'" . quotemeta($prog_fn) . "' line %s\\n",
820 (map { quotemeta($_) } @$_)
824 ['.', 'main::baz', 14,],
825 ['.', 'main::bar', 9,],
826 ['.', 'main::foo', 6],
829 $wrapper->contents_like(
830 # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
838 my $wrapper = DebugWrap->new(
845 q/print "X={$x};dummy={$dummy}\n";/,
848 prog => '../lib/perl5db/t/disable-breakpoints-1'
852 $wrapper->output_like(qr/
853 X=\{SecondVal\};dummy=\{1\}
855 'test for s - single step',
860 my $wrapper = DebugWrap->new(
868 q/print "Exp={$exp}\n";/,
871 prog => '../lib/perl5db/t/break-on-dot'
875 $wrapper->output_like(qr/
878 "'b .' is working correctly.");
882 my $prog_fn = '../lib/perl5db/t/rt-104168';
883 my $wrapper = DebugWrap->new(
894 $wrapper->contents_like(
896 ^main::foo\([^\)\n]*\brt-104168:9\):[\ \t]*\n
899 'Test for the s command.',
904 my $wrapper = DebugWrap->new(
908 's uncalled_subroutine()',
913 prog => '../lib/perl5db/t/uncalled-subroutine'}
916 $wrapper->output_like(
918 'uncalled_subroutine was called after s EXPR()',
923 my $wrapper = DebugWrap->new(
927 'n uncalled_subroutine()',
931 prog => '../lib/perl5db/t/uncalled-subroutine',
935 $wrapper->output_like(
937 'uncalled_subroutine was called after n EXPR()',
942 my $wrapper = DebugWrap->new(
954 prog => '../lib/perl5db/t/fact',
958 $wrapper->output_like(
960 'b subroutine works fine',
964 # Test for 'M' (module list).
966 my $wrapper = DebugWrap->new(
973 prog => '../lib/perl5db/t/load-modules'
977 $wrapper->contents_like(
979 'M (module list) works fine',
984 my $wrapper = DebugWrap->new(
992 'print "Var=$var\n";',
995 prog => '../lib/perl5db/t/test-r-statement',
999 $wrapper->output_like(
1007 'r statement is working properly.',
1012 my $wrapper = DebugWrap->new(
1019 prog => '../lib/perl5db/t/test-l-statement-1',
1023 $wrapper->contents_like(
1025 ^1==>\s+\$x\ =\ 1;\n
1026 2:\s+print\ "1\\n";\n
1029 5:\s+print\ "2\\n";\n
1031 'l statement is working properly (test No. 1).',
1036 my $wrapper = DebugWrap->new(
1048 prog => '../lib/perl5db/t/test-l-statement-1',
1052 my $first_l_out = qr/
1054 2:\s+print\ "1\\n";\n
1057 5:\s+print\ "2\\n";\n
1060 8:\s+print\ "3\\n";\n
1065 my $second_l_out = qr/
1066 11:\s+print\ "4\\n";\n
1069 14:\s+print\ "5\\n";\n
1072 17:\s+print\ "6\\n";\n
1075 20:\s+print\ "7\\n";\n
1077 $wrapper->contents_like(
1080 [^\n]*?DB<\d+>\ \#\ After\ l\ 1\n
1082 [^\n]*?DB<\d+>\ l\s*\n
1084 [^\n]*?DB<\d+>\ \#\ After\ l\ 2\n
1086 [^\n]*?DB<\d+>\ -\s*\n
1088 [^\n]*?DB<\d+>\ \#\ After\ -\n
1090 'l followed by l and then followed by -',
1095 my $wrapper = DebugWrap->new(
1102 prog => '../lib/perl5db/t/test-l-statement-2',
1106 my $first_l_out = qr/
1108 7:\s+my\ \$n\ =\ shift;\n
1109 8:\s+if\ \(\$n\ >\ 1\)\ \{\n
1110 9:\s+return\ \$n\ \*\ fact\(\$n\ -\ 1\);
1113 $wrapper->contents_like(
1118 'l subroutine_name',
1123 my $wrapper = DebugWrap->new(
1129 # Repeat several times to avoid @typeahead problems.
1136 prog => '../lib/perl5db/t/test-l-statement-2',
1141 ^main::fact\([^\n]*?:7\):\n
1142 ^7:\s+my\ \$n\ =\ shift;\n
1145 $wrapper->contents_like(
1150 'Test the "." command',
1154 # Testing that the f command works.
1156 my $wrapper = DebugWrap->new(
1160 'f ../lib/perl5db/t/MyModule.pm',
1163 q/do { use IO::Handle; STDOUT->autoflush(1); print "Var=$var\n"; }/,
1168 prog => '../lib/perl5db/t/filename-line-breakpoint'
1172 $wrapper->output_like(qr/
1180 "f command is working.",
1184 # We broke the /pattern/ command because apparently the CORE::eval-s inside
1185 # lib/perl5db.pl cannot handle lexical variable properly. So we now fix this
1190 # 1. Go over the rest of the "eval"s in lib/perl5db.t and see if they cause
1193 my $wrapper = DebugWrap->new(
1200 prog => '../lib/perl5db/t/eval-line-bug',
1204 $wrapper->contents_like(
1205 qr/12: \s* for\ my\ \$q\ \(1\ \.\.\ 10\)\ \{/msx,
1206 "/pat/ command is working and found a match.",
1211 my $wrapper = DebugWrap->new(
1220 prog => '../lib/perl5db/t/eval-line-bug',
1224 $wrapper->contents_like(
1225 qr/12: \s* for\ my\ \$q\ \(1\ \.\.\ 10\)\ \{/msx,
1226 "?pat? command is working and found a match.",
1230 # Test the L command.
1232 my $wrapper = DebugWrap->new(
1241 prog => '../lib/perl5db/t/eval-line-bug',
1245 $wrapper->contents_like(
1247 ^\S*?eval-line-bug:\n
1248 \s*6:\s*my\ \$i\ =\ 5;\n
1249 \s*break\ if\ \(1\)\n
1250 \s*13:\s*\$i\ \+=\ \$q;\n
1251 \s*break\ if\ \(\(\$q\ ==\ 5\)\)\n
1253 "L command is listing breakpoints",
1257 # Test the L command for watch expressions.
1259 my $wrapper = DebugWrap->new(
1267 prog => '../lib/perl5db/t/eval-line-bug',
1271 $wrapper->contents_like(
1273 ^Watch-expressions:\n
1276 "L command is listing watch expressions",
1281 my $wrapper = DebugWrap->new(
1291 prog => '../lib/perl5db/t/eval-line-bug',
1295 $wrapper->contents_like(
1297 ^Watch-expressions:\n
1301 "L command is not listing deleted watch expressions",
1305 # Test the L command.
1307 my $wrapper = DebugWrap->new(
1316 prog => '../lib/perl5db/t/eval-line-bug',
1320 $wrapper->contents_like(
1322 ^\S*?eval-line-bug:\n
1323 \s*6:\s*my\ \$i\ =\ 5;\n
1324 \s*break\ if\ \(1\)\n
1325 \s*13:\s*\$i\ \+=\ \$q;\n
1326 \s*action:\s+print\ \$i\n
1328 "L command is listing actions and breakpoints",
1333 my $wrapper = DebugWrap->new(
1340 prog => '../lib/perl5db/t/rt-104168',
1344 $wrapper->contents_like(
1355 my $wrapper = DebugWrap->new(
1362 prog => '../lib/perl5db/t/rt-104168',
1366 $wrapper->contents_like(
1372 "S command with regex",
1377 my $wrapper = DebugWrap->new(
1384 prog => '../lib/perl5db/t/rt-104168',
1388 $wrapper->contents_unlike(
1392 "S command with negative regex",
1395 $wrapper->contents_like(
1399 "S command with negative regex - what it still matches",
1403 # Test the a command.
1405 my $wrapper = DebugWrap->new(
1409 'a 13 print "\nVar<Q>=$q\n"',
1413 prog => '../lib/perl5db/t/eval-line-bug',
1417 $wrapper->output_like(qr#
1422 "a command is working",
1426 # Test the 'A' command
1428 my $wrapper = DebugWrap->new(
1432 'a 13 print "\nVar<Q>=$q\n"',
1437 prog => '../lib/perl5db/t/eval-line-bug',
1441 $wrapper->output_like(
1442 qr#\A\z#msx, # The empty string.
1443 "A command (for removing actions) is working",
1447 # Test the 'A *' command
1449 my $wrapper = DebugWrap->new(
1453 'a 6 print "\nFail!\n"',
1454 'a 13 print "\nVar<Q>=$q\n"',
1459 prog => '../lib/perl5db/t/eval-line-bug',
1463 $wrapper->output_like(
1464 qr#\A\z#msx, # The empty string.
1465 "'A *' command (for removing all actions) is working",
1470 my $wrapper = DebugWrap->new(
1477 'print "\nIDX=<$idx>\n"',
1480 prog => '../lib/perl5db/t/test-w-statement-1',
1485 $wrapper->contents_like(qr#
1487 \s+old\ value:\s+'1'\n
1488 \s+new\ value:\s+'2'\n
1490 'w command - watchpoint changed',
1492 $wrapper->output_like(qr#
1495 "w command - correct output from IDX",
1500 my $wrapper = DebugWrap->new(
1508 'print "\nIDX=<$idx>\n"',
1511 prog => '../lib/perl5db/t/test-w-statement-1',
1515 $wrapper->contents_unlike(qr#
1518 'W command - watchpoint was deleted',
1521 $wrapper->output_like(qr#
1524 "W command - stopped at end.",
1528 # Test the W * command.
1530 my $wrapper = DebugWrap->new(
1539 'print "\nIDX=<$idx>\n"',
1542 prog => '../lib/perl5db/t/test-w-statement-1',
1546 $wrapper->contents_unlike(qr#
1549 '"W *" command - watchpoint was deleted',
1552 $wrapper->output_like(qr#
1555 '"W *" command - stopped at end.',
1559 # Test the 'o' command (without further arguments).
1561 my $wrapper = DebugWrap->new(
1568 prog => '../lib/perl5db/t/test-w-statement-1',
1572 $wrapper->contents_like(qr#
1573 ^\s*warnLevel\ =\ '1'\n
1575 q#"o" command (without arguments) displays warnLevel#,
1578 $wrapper->contents_like(qr#
1579 ^\s*signalLevel\ =\ '1'\n
1581 q#"o" command (without arguments) displays signalLevel#,
1584 $wrapper->contents_like(qr#
1585 ^\s*dieLevel\ =\ '1'\n
1587 q#"o" command (without arguments) displays dieLevel#,
1590 $wrapper->contents_like(qr#
1591 ^\s*hashDepth\ =\ 'N/A'\n
1593 q#"o" command (without arguments) displays hashDepth#,
1597 # Test the 'o' query command.
1599 my $wrapper = DebugWrap->new(
1603 'o hashDepth? signalLevel?',
1606 prog => '../lib/perl5db/t/test-w-statement-1',
1610 $wrapper->contents_unlike(qr#warnLevel#,
1611 q#"o" query command does not display warnLevel#,
1614 $wrapper->contents_like(qr#
1615 ^\s*signalLevel\ =\ '1'\n
1617 q#"o" query command displays signalLevel#,
1620 $wrapper->contents_unlike(qr#dieLevel#,
1621 q#"o" query command does not display dieLevel#,
1624 $wrapper->contents_like(qr#
1625 ^\s*hashDepth\ =\ 'N/A'\n
1627 q#"o" query command displays hashDepth#,
1631 # Test the 'o' set command.
1633 my $wrapper = DebugWrap->new(
1641 prog => '../lib/perl5db/t/test-w-statement-1',
1645 $wrapper->contents_like(qr/
1646 ^\s*(signalLevel\ =\ '0'\n)
1650 q#o set command works#,
1653 $wrapper->contents_like(qr#
1654 ^\s*hashDepth\ =\ 'N/A'\n
1656 q#o set command - hashDepth#,
1660 # Test the '<' and "< ?" commands.
1662 my $wrapper = DebugWrap->new(
1666 q/< print "\nX=<$x>\n"/,
1672 prog => '../lib/perl5db/t/disable-breakpoints-1',
1676 $wrapper->contents_like(qr/
1677 ^pre-perl\ commands:\n
1678 \s*<\ --\ print\ "\\nX=<\$x>\\n"\n
1680 q#Test < and < ? commands - contents.#,
1683 $wrapper->output_like(qr#
1686 q#Test < and < ? commands - output.#,
1690 # Test the '< *' command.
1692 my $wrapper = DebugWrap->new(
1696 q/< print "\nX=<$x>\n"/,
1702 prog => '../lib/perl5db/t/disable-breakpoints-1',
1706 $wrapper->output_unlike(qr/FirstVal/,
1707 q#Test the '< *' command.#,
1711 # Test the '>' and "> ?" commands.
1713 my $wrapper = DebugWrap->new(
1718 q/> print "\nFOO=<$::foo>\n"/,
1724 prog => '../lib/perl5db/t/disable-breakpoints-1',
1728 $wrapper->contents_like(qr/
1729 ^post-perl\ commands:\n
1730 \s*>\ --\ print\ "\\nFOO=<\$::foo>\\n"\n
1732 q#Test > and > ? commands - contents.#,
1735 $wrapper->output_like(qr#
1738 q#Test > and > ? commands - output.#,
1742 # Test the '> *' command.
1744 my $wrapper = DebugWrap->new(
1748 q/> print "\nFOO=<$::foo>\n"/,
1754 prog => '../lib/perl5db/t/disable-breakpoints-1',
1758 $wrapper->output_unlike(qr/FOO=/,
1759 q#Test the '> *' command.#,
1763 # Test the < and > commands together
1765 my $wrapper = DebugWrap->new(
1770 q/< $::lorem += 10;/,
1771 q/> print "\nLOREM=<$::lorem>\n"/,
1778 prog => '../lib/perl5db/t/disable-breakpoints-1',
1782 $wrapper->output_like(qr#
1785 q#Test < and > commands. #,
1789 # Test the { ? and { [command] commands.
1791 my $wrapper = DebugWrap->new(
1802 prog => '../lib/perl5db/t/disable-breakpoints-1',
1806 $wrapper->contents_like(qr#
1807 ^No\ pre-debugger\ actions\.\n
1809 ^pre-debugger\ commands:\n
1812 ^5==>b\s+\$x\ =\ "FirstVal";\n
1816 9:\s+\$x\ =\ "SecondVal";\n
1819 'Test the pre-prompt debugger commands',
1823 # Test the { * command.
1825 my $wrapper = DebugWrap->new(
1833 q/print (("One" x 5), "\n");/,
1836 prog => '../lib/perl5db/t/disable-breakpoints-1',
1840 $wrapper->contents_like(qr#
1841 ^All\ \{\ actions\ cleared\.\n
1843 'Test the { * command',
1846 $wrapper->output_like(qr/OneOneOneOneOne/,
1847 '{ * test - output is OK.',
1851 # Test the ! command.
1853 my $wrapper = DebugWrap->new(
1861 prog => '../lib/perl5db/t/disable-breakpoints-1',
1865 $wrapper->contents_like(qr#
1866 (^3:\s+my\ \$dummy\ =\ 0;\n
1868 5:\s+\$x\ =\ "FirstVal";)\n
1873 'Test the ! command (along with l 3-5)',
1877 # Test the ! -number command.
1879 my $wrapper = DebugWrap->new(
1888 prog => '../lib/perl5db/t/disable-breakpoints-1',
1892 $wrapper->contents_like(qr#
1893 (^3:\s+my\ \$dummy\ =\ 0;\n
1895 5:\s+\$x\ =\ "FirstVal";)\n
1897 ^2==\>\s+my\ \$x\ =\ "One";\n
1902 'Test the ! -n command (along with l)',
1906 # Test the 'source' command.
1908 my $wrapper = DebugWrap->new(
1912 'source ../lib/perl5db/t/source-cmd-test.perldb',
1913 # If we have a 'q' here, then the typeahead will override the
1914 # input, and so it won't be reached - solution:
1915 # put a q inside the .perldb commands.
1916 # ( This may be a bug or a misfeature. )
1918 prog => '../lib/perl5db/t/disable-breakpoints-1',
1922 $wrapper->contents_like(qr#
1923 ^3:\s+my\ \$dummy\ =\ 0;\n
1925 5:\s+\$x\ =\ "FirstVal";\n
1929 9:\s+\$x\ =\ "SecondVal";\n
1932 'Test the source command (along with l)',
1935 print $wrapper->get_output(), "\n";
1939 1 while unlink ($rc_filename, $out_fn);