summaryrefslogtreecommitdiff
path: root/t/file_pruned.t
blob: 34f3666101b122f20b225dd23ed6582d024ca78a (plain)
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use Test::More tests => 27;
  5. BEGIN { use_ok("IkiWiki"); }
  6. %config=IkiWiki::defaultconfig();
  7. ok(IkiWiki::file_pruned(".htaccess"));
  8. ok(IkiWiki::file_pruned(".ikiwiki/"));
  9. ok(IkiWiki::file_pruned(".ikiwiki/index"));
  10. ok(IkiWiki::file_pruned("CVS/foo"));
  11. ok(IkiWiki::file_pruned("subdir/CVS/foo"));
  12. ok(IkiWiki::file_pruned(".svn"));
  13. ok(IkiWiki::file_pruned("subdir/.svn"));
  14. ok(IkiWiki::file_pruned("subdir/.svn/foo"));
  15. ok(IkiWiki::file_pruned(".git"));
  16. ok(IkiWiki::file_pruned("subdir/.git"));
  17. ok(IkiWiki::file_pruned("subdir/.git/foo"));
  18. ok(! IkiWiki::file_pruned("svn/fo"));
  19. ok(! IkiWiki::file_pruned("git"));
  20. ok(! IkiWiki::file_pruned("index.mdwn"));
  21. ok(! IkiWiki::file_pruned("index."));
  22. ok(IkiWiki::file_pruned("."));
  23. ok(IkiWiki::file_pruned("./"));
  24. # absolute filenames are not allowed.
  25. ok(IkiWiki::file_pruned("/etc/passwd"));
  26. ok(IkiWiki::file_pruned("//etc/passwd"));
  27. ok(IkiWiki::file_pruned("/"));
  28. ok(IkiWiki::file_pruned("//"));
  29. ok(IkiWiki::file_pruned("///"));
  30. ok(IkiWiki::file_pruned(".."));
  31. ok(IkiWiki::file_pruned("../"));
  32. ok(IkiWiki::file_pruned("y/foo.dpkg-tmp"));
  33. ok(IkiWiki::file_pruned("y/foo.ikiwiki-new"));