[perl5db] Add test for dieLevel option.
authorShlomi Fish <shlomif@shlomifish.org>
Wed, 19 Sep 2012 13:33:22 +0000 (16:33 +0300)
committerRicardo Signes <rjbs@cpan.org>
Mon, 12 Nov 2012 14:18:24 +0000 (09:18 -0500)
MANIFEST
lib/perl5db.t
lib/perl5db/t/test-dieLevel-option-1 [new file with mode: 0644]

index 6e0707e..d964608 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4336,6 +4336,7 @@ 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
+lib/perl5db/t/test-dieLevel-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 87256b3..26cdeaf 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(90);
+plan(91);
 
 my $rc_filename = '.perldb';
 
@@ -2149,6 +2149,32 @@ sub _calc_trace_wrapper
         'Test the o recallCommand option',
     );
 }
+
+# Test the dieLevel option
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                q/o dieLevel='1'/,
+                q/c/,
+                'q',
+            ],
+            prog => '../lib/perl5db/t/test-dieLevel-option-1',
+        }
+    );
+
+    $wrapper->output_like(qr#
+        ^This\ program\ dies\.\ at\ \S+\ line\ 18\.\n
+        .*?
+        ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
+        \s+main::bar\(\)\ called\ at\ \S+\ line\ 7\n
+        \s+main::foo\(\)\ called\ at\ \S+\ line\ 21\n
+        #msx,
+        'Test the o dieLevel option',
+    );
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/test-dieLevel-option-1 b/lib/perl5db/t/test-dieLevel-option-1
new file mode 100644 (file)
index 0000000..0849ae2
--- /dev/null
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+sub foo
+{
+    print "In foo\n";
+    bar();
+}
+
+sub bar
+{
+    print "In baz\n";
+    baz();
+}
+
+sub baz
+{
+    die "This program dies.";
+}
+
+foo();
+