rev 1461 - in trunk/siesta: lib t

[prev] [thread] [next] [lurker] [Date index for 2003/10/22]

From: simon
Subject: rev 1461 - in trunk/siesta: lib t
Date: 11:13 on 22 Oct 2003
Author: simon
Date: 2003-10-22 11:12:51 +0100 (Wed, 22 Oct 2003)
New Revision: 1461

Modified:
   trunk/siesta/lib/Siesta.pm
   trunk/siesta/t/02all_plugins.t
Log:
Fix module::pluggable-ness, put in tests for available_plugins


Modified: trunk/siesta/lib/Siesta.pm
===================================================================
--- trunk/siesta/lib/Siesta.pm	2003-10-21 18:44:34 UTC (rev 1460)
+++ trunk/siesta/lib/Siesta.pm	2003-10-22 10:12:51 UTC (rev 1461)
@@ -10,7 +10,7 @@
 use File::Find::Rule qw/find/;
 use File::Basename qw/fileparse/;
 use File::Spec::Functions qw(catdir);
-use Module::Pluggable sub_name => '_plugins';
+use Module::Pluggable (sub_name => '_plugins');
 use UNIVERSAL::require;
 use Template;
 use Carp qw(croak);

Modified: trunk/siesta/t/02all_plugins.t
===================================================================
--- trunk/siesta/t/02all_plugins.t	2003-10-21 18:44:34 UTC (rev 1460)
+++ trunk/siesta/t/02all_plugins.t	2003-10-22 10:12:51 UTC (rev 1461)
@@ -1,20 +1,35 @@
 #!perl -w
 #  $Id: 02all_plugins.t,v 1.4 2002/09/12 12:55:32 clampr Exp $
-# test all plugins maintian the Plugin API, and compile
+# test all plugins maintain the Plugin API, and compile
 
 use strict;
 use File::Find::Rule qw(find);
-use lib qw(t/lib);
+use lib qw(t/lib lib);
 use Siesta::Test;
+use Siesta;
 
 my @files = find( name => '*.pm', in => 'blib/lib/Siesta/Plugin' );
 require Test::More;
-Test::More->import( tests => @files * 2 );
+Test::More->import( tests => ((@files *2) + 1) );
 
+my @plugins;
+
 for my $class (@files) {
     $class =~ s{blib/lib/(.*).pm}{$1};
     $class =~ s{/}{::}g;
+    push @plugins, $class;
     require_ok($class);
     eval { $class->description };
     ok( !$@, "$class has a description" );
 }
+
+
+my %plugins = map { $_ => 1 } Siesta->available_plugins;
+
+my $result = 1;
+foreach my $p (@plugins) {
+    $p =~ s/^Siesta::Plugin:://;
+    $result &&= $plugins{$p} || 0;
+}
+is($result,1,"available plugins were all found");
+

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52