]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - t/libdirs.t
inline: change default sort order from age to "age title" for determinism
[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 make_path("t/tmp/libdir");
10 make_path("t/tmp/libdirs");
11 make_path("t/tmp/libdirs/1");
12 make_path("t/tmp/libdirs/2");
14 writefile("IkiWiki/Plugin/test_plugin_in_libdir.pm", "t/tmp/libdir", "#");
15 writefile("IkiWiki/Plugin/test_plugin_in_libdir_1.pm", "t/tmp/libdirs/1", "#");
16 writefile("IkiWiki/Plugin/test_plugin_in_libdir_2.pm", "t/tmp/libdirs/2", "#");
17 writefile("plugins/ext_plugin_in_libdir", "t/tmp/libdir", "#!/bin/true");
18 writefile("plugins/ext_plugin_in_libdir_1", "t/tmp/libdirs/1", "#!/bin/true");
19 writefile("plugins/ext_plugin_in_libdir_2", "t/tmp/libdirs/2", "#!/bin/true");
20 ok(chmod 0755, "t/tmp/libdir/plugins/ext_plugin_in_libdir");
21 ok(chmod 0755, "t/tmp/libdirs/1/plugins/ext_plugin_in_libdir_1");
22 ok(chmod 0755, "t/tmp/libdirs/2/plugins/ext_plugin_in_libdir_2");
24 %config=IkiWiki::defaultconfig();
25 $config{srcdir}=$config{destdir}="/dev/null";
26 $config{libdir}="t/tmp/libdir";
27 $config{libdirs}=["t/tmp/libdirs/1", "t/tmp/libdirs/2"];
29 my @plugins = IkiWiki::listplugins();
31 ok(grep { m/^test_plugin_in_libdir$/ } @plugins);
32 ok(grep { m/^test_plugin_in_libdir_1$/ } @plugins);
33 ok(grep { m/^test_plugin_in_libdir_2$/ } @plugins);
35 ok(grep { m/^ext_plugin_in_libdir$/ } @plugins);
36 ok(grep { m/^ext_plugin_in_libdir_1$/ } @plugins);
37 ok(grep { m/^ext_plugin_in_libdir_2$/ } @plugins);
39 remove_tree("t/tmp/libdir");
40 remove_tree("t/tmp/libdirs");
42 done_testing;