]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/file_pruned.t
Add a simple unit test for [[!toc]]
[git.ikiwiki.info.git] / t / file_pruned.t
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(".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("./"));
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("///"));
36 ok(IkiWiki::file_pruned(".."));
37 ok(IkiWiki::file_pruned("../"));
39 ok(IkiWiki::file_pruned("y/foo.dpkg-tmp"));
40 ok(IkiWiki::file_pruned("y/foo.ikiwiki-new"));