[Catalyst-commits] r12104 - in Catalyst-Devel/1.00/branches/helper_refactor: share/t t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Dec 1 02:47:08 GMT 2009


Author: t0m
Date: 2009-12-01 02:47:08 +0000 (Tue, 01 Dec 2009)
New Revision: 12104

Modified:
   Catalyst-Devel/1.00/branches/helper_refactor/share/t/comptest.tt
   Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
Log:
Fix bug with generated component classes and an issue with the test

Modified: Catalyst-Devel/1.00/branches/helper_refactor/share/t/comptest.tt
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/share/t/comptest.tt	2009-12-01 02:36:00 UTC (rev 12103)
+++ Catalyst-Devel/1.00/branches/helper_refactor/share/t/comptest.tt	2009-12-01 02:47:08 UTC (rev 12104)
@@ -13,7 +13,7 @@
 $mech->get_ok( 'http://localhost[% uri %]' );
 [% ELSE %]use Test::More tests => 3;
 
-BEGIN { use_ok 'Catalyst::Test', '[% name %]' }
+BEGIN { use_ok 'Catalyst::Test', '[% app %]' }
 BEGIN { use_ok '[% class %]' }
 
 ok( request('[% uri %]')->is_success, 'Request should succeed' );

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-12-01 02:36:00 UTC (rev 12103)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-12-01 02:47:08 UTC (rev 12104)
@@ -64,6 +64,8 @@
 ok -e "Makefile", "Makefile generated";
 is system("make"), 0, 'Run make';
 
+run_generated_component_tests();
+
 my $server_script = do {
     open(my $fh, '<', File::Spec->catdir(qw/script testapp_server.pl/)) or fail $!;
     local $/;
@@ -83,10 +85,12 @@
     is system($^X, '-I', File::Spec->catdir($Bin, '..', 'lib'), @_), 0, $comment;
 }
 
+my @generated_component_tests;
+
 sub test_fn {
     local $ENV{TEST_POD} = 1;
     local $ENV{CATALYST_DEBUG} = 0;
-    
+
     my $fn = shift;
     ok -r $fn, "Have $fn in generated app";
     if ($fn =~ /script/) {
@@ -95,7 +99,13 @@
     if ($fn =~ /\.p[ml]$/) {
         runperl( '-c', $fn, "$fn compiles" );
     }
-    if ($fn =~ /\.t$/) {
+    # Save these till later as Catalyst::Test will only be loaded once :-/
+    push @generated_component_tests, $fn
+        if $fn =~ /\.t$/;
+}
+
+sub run_generated_component_tests {
+    foreach my $fn (@generated_component_tests) {
         subtest "Generated app test: $fn", sub {
             require $fn;
         };




More information about the Catalyst-commits mailing list