actually added c3 mro test :/
Matt S Trout [Sun, 11 Jun 2006 14:45:34 +0000 (14:45 +0000)]
r9837@cain (orig r4318):  matthewt | 2006-06-07 17:02:27 +0000

t/c3_mro.t [new file with mode: 0644]

diff --git a/t/c3_mro.t b/t/c3_mro.t
new file mode 100644 (file)
index 0000000..5d6b306
--- /dev/null
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+
+use Test::More;
+require Catalyst;
+require Module::Pluggable::Object;
+
+eval "require Class::C3";
+plan skip_all => "This test requires Class::C3" if $@;
+
+# Get a list of all Catalyst:: packages in blib via M::P::O
+my @cat_mods;
+{
+  local @INC = grep {/blib/} @INC;
+  @cat_mods = (
+    'Catalyst', 
+    Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins,
+  );
+}
+
+# plan one test per found package name
+plan tests => scalar @cat_mods;
+
+# Try to calculate the C3 MRO for each package
+#
+# In the case that the initial require fails (as in
+# Catalyst::Engine::FastCGI when FCGI is not installed),
+# the calculateMRO eval will not error out, which is
+# effectively a test skip.
+#
+foreach my $cat_mod (@cat_mods) {
+  eval " require $cat_mod ";
+  eval { Class::C3::calculateMRO($cat_mod) };
+  ok(!$@, "calculateMRO for $cat_mod");
+}
+