Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki] / t / file_pruned.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 27;
5
6 BEGIN { use_ok("IkiWiki"); }
7
8 %config=IkiWiki::defaultconfig();
9
10 ok(IkiWiki::file_pruned(".htaccess"));
11 ok(IkiWiki::file_pruned(".ikiwiki/"));
12 ok(IkiWiki::file_pruned(".ikiwiki/index"));
13 ok(IkiWiki::file_pruned("CVS/foo"));
14 ok(IkiWiki::file_pruned("subdir/CVS/foo"));
15 ok(IkiWiki::file_pruned(".svn"));
16 ok(IkiWiki::file_pruned("subdir/.svn"));
17 ok(IkiWiki::file_pruned("subdir/.svn/foo"));
18 ok(IkiWiki::file_pruned(".git"));
19 ok(IkiWiki::file_pruned("subdir/.git"));
20 ok(IkiWiki::file_pruned("subdir/.git/foo"));
21 ok(! IkiWiki::file_pruned("svn/fo"));
22 ok(! IkiWiki::file_pruned("git"));
23 ok(! IkiWiki::file_pruned("index.mdwn"));
24 ok(! IkiWiki::file_pruned("index."));
25 ok(IkiWiki::file_pruned("."));
26 ok(IkiWiki::file_pruned("./"));
27
28 # absolute filenames are not allowed.
29 ok(IkiWiki::file_pruned("/etc/passwd"));
30 ok(IkiWiki::file_pruned("//etc/passwd"));
31 ok(IkiWiki::file_pruned("/"));
32 ok(IkiWiki::file_pruned("//"));
33 ok(IkiWiki::file_pruned("///"));
34
35
36 ok(IkiWiki::file_pruned(".."));
37 ok(IkiWiki::file_pruned("../"));
38
39 ok(IkiWiki::file_pruned("y/foo.dpkg-tmp"));
40 ok(IkiWiki::file_pruned("y/foo.ikiwiki-new"));