aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2014-12-09 22:54:26 +0000
committerSimon McVittie <smcv@debian.org>2014-12-09 22:54:26 +0000
commitb9596b2049e9f559e0d08c59229f0a0532b2993b (patch)
treea1c190f5e2b585000e8896fc5e9320ef31ee13dc /t
parent5c30886dbf38689668a47414283f8dc4e895ec7d (diff)
downloadikiwiki-b9596b2049e9f559e0d08c59229f0a0532b2993b.tar
ikiwiki-b9596b2049e9f559e0d08c59229f0a0532b2993b.tar.gz
Add regression test for libdir/libdirs
Diffstat (limited to 't')
-rwxr-xr-xt/libdirs.t42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/libdirs.t b/t/libdirs.t
new file mode 100755
index 000000000..906a54105
--- /dev/null
+++ b/t/libdirs.t
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Test::More;
+use File::Path qw(make_path remove_tree);
+
+BEGIN { use_ok("IkiWiki"); }
+
+make_path("t/tmp/libdir");
+make_path("t/tmp/libdirs");
+make_path("t/tmp/libdirs/1");
+make_path("t/tmp/libdirs/2");
+
+writefile("IkiWiki/Plugin/test_plugin_in_libdir.pm", "t/tmp/libdir", "#");
+writefile("IkiWiki/Plugin/test_plugin_in_libdir_1.pm", "t/tmp/libdirs/1", "#");
+writefile("IkiWiki/Plugin/test_plugin_in_libdir_2.pm", "t/tmp/libdirs/2", "#");
+writefile("plugins/ext_plugin_in_libdir", "t/tmp/libdir", "#!/bin/true");
+writefile("plugins/ext_plugin_in_libdir_1", "t/tmp/libdirs/1", "#!/bin/true");
+writefile("plugins/ext_plugin_in_libdir_2", "t/tmp/libdirs/2", "#!/bin/true");
+ok(chmod 0755, "t/tmp/libdir/plugins/ext_plugin_in_libdir");
+ok(chmod 0755, "t/tmp/libdirs/1/plugins/ext_plugin_in_libdir_1");
+ok(chmod 0755, "t/tmp/libdirs/2/plugins/ext_plugin_in_libdir_2");
+
+%config=IkiWiki::defaultconfig();
+$config{srcdir}=$config{destdir}="/dev/null";
+$config{libdir}="t/tmp/libdir";
+$config{libdirs}=["t/tmp/libdirs/1", "t/tmp/libdirs/2"];
+
+my @plugins = IkiWiki::listplugins();
+
+ok(grep { m/^test_plugin_in_libdir$/ } @plugins);
+ok(grep { m/^test_plugin_in_libdir_1$/ } @plugins);
+ok(grep { m/^test_plugin_in_libdir_2$/ } @plugins);
+
+ok(grep { m/^ext_plugin_in_libdir$/ } @plugins);
+ok(grep { m/^ext_plugin_in_libdir_1$/ } @plugins);
+ok(grep { m/^ext_plugin_in_libdir_2$/ } @plugins);
+
+remove_tree("t/tmp/libdir");
+remove_tree("t/tmp/libdirs");
+
+done_testing;