]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/libdirs.t
libtext-csv-xs-perl not relevant
[git.ikiwiki.info.git] / t / libdirs.t
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4 use Test::More;
5 use File::Path qw(make_path remove_tree);
7 BEGIN { use_ok("IkiWiki"); }
9 remove_tree("t/tmp");
10 make_path("t/tmp/libdir");
11 make_path("t/tmp/libdirs");
12 make_path("t/tmp/libdirs/1");
13 make_path("t/tmp/libdirs/2");
15 writefile("IkiWiki/Plugin/test_plugin_in_libdir.pm", "t/tmp/libdir", "#");
16 writefile("IkiWiki/Plugin/test_plugin_in_libdir_1.pm", "t/tmp/libdirs/1", "#");
17 writefile("IkiWiki/Plugin/test_plugin_in_libdir_2.pm", "t/tmp/libdirs/2", "#");
18 writefile("plugins/ext_plugin_in_libdir", "t/tmp/libdir", "#!/bin/true");
19 writefile("plugins/ext_plugin_in_libdir_1", "t/tmp/libdirs/1", "#!/bin/true");
20 writefile("plugins/ext_plugin_in_libdir_2", "t/tmp/libdirs/2", "#!/bin/true");
21 ok(chmod 0755, "t/tmp/libdir/plugins/ext_plugin_in_libdir");
22 ok(chmod 0755, "t/tmp/libdirs/1/plugins/ext_plugin_in_libdir_1");
23 ok(chmod 0755, "t/tmp/libdirs/2/plugins/ext_plugin_in_libdir_2");
25 %config=IkiWiki::defaultconfig();
26 $config{srcdir}=$config{destdir}="/dev/null";
27 $config{libdir}="t/tmp/libdir";
28 $config{libdirs}=["t/tmp/libdirs/1", "t/tmp/libdirs/2"];
30 my @plugins = IkiWiki::listplugins();
32 ok(grep { m/^test_plugin_in_libdir$/ } @plugins);
33 ok(grep { m/^test_plugin_in_libdir_1$/ } @plugins);
34 ok(grep { m/^test_plugin_in_libdir_2$/ } @plugins);
36 ok(grep { m/^ext_plugin_in_libdir$/ } @plugins);
37 ok(grep { m/^ext_plugin_in_libdir_1$/ } @plugins);
38 ok(grep { m/^ext_plugin_in_libdir_2$/ } @plugins);
40 done_testing;