Move the #7390 test from warn/op to comp/redef.
authorJohn Tobey <jtobey@john-edwin-tobey.org>
Sun, 22 Oct 2000 04:04:12 +0000 (00:04 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 22 Oct 2000 18:24:10 +0000 (18:24 +0000)
Subject: Re: Creating const subs for constants.
Message-Id: <m13nG72-000FObC@feynman.localnet>

p4raw-id: //depot/perl@7400

t/comp/redef.t
t/pragma/warn/op

index 07e978b..328b44d 100755 (executable)
@@ -11,7 +11,7 @@ sub ok ($$) {
     print $_[1] ? "ok " : "not ok ", $_[0], "\n";
 }
 
-print "1..18\n";
+print "1..20\n";
 
 my $NEWPROTO = 'Prototype mismatch:';
 
@@ -72,9 +72,15 @@ sub sub9 ($)  { 2 }
 ok 16, $warn =~ s/$NEWPROTO sub main::sub9 \(\$\Q@) vs ($)\E[^\n]+\n//s;
 ok 17, $warn =~ s/Subroutine sub9 redefined[^\n]+\n//s;
 
-ok 18, $_ eq '';
+BEGIN {
+    local $^W = 0;
+    eval qq(sub sub10 () {1} sub sub10 {1});
+}
 
-# If we got any errors that we were not expecting, then print them
-print $_ if length $_;
+ok 18, $warn =~ s/$NEWPROTO \Qsub main::sub10 () vs none\E[^\n]+\n//s;
+ok 19, $warn =~ s/Constant subroutine sub10 redefined[^\n]+\n//s;
 
+ok 20, $warn eq '';
 
+# If we got any errors that we were not expecting, then print them
+print $warn if length $warn;
index 0163d76..de326f8 100644 (file)
      Constant subroutine %s redefined 
         sub fred() {1;} sub fred() {1;}
  
-     Constant subroutine %s redefined 
-        sub fred() {1;} sub fred() {1;}
-     Prototype mismatch: sub main::foo () vs none
-     Constant subroutine foo redefined
-       sub foo () {1} sub foo {1}
-
      Format FRED redefined at /tmp/x line 5.
        format FRED =
        .
@@ -737,14 +730,6 @@ EXPECT
 Constant subroutine fred redefined at - line 4.
 ########
 # op.c
-use warnings;
-sub foo () {1}
-sub foo {1}
-EXPECT
-Prototype mismatch: sub main::foo () vs none at - line 4.
-Constant subroutine foo redefined at - line 4.
-########
-# op.c
 use warnings 'redefine' ;
 format FRED =
 .