This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl -d: add a test for s EXPR().
authorShlomi Fish <shlomif@shlomifish.org>
Tue, 13 Dec 2011 17:03:06 +0000 (19:03 +0200)
committerRicardo Signes <rjbs@cpan.org>
Fri, 30 Dec 2011 16:54:46 +0000 (11:54 -0500)
This patch involves addding another "perl -d" input script that contains a
subroutine that isn't called by default.

MANIFEST
lib/perl5db.t
lib/perl5db/t/uncalled-subroutine [new file with mode: 0644]

index 0c4b1c5..d338e44 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4254,6 +4254,7 @@ lib/perl5db/t/rt-61222            Tests for the Perl debugger
 lib/perl5db/t/rt-66110         Tests for the Perl debugger
 lib/perl5db/t/symbol-table-bug Tests for the Perl debugger
 lib/perl5db/t/taint            Tests for the Perl debugger
+lib/perl5db/t/uncalled-subroutine      Tests for the Perl debugger
 lib/perl5db/t/with-subroutine          Tests for the Perl debugger
 lib/PerlIO.pm                  PerlIO support module
 lib/Pod/Functions.pm           used by pod/splitpod
index 5c52a0e..76b8c3b 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(28);
+plan(29);
 
 my $rc_filename = '.perldb';
 
@@ -659,6 +659,29 @@ EOF
     );
 }
 
+{
+    rc(<<'EOF');
+&parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+
+sub afterinit {
+    push (@DB::typeahead,
+    's uncalled_subroutine()',
+    'c',
+    'q',
+    );
+
+}
+EOF
+
+    my $output = runperl(switches => [ '-d', ], stderr => 1, progfile => '../lib/perl5db/t/uncalled-subroutine');
+
+    like ($output, 
+        qr/<1,2,3,4,5>\n/,
+        'uncalled_subroutine was called after s EXPR()',
+        );
+
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/uncalled-subroutine b/lib/perl5db/t/uncalled-subroutine
new file mode 100644 (file)
index 0000000..daf7965
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+exit(0);
+
+sub uncalled_subroutine
+{
+    print '<', join(',', 1 .. 5), ">\n";
+}