Add a test for the frame option.
authorShlomi Fish <shlomif@shlomifish.org>
Fri, 28 Sep 2012 18:03:12 +0000 (20:03 +0200)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:25 +0000 (09:18 -0500)
MANIFEST
lib/perl5db.t
lib/perl5db/t/test-frame-option-1 [new file with mode: 0644]

index df23ed2..3851de9 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4337,6 +4337,7 @@ 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
 lib/perl5db/t/test-dieLevel-option-1   Tests for the Perl debugger
+lib/perl5db/t/test-frame-option-1      Tests for the Perl debugger
 lib/perl5db/t/test-l-statement-1       Tests for the Perl debugger
 lib/perl5db/t/test-l-statement-2       Tests for the Perl debugger
 lib/perl5db/t/test-m-statement-1       Tests for the Perl debugger
index 0dfbd43..dfd99b7 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(103);
+plan(104);
 
 my $rc_filename = '.perldb';
 
@@ -2476,6 +2476,34 @@ sub _calc_trace_wrapper
     );
 }
 
+# Test the o frame option.
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                # This is to avoid getting the "Debugger program terminated"
+                # junk that interferes with the normal output.
+                'o inhibit_exit=0',
+                'b 10',
+                'c',
+                'o frame=255',
+                'c',
+                'q',
+            ],
+            prog => '../lib/perl5db/t/test-frame-option-1',
+        }
+    );
+
+    $wrapper->contents_like(
+        qr/
+            in\s*\.=main::my_other_func\(3,\ 1200\)\ from.*?
+            out\s*\.=main::my_other_func\(3,\ 1200\)\ from
+        /msx,
+        "Test o PrintRet=0 in void context",
+    );
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/test-frame-option-1 b/lib/perl5db/t/test-frame-option-1
new file mode 100644 (file)
index 0000000..a6b4dd8
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+sub my_func
+{
+    my ($num1, $num2) = @_;
+
+    print $num1+$num2, "\n";
+
+    my_other_func ($num1*3, $num2*24);
+
+    return $num1*$num2;
+}
+
+sub my_other_func
+{
+    my ($num1, $num2) = @_;
+
+    print "my_other_func: n1=<$num1> n2=<$num2>\n";
+
+    return $num1 * $num2;
+}
+
+my_func(1, 50);