In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/ab08a362aba1ac5dacd58ee13d77e9faf693e7e3?hp=4fc9fd8514039ccad8810c8af6113cbe93d4df19>

- Log -----------------------------------------------------------------
commit ab08a362aba1ac5dacd58ee13d77e9faf693e7e3
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 20:36:33 2011 +0000

    Move the tests for split /\s/ and Unicode from split.t to split_unicode.t
    
    Skip split_unicode.t under minitest, as it uses charnames, which uses
    File::Spec, which may not be available.
    
    [Experimentation reveals that git blame by default won't attribute lines 
past
    this commit, unless --find-copies-harder is used. The alternative approach,
    copy t/op/split.t as t/op/split_unicode.t as 1 commit, then prune both, 
fares
    no better - by default git blame can't attribute through that *either*.
    Again, --find-copies-harder works. Hence, do the partition as this one 
commit,
    as it is simpler, and all other things are equal]

M       MANIFEST
M       t/op/split.t
A       t/op/split_unicode.t

commit cedc31d0900eea3a62ab0e324927251011d4b832
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 18:59:52 2011 +0000

    Move t/re/re.t to ext/re/t/re_funcs_u.t, so that it is not part of minitest.
    
    The test file is for functions in the re:: namespace implemented in
    universal.c, but needs to load re, which isn't built for minitest. As none 
of
    these functions are used as part of the core's build process, seems best to
    move it with all the other tests related to the re extension.

M       MANIFEST
A       ext/re/t/re_funcs_u.t
D       t/re/re.t

commit 563ff921d7b97889a3a611987ca6f2f250c5b876
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 18:15:43 2011 +0000

    Ensure t/op/stat.t passes under minitest if File::Spec is unavailable.
    
    require File::Spec in an eval. For miniperl, if the eval fails, skip tests
    relating to File::Spec->devnull() and needing File::Spec->rel2abs(), and 
assume
    that '.' will work as the current directory. Remove a call to catfile() only
    needed for MacOS Classic - every other platform will accept Unix-style 
paths.

M       t/op/stat.t

commit 94af928955a63fcd4496a7acdd670b5237b2a3eb
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 17:58:26 2011 +0000

    Ensure t/op/mkdir.t passes under minitest by loading File::Path in an eval.
    
    File::Path::rmtree() is only used as a cleanup function of last resort - by
    default t/op/mkdir.t directly cleans up the test directory that it creates
    before it exits.

M       t/op/mkdir.t

commit 79c67e3326f78c5970f69cc0b31a35619eb41e9a
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 17:50:36 2011 +0000

    Ensure that chdir.t can find File::Spec and Cwd under minitest
    
    As a working chdir is a key part of the build process, it would be counter-
    productive to skip testing it if the build process failed, because it might 
be
    cause of the problems. So add the source locations for Cwd and File::Spec in
    dist/Cwd and dist/Cwd/lib respectively.

M       t/op/chdir.t

commit 8594e3bf75762cb96215c73368f7f03d2f42485c
Author: Nicholas Clark <[email protected]>
Date:   Sun Mar 6 17:38:36 2011 +0000

    Under minitest, tests requiring File::Spec->devnull(), as it may not be 
built.
    
    Although File::Spec is pure Perl, it is part of the Cwd distribution, and
    that isn't built for minitest. So we can't rely on it.

M       t/io/argv.t
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                           |    3 +-
 t/re/re.t => ext/re/t/re_funcs_u.t |    9 +++--
 t/io/argv.t                        |   59 +++++++++++++++++++-------------
 t/op/chdir.t                       |    9 ++++-
 t/op/mkdir.t                       |   11 +++++-
 t/op/split.t                       |   58 +--------------------------------
 t/op/split_unicode.t               |   64 ++++++++++++++++++++++++++++++++++++
 t/op/stat.t                        |   24 +++++++++----
 8 files changed, 140 insertions(+), 97 deletions(-)
 rename t/re/re.t => ext/re/t/re_funcs_u.t (95%)
 create mode 100644 t/op/split_unicode.t

diff --git a/MANIFEST b/MANIFEST
index 5e114a1..1bd14f5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3546,6 +3546,7 @@ ext/re/t/lexical_debug.t  test that lexical re 'debug' 
works
 ext/re/t/qr.t                  test that qr// is a Regexp
 ext/re/t/reflags.t             see if re '/xism' pragma works
 ext/re/t/re_funcs.t            See if exportable 're' funcs in re.xs work
+ext/re/t/re_funcs_u.t          See if exportable 're' funcs in universal.c work
 ext/re/t/regop.pl              generate debug output for various patterns
 ext/re/t/regop.t               test RE optimizations by scraping debug output
 ext/re/t/re.t                  see if re pragma works
@@ -4949,6 +4950,7 @@ t/op/smartmatch.t         See if the ~~ operator works
 t/op/sort.t                    See if sort works
 t/op/splice.t                  See if splice works
 t/op/split.t                   See if split works
+t/op/split_unicode.t           Test split /\s/ and Unicode
 t/op/sprintf2.t                        See if sprintf works
 t/op/sprintf.t                 See if sprintf works
 t/op/srand.t                   See if srand works
@@ -5050,7 +5052,6 @@ t/re/reg_nc_tie.t         Test the tied methods of 
Tie::Hash::NamedCapture
 t/re/reg_pmod.t                        See if regexp /p modifier works as 
expected
 t/re/reg_posixcc.t             See if posix character classes behave 
consistently
 t/re/reg_unsafe.t              Check for unsafe match vars
-t/re/re.t                      See if exportable 're' funcs in universal.c work
 t/re/re_tests                  Regular expressions for regexp.t
 t/re/rxcode.t                  See if /(?{ code })/ works
 t/re/subst_amp.t               See if $&-related substitution works
diff --git a/t/re/re.t b/ext/re/t/re_funcs_u.t
similarity index 95%
rename from t/re/re.t
rename to ext/re/t/re_funcs_u.t
index 8dd6fc4..dcb35e1 100644
--- a/t/re/re.t
+++ b/ext/re/t/re_funcs_u.t
@@ -1,9 +1,12 @@
 #!./perl
 
 BEGIN {
-    chdir 't' if -d 't';
-    @INC = '../lib';
-    require './test.pl';
+    require Config;
+    if (($Config::Config{'extensions'} !~ /\bre\b/) ){
+       print "1..0 # Skip -- Perl configured without re module\n";
+           exit 0;
+    }
+    require 'test.pl'; # For watchdog
 }
 
 use strict;
diff --git a/t/io/argv.t b/t/io/argv.t
index 8356938..95e962d 100644
--- a/t/io/argv.t
+++ b/t/io/argv.t
@@ -9,9 +9,14 @@ BEGIN { require "./test.pl"; }
 
 plan(tests => 23);
 
-use File::Spec;
+my ($devnull, $no_devnull);
 
-my $devnull = File::Spec->devnull;
+if (is_miniperl()) {
+    $no_devnull = "no dynamic loading on miniperl, File::Spec not built, so 
can't determine /dev/null";
+} else {
+    require File::Spec;
+    $devnull = File::Spec->devnull;
+}
 
 open(TRY, '>Io_argv1.tmp') || (die "Can't open temp file: $!");
 print TRY "a line\n";
@@ -45,7 +50,8 @@ is($x, "1a line\n2a line\n", '<> from two files');
     is( 0+$?, 0, q(eof() doesn't segfault) );
 }
 
-@ARGV = ('Io_argv1.tmp', 'Io_argv1.tmp', $devnull, 'Io_argv1.tmp');
+@ARGV = is_miniperl() ? ('Io_argv1.tmp', 'Io_argv1.tmp', 'Io_argv1.tmp')
+    : ('Io_argv1.tmp', 'Io_argv1.tmp', $devnull, 'Io_argv1.tmp');
 while (<>) {
     $y .= $. . $_;
     if (eof()) {
@@ -90,35 +96,40 @@ ok( !eof(),     'STDIN has something' );
 
 is( <>, "ok 7\n" );
 
-open STDIN, $devnull or die $!;
-@ARGV = ();
-ok( eof(),      'eof() true with empty @ARGV' );
+SKIP: {
+    skip_if_miniperl($no_devnull, 4);
+    open STDIN, $devnull or die $!;
+    @ARGV = ();
+    ok( eof(),      'eof() true with empty @ARGV' );
 
-@ARGV = ('Io_argv1.tmp');
-ok( !eof() );
+    @ARGV = ('Io_argv1.tmp');
+    ok( !eof() );
 
-@ARGV = ($devnull, $devnull);
-ok( !eof() );
+    @ARGV = ($devnull, $devnull);
+    ok( !eof() );
 
-close ARGV or die $!;
-ok( eof(),      'eof() true after closing ARGV' );
+    close ARGV or die $!;
+    ok( eof(),      'eof() true after closing ARGV' );
+}
 
-{
+SKIP: {
     local $/;
-    open F, 'Io_argv1.tmp' or die "Could not open Io_argv1.tmp: $!";
-    <F>;       # set $. = 1
-    is( <F>, undef );
+    open my $fh, 'Io_argv1.tmp' or die "Could not open Io_argv1.tmp: $!";
+    <$fh>;     # set $. = 1
+    is( <$fh>, undef );
+
+    skip_if_miniperl($no_devnull, 5);
 
-    open F, $devnull or die;
-    ok( defined(<F>) );
+    open $fh, $devnull or die;
+    ok( defined(<$fh>) );
 
-    is( <F>, undef );
-    is( <F>, undef );
+    is( <$fh>, undef );
+    is( <$fh>, undef );
 
-    open F, $devnull or die;   # restart cycle again
-    ok( defined(<F>) );
-    is( <F>, undef );
-    close F or die "Could not close: $!";
+    open $fh, $devnull or die; # restart cycle again
+    ok( defined(<$fh>) );
+    is( <$fh>, undef );
+    close $fh or die "Could not close: $!";
 }
 
 # This used to dump core
diff --git a/t/op/chdir.t b/t/op/chdir.t
index a0c60bf..2c6535b 100644
--- a/t/op/chdir.t
+++ b/t/op/chdir.t
@@ -5,11 +5,16 @@ BEGIN {
     # chdir() works!  Instead, we'll hedge our bets and put both
     # possibilities into @INC.
     @INC = qw(t . lib ../lib);
+    require "test.pl";
+    # Really want to know if chdir is working, as the build process will all go
+    # wrong if it is not.
+    if (is_miniperl() && !eval {require File::Spec::Functions; 1}) {
+       push @INC, qw(dist/Cwd/lib dist/Cwd ../dist/Cwd/lib ../dist/Cwd);
+    }
+    plan(tests => 48);
 }
 
 use Config;
-require "test.pl";
-plan(tests => 48);
 
 my $IsVMS   = $^O eq 'VMS';
 
diff --git a/t/op/mkdir.t b/t/op/mkdir.t
index 0ad5dac..ebbbd2e 100644
--- a/t/op/mkdir.t
+++ b/t/op/mkdir.t
@@ -8,8 +8,15 @@ BEGIN {
 
 plan tests => 22;
 
-use File::Path;
-rmtree('blurfl');
+unless (eval {
+    require File::Path;
+    File::Path::rmtree('blurfl');
+    1
+}) {
+    diag("$0 may fail if its temporary directory remains from a previous run");
+    diag("Attempted to load File::Path to delete directory t/blurfl - error 
was\n$@");
+    diag("\nIf you have problems, please manually delete t/blurfl");
+}    
 
 # tests 3 and 7 rather naughtily expect English error messages
 $ENV{'LC_ALL'} = 'C';
diff --git a/t/op/split.t b/t/op/split.t
index c667a3d..6903503 100644
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan tests => 252;
+plan tests => 102;
 
 $FS = ':';
 
@@ -388,62 +388,6 @@ is($cnt, scalar(@ary));
     $x = \$a[2];
     is (ref $x, 'SCALAR', '#28938 - garbage after extend');
 }
-{
-    # check the special casing of split /\s/ and unicode
-    use charnames qw(:full);
-    # below test data is extracted from
-    # PropList-5.0.0.txt
-    # Date: 2006-06-07, 23:22:52 GMT [MD]
-    #
-    # Unicode Character Database
-    # Copyright (c) 1991-2006 Unicode, Inc.
-    # For terms of use, see http://www.unicode.org/terms_of_use.html
-    # For documentation, see UCD.html
-    my @spaces=(
-       ord("\t"),      # Cc       <control-0009>
-       ord("\n"),      # Cc       <control-000A>
-       # not PerlSpace # Cc       <control-000B>
-       ord("\f"),      # Cc       <control-000C>
-       ord("\r"),      # Cc       <control-000D>
-       ord(" "),       # Zs       SPACE
-       ord("\N{NEL}"), # Cc       <control-0085>
-       ord("\N{NO-BREAK SPACE}"),
-                       # Zs       NO-BREAK SPACE
-        0x1680,         # Zs       OGHAM SPACE MARK
-        0x180E,         # Zs       MONGOLIAN VOWEL SEPARATOR
-        0x2000..0x200A, # Zs  [11] EN QUAD..HAIR SPACE
-        0x2028,         # Zl       LINE SEPARATOR
-        0x2029,         # Zp       PARAGRAPH SEPARATOR
-        0x202F,         # Zs       NARROW NO-BREAK SPACE
-        0x205F,         # Zs       MEDIUM MATHEMATICAL SPACE
-        0x3000          # Zs       IDEOGRAPHIC SPACE
-    );
-    #diag "Have @{[0+@spaces]} to test\n";
-    foreach my $cp (@spaces) {
-       my $msg = sprintf "Space: U+%04x", $cp;
-        my $space = chr($cp);
-        my $str="A:$space:B\x{FFFD}";
-        chop $str;
-
-        my @res=split(/\s+/,$str);
-        my $cnt=split(/\s+/,$str);
-        ok(@res == 2 && join('-',@res) eq "A:-:B", "$msg - /\\s+/");
-       is($cnt, scalar(@res), "$msg - /\\s+/ (count)");
-
-        my $s2 = "$space$space:A:$space$space:B\x{FFFD}";
-        chop $s2;
-
-        my @r2 = split(' ',$s2);
-       my $c2 = split(' ',$s2);
-        ok(@r2 == 2 && join('-', @r2) eq ":A:-:B",  "$msg - ' '");
-       is($c2, scalar(@r2), "$msg - ' ' (count)");
-
-        my @r3 = split(/\s+/, $s2);
-        my $c3 = split(/\s+/, $s2);
-        ok(@r3 == 3 && join('-', @r3) eq "-:A:-:B", "$msg - /\\s+/ No.2");
-       is($c3, scalar(@r3), "$msg - /\\s+/ No.2 (count)");
-    }
-}
 
 {
     my $src = "ABC \0 FOO \0  XYZ";
diff --git a/t/op/split_unicode.t b/t/op/split_unicode.t
new file mode 100644
index 0000000..85ba4d3
--- /dev/null
+++ b/t/op/split_unicode.t
@@ -0,0 +1,64 @@
+#!./perl
+
+BEGIN {
+    require './test.pl';
+    skip_all_if_miniperl("no dynamic loading on miniperl, no File::Spec (used 
by charnames)");
+    plan(tests => 150);
+}
+
+{
+    # check the special casing of split /\s/ and unicode
+    use charnames qw(:full);
+    # below test data is extracted from
+    # PropList-5.0.0.txt
+    # Date: 2006-06-07, 23:22:52 GMT [MD]
+    #
+    # Unicode Character Database
+    # Copyright (c) 1991-2006 Unicode, Inc.
+    # For terms of use, see http://www.unicode.org/terms_of_use.html
+    # For documentation, see UCD.html
+    my @spaces=(
+       ord("\t"),      # Cc       <control-0009>
+       ord("\n"),      # Cc       <control-000A>
+       # not PerlSpace # Cc       <control-000B>
+       ord("\f"),      # Cc       <control-000C>
+       ord("\r"),      # Cc       <control-000D>
+       ord(" "),       # Zs       SPACE
+       ord("\N{NEL}"), # Cc       <control-0085>
+       ord("\N{NO-BREAK SPACE}"),
+                       # Zs       NO-BREAK SPACE
+        0x1680,         # Zs       OGHAM SPACE MARK
+        0x180E,         # Zs       MONGOLIAN VOWEL SEPARATOR
+        0x2000..0x200A, # Zs  [11] EN QUAD..HAIR SPACE
+        0x2028,         # Zl       LINE SEPARATOR
+        0x2029,         # Zp       PARAGRAPH SEPARATOR
+        0x202F,         # Zs       NARROW NO-BREAK SPACE
+        0x205F,         # Zs       MEDIUM MATHEMATICAL SPACE
+        0x3000          # Zs       IDEOGRAPHIC SPACE
+    );
+    #diag "Have @{[0+@spaces]} to test\n";
+    foreach my $cp (@spaces) {
+       my $msg = sprintf "Space: U+%04x", $cp;
+        my $space = chr($cp);
+        my $str="A:$space:B\x{FFFD}";
+        chop $str;
+
+        my @res=split(/\s+/,$str);
+        my $cnt=split(/\s+/,$str);
+        ok(@res == 2 && join('-',@res) eq "A:-:B", "$msg - /\\s+/");
+       is($cnt, scalar(@res), "$msg - /\\s+/ (count)");
+
+        my $s2 = "$space$space:A:$space$space:B\x{FFFD}";
+        chop $s2;
+
+        my @r2 = split(' ',$s2);
+       my $c2 = split(' ',$s2);
+        ok(@r2 == 2 && join('-', @r2) eq ":A:-:B",  "$msg - ' '");
+       is($c2, scalar(@r2), "$msg - ' ' (count)");
+
+        my @r3 = split(/\s+/, $s2);
+        my $c3 = split(/\s+/, $s2);
+        ok(@r3 == 3 && join('-', @r3) eq "-:A:-:B", "$msg - /\\s+/ No.2");
+       is($c3, scalar(@r3), "$msg - /\\s+/ No.2 (count)");
+    }
+}
diff --git a/t/op/stat.t b/t/op/stat.t
index 583191c..1808ee4 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -7,7 +7,18 @@ BEGIN {
 }
 
 use Config;
-use File::Spec;
+
+my ($Null, $Curdir);
+if(eval {require File::Spec; 1}) {
+    $Null = File::Spec->devnull;
+    $Curdir = File::Spec->curdir;
+} else {
+    die $@ unless is_miniperl();
+    $Curdir = '.';
+    diag("miniperl failed to load File::Spec, error is:\n$@");
+    diag("\ncontinuing, assuming '.' for current directory. Some tests will be 
skipped.");
+}
+
 
 plan tests => 107;
 
@@ -39,9 +50,6 @@ if ($Is_Cygwin) {
 my($DEV, $INO, $MODE, $NLINK, $UID, $GID, $RDEV, $SIZE,
    $ATIME, $MTIME, $CTIME, $BLKSIZE, $BLOCKS) = (0..12);
 
-my $Curdir = File::Spec->curdir;
-
-
 my $tmpfile = tempfile();
 my $tmpfile_link = tempfile();
 
@@ -105,6 +113,7 @@ SKIP: {
     }
 
     SKIP: {
+       skip_if_miniperl("File::Spec not built for minitest", 2);
         my $cwd = File::Spec->rel2abs($Curdir);
         skip "Solaris tmpfs has different mtime/ctime link semantics", 2
                                      if $Is_Solaris and $cwd =~ m#^/tmp# and
@@ -201,8 +210,8 @@ ok(  -f $tmpfile,   '   -f');
 ok(! -d $tmpfile,   '   !-d');
 
 # Is this portable?
-ok(  -d $Curdir,          '-d cwd' );
-ok(! -f $Curdir,          '!-f cwd' );
+ok(  -d '.',          '-d cwd' );
+ok(! -f '.',          '!-f cwd' );
 
 
 SKIP: {
@@ -352,7 +361,6 @@ SKIP: {
     }
 }
 
-my $Null = File::Spec->devnull;
 SKIP: {
     skip "No null device to test with", 1 unless -e $Null;
     skip "We know Win32 thinks '$Null' is a TTY", 1 if $Is_MSWin32;
@@ -364,7 +372,7 @@ SKIP: {
 
 
 # These aren't strictly "stat" calls, but so what?
-my $statfile = File::Spec->catfile($Curdir, 'op', 'stat.t');
+my $statfile = './op/stat.t';
 ok(  -T $statfile,    '-T');
 ok(! -B $statfile,    '!-B');
 

--
Perl5 Master Repository

Reply via email to