--- /dev/null
+# blosxom standard $plugin_dir testing
+
+use strict;
+use Test::More tests => 1;
+use Test::Differences;
+use Cwd;
+use IO::File;
+
+my $blosxom_root = 'plugin_dir';
+$blosxom_root = "t/$blosxom_root" if -d "t/$blosxom_root";
+$blosxom_root = cwd . "/$blosxom_root";
+die "cannot find root '$blosxom_root'"
+ unless -d $blosxom_root;
+
+my $blosxom_config_dir = "$blosxom_root/config";
+die "cannot find blosxom config dir '$blosxom_config_dir'" unless -d $blosxom_config_dir;
+$ENV{BLOSXOM_CONFIG_DIR} = $blosxom_config_dir;
+
+my $blosxom_cgi = "$blosxom_root/../../blosxom.cgi";
+die "cannot find blosxom.cgi '$blosxom_cgi'" unless -f $blosxom_cgi;
+die "blosxom.cgi '$blosxom_cgi' is not executable" unless -x $blosxom_cgi;
+
+my $fh = IO::File->new("$blosxom_root/expected.html", 'r')
+ or die "cannot open expected output file '$blosxom_root/expected.html': $!";
+my $expected;
+{
+ local $/ = undef;
+ $expected = <$fh>;
+ $fh->close;
+}
+
+my $output = qx($blosxom_cgi);
+
+eq_or_diff($output, $expected, 'html output ok');
+
--- /dev/null
+# blosxom $plugin_list testing
+
+use strict;
+use Test::More tests => 1;
+use Test::Differences;
+use Cwd;
+use IO::File;
+
+my $blosxom_root = 'plugin_list';
+$blosxom_root = "t/$blosxom_root" if -d "t/$blosxom_root";
+$blosxom_root = cwd . "/$blosxom_root";
+die "cannot find root '$blosxom_root'"
+ unless -d $blosxom_root;
+
+my $blosxom_config_dir = "$blosxom_root/config";
+die "cannot find blosxom config dir '$blosxom_config_dir'" unless -d $blosxom_config_dir;
+$ENV{BLOSXOM_CONFIG_DIR} = $blosxom_config_dir;
+
+my $blosxom_cgi = "$blosxom_root/../../blosxom.cgi";
+die "cannot find blosxom.cgi '$blosxom_cgi'" unless -f $blosxom_cgi;
+die "blosxom.cgi '$blosxom_cgi' is not executable" unless -x $blosxom_cgi;
+
+my $fh = IO::File->new("$blosxom_root/expected.html", 'r')
+ or die "cannot open expected output file '$blosxom_root/expected.html': $!";
+my $expected;
+{
+ local $/ = undef;
+ $expected = <$fh>;
+ $fh->close;
+}
+
+my $output = qx($blosxom_cgi);
+
+eq_or_diff($output, $expected, 'html output ok');
+
--- /dev/null
+$blog_title = 'plugin_list test';
+$blog_encoding = 'ISO-8859-1';
+$datadir = "$ENV{BLOSXOM_CONFIG_DIR}/../data";
+$plugin_list = '';
+$plugin_dir = "$ENV{BLOSXOM_CONFIG_DIR}/../plugins";
--- /dev/null
+Story 1
+
+Story 1 text
+
--- /dev/null
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>$blog_title</title>
+</head>
+<body>
+<h1>$blog_title</h1>
--- /dev/null
+$dump_plugins::list
+$body
--- /dev/null
+Content-Type: text/html; charset=ISO-8859-1\r
+\r
+<html>
+<head>
+<title>plugin_list test</title>
+</head>
+<body>
+<h1>plugin_list test</h1>
+
+<pre>
+plugin2
+plugin4
+dump_plugins
+plugin1
+plugin3
+</pre>
+
+
+Story 1 text
+
+</body>
+</html>
--- /dev/null
+package plugin2;
+sub start { 1 };
+1;
--- /dev/null
+package plugin4;
+sub start { 1 };
+1;
--- /dev/null
+package dump_plugins;
+use vars qw($list);
+sub start { 1 };
+sub head { $list = sprintf "<pre>\n%s\n</pre>\n", join("\n", @blosxom::plugins); }
+1;
--- /dev/null
+package plugin1;
+sub start { 1 };
+1;
--- /dev/null
+package plugin3;
+sub start { 1 };
+1;
--- /dev/null
+$blog_title = 'plugin_list test';
+$blog_encoding = 'ISO-8859-1';
+$datadir = "$ENV{BLOSXOM_CONFIG_DIR}/../data";
+$plugin_list = "$ENV{BLOSXOM_CONFIG_DIR}/plugins.conf";
+$plugin_dir = "$ENV{BLOSXOM_CONFIG_DIR}/../plugins";
--- /dev/null
+
+# Bare
+plugin1
+
+# Numbered
+02plugin2
+
+# Underscored
+plugin3_
+
+# Numbered and underscored
+04plugin4_
+
+# Commented out
+# plugin5
+
+# Real plugin - dump the list of plugins
+dump_plugins
+
--- /dev/null
+Story 1
+
+Story 1 text
+
--- /dev/null
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>$blog_title</title>
+</head>
+<body>
+<h1>$blog_title</h1>
--- /dev/null
+$dump_plugins::list
+$body
--- /dev/null
+Content-Type: text/html; charset=ISO-8859-1\r
+\r
+<html>
+<head>
+<title>plugin_list test</title>
+</head>
+<body>
+<h1>plugin_list test</h1>
+
+<pre>
+plugin1
+plugin2
+plugin3
+plugin4
+dump_plugins
+</pre>
+
+
+Story 1 text
+
+</body>
+</html>
--- /dev/null
+package dump_plugins;
+use vars qw($list);
+sub start { 1 };
+sub head { $list = sprintf "<pre>\n%s\n</pre>\n", join("\n", @blosxom::plugins); }
+1;
--- /dev/null
+package plugin1;
+sub start { 1 };
+1;
--- /dev/null
+package plugin2;
+sub start { 1 };
+1;
--- /dev/null
+package plugin3;
+sub start { 1 };
+1;
--- /dev/null
+package plugin4;
+sub start { 1 };
+1;
--- /dev/null
+package plugin5;
+sub start { 1 };
+1;