Bump version to 2.4.0
[gnu-stow.git] / t / parent.t
blob1fae871d703f78ca291350dfbcbfdd2453737b77
1 #!/usr/bin/perl
3 # This file is part of GNU Stow.
5 # GNU Stow is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # GNU Stow is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see https://www.gnu.org/licenses/.
19 # Testing parent()
22 use strict;
23 use warnings;
25 use Stow::Util qw(parent);
27 use Test::More tests => 5;
29 is(
30 parent('a/b/c'),
31 'a/b'
32 => 'no leading or trailing /'
35 is(
36 parent('/a/b/c'),
37 '/a/b'
38 => 'leading /'
41 is(
42 parent('a/b/c/'),
43 'a/b'
44 => 'trailing /'
47 is(
48 parent('/////a///b///c///'),
49 '/a/b'
50 => 'multiple /'
53 is (
54 parent('a'),
56 => 'empty parent'