This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline
[perl5.git] / t / lib / filespec.t
index 3d2952c..c6d155f 100755 (executable)
@@ -3,7 +3,7 @@
 BEGIN {
     $^O = '';
     chdir 't' if -d 't';
-    unshift @INC, '../lib';
+    @INC = '../lib';
 }
 
 # Each element in this array is a single test. Storing them this way makes
@@ -208,7 +208,6 @@ BEGIN {
 [ "VMS->canonpath('volume:[d1]file')",                     'volume:[d1]file'         ],
 [ "VMS->canonpath('volume:[d1.-.d2.][d3.d4.-]')",              'volume:[d2.d3]'          ],
 [ "VMS->canonpath('volume:[000000.d1]d2.dir;1')",                 'volume:[d1]d2.dir;1'   ],
-[ "VMS->canonpath('///../../..//./././a//b/.././c/././')", '/a/b/../c'               ],
 
 [ "VMS->splitdir('')",            ''          ],
 [ "VMS->splitdir('[]')",          ''          ],
@@ -305,14 +304,17 @@ eval {
    require VMS::Filespec ;
 } ;
 
+my $skip_exception = "Install VMS::Filespec (from vms/ext)" ;
+
 if ( $@ ) {
    # Not pretty, but it allows testing of things not implemented soley
    # on VMS.  It might be better to change File::Spec::VMS to do this,
    # making it more usable when running on (say) Unix but working with
    # VMS paths.
    eval qq-
-      sub File::Spec::VMS::unixify { die "Install VMS::Filespec (from vms/ext)" } ;
-      sub File::Spec::VMS::vmspath { die "Install VMS::Filespec (from vms/ext)" } ;
+      sub File::Spec::VMS::vmsify  { die "$skip_exception" }
+      sub File::Spec::VMS::unixify { die "$skip_exception" }
+      sub File::Spec::VMS::vmspath { die "$skip_exception" }
    - ;
    $INC{"VMS/Filespec.pm"} = 1 ;
 }
@@ -339,6 +341,13 @@ for ( @tests ) {
 sub tryfunc {
     my $function = shift ;
     my $expected = shift ;
+    my $platform = shift ;
+
+    if ($platform && $^O ne $platform) {
+       print "ok $current_test # skipped: $function\n" ;
+       ++$current_test ;
+       return;
+    }
 
     $function =~ s#\\#\\\\#g ;
 
@@ -351,8 +360,9 @@ sub tryfunc {
     }
 
     if ( $@ ) {
-       if ( $@ =~ /only provided on VMS/ ) {
-           print "ok $current_test # skip $function \n" ;
+        if ( substr( $@, 0, length $skip_exception ) eq $skip_exception ) {
+           chomp $@ ;
+           print "ok $current_test # skip $function: $@\n" ;
        }
        else {
            chomp $@ ;