Add test case for [perl #61222] + a test case for proxy constant subroutines
Bram [Fri, 24 Jul 2009 22:32:25 +0000 (00:32 +0200)]
lib/perl5db.t
lib/perl5db/t/proxy-constants [new file with mode: 0644]
lib/perl5db/t/rt-61222 [new file with mode: 0644]

index bb098a1..6e57c9f 100644 (file)
@@ -27,7 +27,7 @@ my $dev_tty = '/dev/tty';
     }
 }
 
-plan(5);
+plan(7);
 
 sub rc {
     open RC, ">", ".perldb" or die $!;
@@ -109,6 +109,57 @@ SKIP: {
     }
 }
 
+
+# Test [perl #61222]
+{
+    rc(
+        qq|
+        &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+        \n|,
+
+        qq|
+        sub afterinit {
+            push(\@DB::typeahead,
+                'm Pie',
+                'q',
+            );
+        }\n|,
+    );
+
+    my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/rt-61222');
+    my $contents;
+    {
+        local $/;
+        open I, "<", 'db.out' or die $!;
+        $contents = <I>;
+        close(I);
+    }
+    unlike($contents, qr/INCORRECT/, "[perl #61222]");
+}
+
+
+
+# Test for Proxy constants
+{
+    rc(
+        qq|
+        &parse_options("NonStop=0 TTY=db.out LineInfo=db.out");
+        \n|,
+
+        qq|
+        sub afterinit {
+            push(\@DB::typeahead,
+                'm main->s1',
+                'q',
+            );
+        }\n|,
+    );
+
+    my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/proxy-constants');
+    is($output, "", "proxy constant subroutines");
+}
+
+
 # clean up.
 
 END {
diff --git a/lib/perl5db/t/proxy-constants b/lib/perl5db/t/proxy-constants
new file mode 100644 (file)
index 0000000..ea60855
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+#
+# This code is used by lib/perl5db.t !!!
+#
+
+use constant FOO => "bar";
+sub s1 {
+    "main";
+}
diff --git a/lib/perl5db/t/rt-61222 b/lib/perl5db/t/rt-61222
new file mode 100644 (file)
index 0000000..6dd6a94
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/perl
+#
+# This code is used by lib/perl5db.t !!!
+#
+
+package Pie;
+
+sub INCORRECT (DB);
+
+1;