(no commit message)
[ikiwiki.git] / t / file_pruned.t
blobf9c1c257e75d4775b3e850f16a08b1e6c2181a1b
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 27;
6 BEGIN { use_ok("IkiWiki"); }
8 %config=IkiWiki::defaultconfig();
10 ok(IkiWiki::file_pruned("src/.htaccess", "src"));
11 ok(IkiWiki::file_pruned("src/.ikiwiki/", "src"));
12 ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src"));
13 ok(IkiWiki::file_pruned("src/CVS/foo", "src"));
14 ok(IkiWiki::file_pruned("src/subdir/CVS/foo", "src"));
15 ok(IkiWiki::file_pruned("src/.svn", "src"));
16 ok(IkiWiki::file_pruned("src/subdir/.svn", "src"));
17 ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src"));
18 ok(IkiWiki::file_pruned("src/.git", "src"));
19 ok(IkiWiki::file_pruned("src/subdir/.git", "src"));
20 ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src"));
21 ok(! IkiWiki::file_pruned("src/svn/fo", "src"));
22 ok(! IkiWiki::file_pruned("src/git", "src"));
23 ok(! IkiWiki::file_pruned("src/index.mdwn", "src"));
24 ok(! IkiWiki::file_pruned("src/index.", "src"));
26 # these are ok because while the filename starts with ".", the canonpathed
27 # version does not
28 ok(! IkiWiki::file_pruned("src/.", "src"));
29 ok(! IkiWiki::file_pruned("src/./", "src"));
31 ok(IkiWiki::file_pruned("src/..", "src"));
32 ok(IkiWiki::file_pruned("src/../", "src"));
33 ok(IkiWiki::file_pruned("src/../", "src"));
35 ok(! IkiWiki::file_pruned("src", "src"));
36 ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src"));
37 ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src"));
38 ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn"));
40 ok(IkiWiki::file_pruned("x/y/foo.dpkg-tmp", "src"));
41 ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src"));