Moved a glob test from t/run/fresh_perl.t to t/op/glob.t
authorBrian Fraser <fraserbn@gmail.com>
Tue, 1 Oct 2013 13:35:41 +0000 (10:35 -0300)
committerBrian Fraser <fraserbn@gmail.com>
Wed, 22 Jan 2014 19:33:06 +0000 (16:33 -0300)
This was done because, currently, the test fails when cross-compiling
perl, but run/fresh_perl.t can't use Config to check if we're cross-
compiling.

t/op/glob.t
t/run/fresh_perl.t

index 8ad827e..e6f3680 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     require 'test.pl';
 }
 
-plan( tests => 17 );
+plan( tests => 18 );
 
 @oops = @ops = <op/*>;
 
@@ -110,3 +110,37 @@ SKIP: {
     eval 'CORE::glob("0")';
     ok !$called, 'CORE::glob bypasses overrides';
 }
+
+######## glob() bug Mon, 01 Sep 2003 02:25:41 -0700 <200309010925.h819Pf0X011457@smtp3.ActiveState.com>
+
+SKIP: {
+    use Config;
+    skip("glob() works when cross-compiling, but this test doesn't", 1)
+        if $Config{usecrosscompile};
+
+    my $switches = [qw(-lw)];
+    my $expected = "ok1\nok2\n";
+    my $name     = "Make sure the presence of the CORE::GLOBAL::glob typeglob does not affect whether File::Glob::csh_glob is called.";
+
+    fresh_perl_is(<<'EOP', $expected, { switches => $switches }, $name);
+    if ($^O eq 'VMS') {
+        # A pattern with a double quote in it is a syntax error to LIB$FIND_FILE
+        # Should we strip quotes in Perl_vms_start_glob the way csh_glob() does?
+        print "ok1\nok2\n";
+    }
+    else {
+        ++$INC{"File/Glob.pm"}; # prevent it from loading
+        my $called1 = 0;
+        my $called2 = 0;
+        *File::Glob::csh_glob = sub { ++$called1 };
+        my $output1 = eval q{ glob(q(./"TEST")) };
+        undef *CORE::GLOBAL::glob; # but leave the typeglob itself there
+        ++$CORE::GLOBAL::glob if 0; # "used only once"
+        undef *File::Glob::csh_glob; # avoid redefinition warnings
+        *File::Glob::csh_glob = sub { ++$called2 };
+        my $output2 = eval q{ glob(q(./"TEST")) };
+        print "ok1" if $called1 eq $called2;
+        print "ok2" if $output1 eq $output2;
+    }
+EOP
+}
\ No newline at end of file
index 7f90cd3..885c8cc 100644 (file)
@@ -757,32 +757,6 @@ It's good! >A< >B<
 $_="foo";utf8::upgrade($_);/bar/i,warn$_;
 EXPECT
 foo at - line 1.
-######## glob() bug Mon, 01 Sep 2003 02:25:41 -0700 <200309010925.h819Pf0X011457@smtp3.ActiveState.com>
--lw
-# Make sure the presence of the CORE::GLOBAL::glob typeglob does not affect
-# whether File::Glob::csh_glob is called.
-if ($^O eq 'VMS') {
-    # A pattern with a double quote in it is a syntax error to LIB$FIND_FILE
-    # Should we strip quotes in Perl_vms_start_glob the way csh_glob() does?
-    print "ok1\nok2\n";
-}
-else {
-    ++$INC{"File/Glob.pm"}; # prevent it from loading
-    my $called1 =
-    my $called2 = 0;
-    *File::Glob::csh_glob = sub { ++$called1 };
-    my $output1 = eval q{ glob(q(./"TEST")) };
-    undef *CORE::GLOBAL::glob; # but leave the typeglob itself there
-    ++$CORE::GLOBAL::glob if 0; # "used only once"
-    undef *File::Glob::csh_glob; # avoid redefinition warnings
-    *File::Glob::csh_glob = sub { ++$called2 };
-    my $output2 = eval q{ glob(q(./"TEST")) };
-    print "ok1" if $called1 eq $called2;
-    print "ok2" if $output1 eq $output2;
-}
-EXPECT
-ok1
-ok2
 ######## "#75146: 27e904532594b7fb (fix for #23810) introduces a #regression"
 use strict;