1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!perl
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl relative.t'
use strict;
use warnings;
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 3;
BEGIN { use_ok('File::Spec::Link') }
#########################
is(
File::Spec->canonpath(
File::Spec::Link->relative_to_file(
File::Spec->catfile(qw(dir foo.ext)),
File::Spec->catfile(qw(dir1 dir2 bar.xyz))
)
),
File::Spec->canonpath( File::Spec->catfile(qw(dir1 dir2 dir foo.ext)) ),
"relative_to_file(dir/foo.ext,dir1/dir2/bar.xyz)"
);
my $path = File::Spec->catfile( File::Spec->rootdir, qw(dir foo.ext) );
is(
File::Spec->canonpath(
File::Spec::Link->relative_to_file(
$path, File::Spec->catfile(qw(dir1 dir2 bar.xyz))
)
),
File::Spec->canonpath($path),
"relative_to_file(/dir/foo.ext,dir1/dir2/bar.xyz)"
);
# $Id$
|