Give up on automake's built-in rules for generating PDF and HTML and use our own.
[gnu-stow.git] / t / join_paths.t
blob585cae907b6f9d28fdd4f68cdd5b0264300b5454
1 #!/usr/local/bin/perl
4 # Testing join_paths();
7 use strict;
8 use warnings;
10 use Stow::Util qw(join_paths);
12 use Test::More tests => 14;
14 is(
15 join_paths('a/b/c', 'd/e/f'),
16 'a/b/c/d/e/f'
17 => 'simple'
20 is(
21 join_paths('/a/b/c', '/d/e/f'),
22 '/a/b/c/d/e/f'
23 => 'leading /'
26 is(
27 join_paths('/a/b/c/', '/d/e/f/'),
28 '/a/b/c/d/e/f'
29 => 'trailing /'
32 is(
33 join_paths('///a/b///c//', '/d///////e/f'),
34 '/a/b/c/d/e/f'
35 => 'mltiple /\'s'
38 is(
39 join_paths('', 'a/b/c'),
40 'a/b/c'
41 => 'first empty'
44 is(
45 join_paths('a/b/c', ''),
46 'a/b/c'
47 => 'second empty'
50 is(
51 join_paths('/', 'a/b/c'),
52 '/a/b/c'
53 => 'first is /'
56 is(
57 join_paths('a/b/c', '/'),
58 'a/b/c'
59 => 'second is /'
62 is(
63 join_paths('///a/b///c//', '/d///////e/f'),
64 '/a/b/c/d/e/f'
65 => 'multiple /\'s'
69 is(
70 join_paths('../a1/b1/../c1/', '/a2/../b2/e2'),
71 '../a1/c1/b2/e2'
72 => 'simple deref ".."'
75 is(
76 join_paths('../a1/b1/../c1/d1/e1', '../a2/../b2/c2/d2/../e2'),
77 '../a1/c1/d1/b2/c2/e2'
78 => 'complex deref ".."'
81 is(
82 join_paths('../a1/../../c1', 'a2/../../'),
83 '../..'
84 => 'too many ".."'
87 is(
88 join_paths('./a1', '../../a2'),
89 '../a2'
90 => 'drop any "./"'
93 is(
94 join_paths('a/b/c', '.'),
95 'a/b/c'
96 => '. on RHS'