summaryrefslogtreecommitdiff
path: root/t/file_pruned.t
blob: 7d46c4b7fa9476f59e43b716a9e54e9acef2c4da (plain)
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use Test::More tests => 24;
  5. BEGIN { use_ok("IkiWiki"); }
  6. %config=IkiWiki::defaultconfig();
  7. ok(IkiWiki::file_pruned("src/.ikiwiki/", "src"));
  8. ok(IkiWiki::file_pruned("src/.ikiwiki/index", "src"));
  9. ok(IkiWiki::file_pruned("src/.svn", "src"));
  10. ok(IkiWiki::file_pruned("src/subdir/.svn", "src"));
  11. ok(IkiWiki::file_pruned("src/subdir/.svn/foo", "src"));
  12. ok(IkiWiki::file_pruned("src/.git", "src"));
  13. ok(IkiWiki::file_pruned("src/subdir/.git", "src"));
  14. ok(IkiWiki::file_pruned("src/subdir/.git/foo", "src"));
  15. ok(! IkiWiki::file_pruned("src/svn/fo", "src"));
  16. ok(! IkiWiki::file_pruned("src/git", "src"));
  17. ok(! IkiWiki::file_pruned("src/index.mdwn", "src"));
  18. ok(! IkiWiki::file_pruned("src/index.", "src"));
  19. # these are ok because while the filename starts with ".", the canonpathed
  20. # version does not
  21. ok(! IkiWiki::file_pruned("src/.", "src"));
  22. ok(! IkiWiki::file_pruned("src/./", "src"));
  23. ok(IkiWiki::file_pruned("src/..", "src"));
  24. ok(IkiWiki::file_pruned("src/../", "src"));
  25. ok(IkiWiki::file_pruned("src/../", "src"));
  26. ok(! IkiWiki::file_pruned("src", "src"));
  27. ok(! IkiWiki::file_pruned("/.foo/src", "/.foo/src"));
  28. ok(IkiWiki::file_pruned("/.foo/src/.foo/src", "/.foo/src"));
  29. ok(! IkiWiki::file_pruned("/.foo/src/index.mdwn", "/.foo/src/index.mdwn"));
  30. ok(IkiWiki::file_pruned("x/y/foo.dpkg-tmp", "src"));
  31. ok(IkiWiki::file_pruned("x/y/foo.ikiwiki-new", "src"));