X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/b94c1ccd552f70b8ecce8f414563b4c6b6385e08..0cd67c515fad03797fa7792c10b507a0abb77c28:/t/file_pruned.t?ds=sidebyside diff --git a/t/file_pruned.t b/t/file_pruned.t index 00542d580..34f366610 100755 --- a/t/file_pruned.t +++ b/t/file_pruned.t @@ -1,40 +1,40 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 26; +use Test::More tests => 27; BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); -ok(IkiWiki::file_pruned("src/.ikiwiki/", "src")); -ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src")); -ok(IkiWiki::file_pruned("src/CVS/foo", "src")); -ok(IkiWiki::file_pruned("src/subdir/CVS/foo", "src")); -ok(IkiWiki::file_pruned("src/.svn", "src")); -ok(IkiWiki::file_pruned("src/subdir/.svn", "src")); -ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src")); -ok(IkiWiki::file_pruned("src/.git", "src")); -ok(IkiWiki::file_pruned("src/subdir/.git", "src")); -ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src")); -ok(! IkiWiki::file_pruned("src/svn/fo", "src")); -ok(! IkiWiki::file_pruned("src/git", "src")); -ok(! IkiWiki::file_pruned("src/index.mdwn", "src")); -ok(! IkiWiki::file_pruned("src/index.", "src")); +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("./")); -# these are ok because while the filename starts with ".", the canonpathed -# version does not -ok(! IkiWiki::file_pruned("src/.", "src")); -ok(! IkiWiki::file_pruned("src/./", "src")); +# absolute filenames are not allowed. +ok(IkiWiki::file_pruned("/etc/passwd")); +ok(IkiWiki::file_pruned("//etc/passwd")); +ok(IkiWiki::file_pruned("/")); +ok(IkiWiki::file_pruned("//")); +ok(IkiWiki::file_pruned("///")); -ok(IkiWiki::file_pruned("src/..", "src")); -ok(IkiWiki::file_pruned("src/../", "src")); -ok(IkiWiki::file_pruned("src/../", "src")); -ok(! IkiWiki::file_pruned("src", "src")); -ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src")); -ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src")); -ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn")); +ok(IkiWiki::file_pruned("..")); +ok(IkiWiki::file_pruned("../")); -ok(IkiWiki::file_pruned("x/y/foo.dpkg-tmp", "src")); -ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src")); +ok(IkiWiki::file_pruned("y/foo.dpkg-tmp")); +ok(IkiWiki::file_pruned("y/foo.ikiwiki-new"));