2007-12-18 06:38:06 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2010-04-20 20:08:29 +02:00
|
|
|
use Test::More tests => 27;
|
2007-12-18 06:38:06 +01:00
|
|
|
|
|
|
|
BEGIN { use_ok("IkiWiki"); }
|
|
|
|
|
|
|
|
%config=IkiWiki::defaultconfig();
|
|
|
|
|
2010-04-18 01:05:40 +02:00
|
|
|
ok(IkiWiki::file_pruned(".htaccess"));
|
|
|
|
ok(IkiWiki::file_pruned(".ikiwiki/"));
|
|
|
|
ok(IkiWiki::file_pruned(".ikiwiki/index"));
|
|
|
|
ok(IkiWiki::file_pruned("CVS/foo"));
|
|
|
|
ok(IkiWiki::file_pruned("subdir/CVS/foo"));
|
|
|
|
ok(IkiWiki::file_pruned(".svn"));
|
|
|
|
ok(IkiWiki::file_pruned("subdir/.svn"));
|
|
|
|
ok(IkiWiki::file_pruned("subdir/.svn/foo"));
|
|
|
|
ok(IkiWiki::file_pruned(".git"));
|
|
|
|
ok(IkiWiki::file_pruned("subdir/.git"));
|
|
|
|
ok(IkiWiki::file_pruned("subdir/.git/foo"));
|
|
|
|
ok(! IkiWiki::file_pruned("svn/fo"));
|
|
|
|
ok(! IkiWiki::file_pruned("git"));
|
|
|
|
ok(! IkiWiki::file_pruned("index.mdwn"));
|
|
|
|
ok(! IkiWiki::file_pruned("index."));
|
|
|
|
ok(IkiWiki::file_pruned("."));
|
|
|
|
ok(IkiWiki::file_pruned("./"));
|
|
|
|
|
2010-04-20 20:08:29 +02:00
|
|
|
# absolute filenames are not allowed.
|
2010-04-18 01:05:40 +02:00
|
|
|
ok(IkiWiki::file_pruned("/etc/passwd"));
|
|
|
|
ok(IkiWiki::file_pruned("//etc/passwd"));
|
|
|
|
ok(IkiWiki::file_pruned("/"));
|
|
|
|
ok(IkiWiki::file_pruned("//"));
|
|
|
|
ok(IkiWiki::file_pruned("///"));
|
|
|
|
|
2007-12-18 06:38:06 +01:00
|
|
|
|
2010-04-18 01:05:40 +02:00
|
|
|
ok(IkiWiki::file_pruned(".."));
|
|
|
|
ok(IkiWiki::file_pruned("../"));
|
2007-12-18 06:38:06 +01:00
|
|
|
|
2010-04-18 01:05:40 +02:00
|
|
|
ok(IkiWiki::file_pruned("y/foo.dpkg-tmp"));
|
|
|
|
ok(IkiWiki::file_pruned("y/foo.ikiwiki-new"));
|