stow/t/parent.t

44 lines
450 B
Perl
Raw Permalink Normal View History

#!/usr/local/bin/perl
#
# Testing parent()
#
use strict;
use warnings;
use Stow::Util qw(parent);
use Test::More tests => 5;
is(
parent('a/b/c'),
2011-11-22 09:29:42 -05:00
'a/b'
=> 'no leading or trailing /'
);
is(
parent('/a/b/c'),
2011-11-22 09:29:42 -05:00
'/a/b'
=> 'leading /'
);
is(
parent('a/b/c/'),
2011-11-22 09:29:42 -05:00
'a/b'
=> 'trailing /'
);
is(
parent('/////a///b///c///'),
2011-11-22 09:29:42 -05:00
'/a/b'
=> 'multiple /'
);
is (
parent('a'),
''
=> 'empty parent'
);