This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl5db] Add a test for warnLevel=1.
authorShlomi Fish <shlomif@shlomifish.org>
Thu, 20 Sep 2012 14:28:39 +0000 (17:28 +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-warnLevel-option-1 [new file with mode: 0644]

index d964608..117b33b 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4341,6 +4341,7 @@ 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
 lib/perl5db/t/test-r-statement Tests for the Perl debugger
+lib/perl5db/t/test-warnLevel-option-1  Tests for the Perl debugger
 lib/perl5db/t/test-w-statement-1       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
index 26cdeaf..8d73d11 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(91);
+plan(92);
 
 my $rc_filename = '.perldb';
 
@@ -2175,6 +2175,31 @@ sub _calc_trace_wrapper
     );
 }
 
+# Test the warnLevel option
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                q/o warnLevel='1'/,
+                q/c/,
+                'q',
+            ],
+            prog => '../lib/perl5db/t/test-warnLevel-option-1',
+        }
+    );
+
+    $wrapper->contents_like(qr#
+        ^This\ is\ not\ a\ warning\.\ at\ \S+\ line\ 18\.\n
+        .*?
+        ^\s+main::baz\(\)\ called\ at\ \S+\ line\ 13\n
+        \s+main::bar\(\)\ called\ at\ \S+\ line\ 25\n
+        \s+main::myfunc\(\)\ called\ at\ \S+\ line\ 28\n
+        #msx,
+        'Test the o warnLevel option',
+    );
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/test-warnLevel-option-1 b/lib/perl5db/t/test-warnLevel-option-1
new file mode 100644 (file)
index 0000000..04b71f9
--- /dev/null
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+
+sub foo
+{
+    print "In foo\n";
+    bar();
+}
+
+sub bar
+{
+    print "In baz\n";
+    baz();
+}
+
+sub baz
+{
+    warn "This is not a warning.";
+
+    return;
+}
+
+sub myfunc
+{
+    bar();
+}
+
+myfunc();
+