[Catalyst-commits] r12050 - in Catalyst-Devel/1.00/branches/helper_refactor: . t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Nov 27 01:17:35 GMT 2009


Author: t0m
Date: 2009-11-27 01:17:35 +0000 (Fri, 27 Nov 2009)
New Revision: 12050

Modified:
   Catalyst-Devel/1.00/branches/helper_refactor/Makefile.PL
   Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
Log:
Properly fix the generated app test. Run tests in the generated app using the new subtest stuff in Test::More

Modified: Catalyst-Devel/1.00/branches/helper_refactor/Makefile.PL
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/Makefile.PL	2009-11-27 01:16:43 UTC (rev 12049)
+++ Catalyst-Devel/1.00/branches/helper_refactor/Makefile.PL	2009-11-27 01:17:35 UTC (rev 12050)
@@ -18,6 +18,8 @@
 requires 'Path::Class' => '0.09';
 requires 'Template'    => '2.14';
 
+test_requires 'Test::More' => '0.90';
+
 install_share 'share';
 
 if ( $^O eq 'MSWin32' ) {

Modified: Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t
===================================================================
--- Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-11-27 01:16:43 UTC (rev 12049)
+++ Catalyst-Devel/1.00/branches/helper_refactor/t/generated_app.t	2009-11-27 01:17:35 UTC (rev 12050)
@@ -6,49 +6,52 @@
 use Test::WWW::Mechanize;
 use Catalyst::Devel;
 
-my $dir = tempdir( CLEANUP => 1 );
+my $dir = tempdir();
 my $devnull = File::Spec->devnull;
 
 use Test::More;
+
+diag "In $dir";
+
 {
-    # Check exit status here
+    my $exit;
     if ($^O eq 'MSWin32') {
-      system("cd $dir & catalyst TestApp > $devnull 2>&1");
+      $exit = system("cd $dir & catalyst TestApp > $devnull 2>&1");
     }
     else {
-      system("cd $dir; catalyst.pl TestApp > $devnull 2>&1");
+      $exit = system("cd $dir; catalyst.pl TestApp > $devnull 2>&1");
     }
+    is $exit, 0, 'Exit status ok';
 }
-# Fix paths / nl work on win32
+# FIXME paths / nl work on win32
 chdir("$dir/TestApp/");
 
-# Ok, this is lame.. Also, check +x permissions?
 my @files = qw|
     Makefile.PL
     testapp.conf
-lib/TestApp.pm
-lib/TestApp/Controller/Root.pm
-README
-Changes
-t/01app.t
-t/02pod.t
-t/03podcoverage.t
-root/static/images/catalyst_logo.png
-root/static/images/btn_120x50_built.png
-root/static/images/btn_120x50_built_shadow.png
-root/static/images/btn_120x50_powered.png
-root/static/images/btn_120x50_powered_shadow.png
-root/static/images/btn_88x31_built.png
-root/static/images/btn_88x31_built_shadow.png
-root/static/images/btn_88x31_powered.png
-root/static/images/btn_88x31_powered_shadow.png
-root/favicon.ico
-Makefile.PL
-script/testapp_cgi.pl
-script/testapp_fastcgi.pl
-script/testapp_server.pl
-script/testapp_test.pl
-script/testapp_create.pl
+    lib/TestApp.pm
+    lib/TestApp/Controller/Root.pm
+    README
+    Changes
+    t/01app.t
+    t/02pod.t
+    t/03podcoverage.t
+    root/static/images/catalyst_logo.png
+    root/static/images/btn_120x50_built.png
+    root/static/images/btn_120x50_built_shadow.png
+    root/static/images/btn_120x50_powered.png
+    root/static/images/btn_120x50_powered_shadow.png
+    root/static/images/btn_88x31_built.png
+    root/static/images/btn_88x31_built_shadow.png
+    root/static/images/btn_88x31_powered.png
+    root/static/images/btn_88x31_powered_shadow.png
+    root/favicon.ico
+    Makefile.PL
+    script/testapp_cgi.pl
+    script/testapp_fastcgi.pl
+    script/testapp_server.pl
+    script/testapp_test.pl
+    script/testapp_create.pl
 |;
 
 foreach my $fn (@files) {
@@ -62,9 +65,19 @@
 my $makefile_status = `$^X Makefile.PL`;
 ok $makefile_status, "Makefile ran okay";
 ok -e "Makefile", "Makefile exists";
-my $newapp_test_status = system("make", "test");
-ok !$newapp_test_status, "Tests ran okay";
 
+is system("make"), 0, 'Run make';
+
+{
+    local $ENV{TEST_POD} = 1;
+
+    foreach my $test (grep { m|^t/| } @files) {
+        subtest "Generated app test: $test", sub {
+            require $test;
+        }
+    }
+}
+
 ## Moosey server tests - kmx++
 my $server_path   = File::Spec->catfile('script', 'testapp_server.pl');
 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
@@ -93,5 +106,7 @@
     'SCRIPT_GEN found in generated output';
 is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';
 
+chdir('/');
+
 done_testing;
 




More information about the Catalyst-commits mailing list