Merge branch 'master' into fancypodcast
[ikiwiki.git] / t / prune.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More tests => 6;
5 use File::Path qw(make_path remove_tree);
6
7 BEGIN { use_ok("IkiWiki"); }
8 BEGIN { use_ok("IkiWiki::Render"); }
9
10 %config=IkiWiki::defaultconfig();
11
12 remove_tree("t/tmp");
13
14 make_path("t/tmp/srcdir/a/b/c");
15 make_path("t/tmp/srcdir/d/e/f");
16 writefile("a/b/c/d.mdwn", "t/tmp/srcdir", "foo");
17 writefile("d/e/f/g.mdwn", "t/tmp/srcdir", "foo");
18 IkiWiki::prune("t/tmp/srcdir/d/e/f/g.mdwn");
19 ok(-d "t/tmp/srcdir");
20 ok(! -e "t/tmp/srcdir/d");
21 IkiWiki::prune("t/tmp/srcdir/a/b/c/d.mdwn", "t/tmp/srcdir");
22 ok(-d "t/tmp/srcdir");
23 ok(! -e "t/tmp/srcdir/a");