Re: [perl #17934] tied STDERR and internal warnings
[p5sagit/p5-mst-13.2.git] / t / comp / use.t
index c3cdb70..fa4dc18 100755 (executable)
@@ -2,10 +2,10 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib';
+    @INC = '../lib';
 }
 
-print "1..27\n";
+print "1..28\n";
 
 my $i = 1;
 eval "use 5.000";      # implicit semicolon
@@ -82,7 +82,7 @@ if ($@) {
 }
 print "ok ",$i++,"\n";
 
-print "not " unless $INC[0] eq "fred";
+print "not " unless ($INC[0] eq "fred" || ($^O eq 'MacOS' && $INC[0] eq ":fred:"));
 print "ok ",$i++,"\n";
 
 eval "use lib 1.0 qw(joe)";
@@ -92,7 +92,7 @@ if ($@) {
 }
 print "ok ",$i++,"\n";
 
-print "not " unless $INC[0] eq "joe";
+print "not " unless ($INC[0] eq "joe" || ($^O eq 'MacOS' && $INC[0] eq ":joe:"));
 print "ok ",$i++,"\n";
 
 eval "use lib 1.01 qw(freda)";
@@ -101,7 +101,7 @@ unless ($@) {
 }
 print "ok ",$i++,"\n";
 
-print "not " if $INC[0] eq "freda";
+print "not " if ($INC[0] eq "freda" || ($^O eq 'MacOS' && $INC[0] eq ":freda:"));
 print "ok ",$i++,"\n";
 
 {
@@ -111,7 +111,7 @@ print "ok ",$i++,"\n";
     print "ok ",$i++,"\n";
 
     eval "use lib v100.105";
-    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
+    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
        print "not ";
     }
     print "ok ",$i++,"\n";
@@ -121,7 +121,7 @@ print "ok ",$i++,"\n";
     print "ok ",$i++,"\n";
 
     eval "use lib 100.105";
-    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
+    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
        print "not ";
     }
     print "ok ",$i++,"\n";
@@ -153,7 +153,7 @@ print "ok ",$i++,"\n";
     print "ok ",$i++,"\n";
 
     eval "use lib v100.105";
-    unless ($@ =~ /lib version v100\.105 required--this is only version v35\.36/) {
+    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
        print "not ";
     }
     print "ok ",$i++,"\n";
@@ -163,8 +163,23 @@ print "ok ",$i++,"\n";
     print "ok ",$i++,"\n";
 
     eval "use lib 100.105";
-    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.036/) {
+    unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
+       print "not ";
+    }
+    print "ok ",$i++,"\n";
+}
+
+
+{
+    # Regression test for patch 14937: 
+    #   Check that a .pm file with no package or VERSION doesn't core.
+    open F, ">xxx.pm" or die "Cannot open xxx.pm: $!\n";
+    print F "1;\n";
+    close F;
+    eval "use lib '.'; use xxx 3;";
+    unless ($@ =~ /^xxx defines neither package nor VERSION--version check failed at/) {
        print "not ";
     }
     print "ok ",$i++,"\n";
+    unlink 'xxx.pm';
 }