diff options
author | Joey Hess <joey@kitenet.net> | 2007-12-18 00:38:06 -0500 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2007-12-18 00:38:06 -0500 |
commit | 10e26c0370abcc9afa83ff948092ea231d0ca6af (patch) | |
tree | f83373a7fe6556ecc7750b2e0c6bb7d7dbb381e7 /t/file_pruned.t | |
parent | 67dcf175cbe6241f0dcf3564424ca178476ebdfb (diff) | |
download | ikiwiki-10e26c0370abcc9afa83ff948092ea231d0ca6af.tar ikiwiki-10e26c0370abcc9afa83ff948092ea231d0ca6af.tar.gz |
file_pruned regression tests
Diffstat (limited to 't/file_pruned.t')
-rwxr-xr-x | t/file_pruned.t | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/file_pruned.t b/t/file_pruned.t new file mode 100755 index 000000000..7d46c4b7f --- /dev/null +++ b/t/file_pruned.t @@ -0,0 +1,38 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 24; + +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/.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")); + +# 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")); + +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("x/y/foo.dpkg-tmp", "src")); +ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src")); |