stow/t/parent.t
2009-04-12 20:38:34 -07:00

41 lines
464 B
Perl

#!/usr/local/bin/perl
#
# Testing parent()
#
# load as a library
BEGIN { use lib qw(. ..); require "stow"; }
use Test::More tests => 5;
is(
parent('a/b/c'),
'a/b',
=> 'no leading or trailing /'
);
is(
parent('/a/b/c'),
'/a/b',
=> 'leading /'
);
is(
parent('a/b/c/'),
'a/b',
=> 'trailing /'
);
is(
parent('/////a///b///c///'),
'/a/b',
=> 'multiple /'
);
is (
parent('a'),
''
=> 'empty parent'
);