X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fgenerated_app.t;h=3da66de097f3b82409d4e3fe450182c6f5e591cb;hb=e3eb9f888a45fbcb3a7a57266bfa3df41f13d96b;hp=46e708c409ded495a45ccbd82267a01aa0808364;hpb=a73b39712fa4f12f8a2608b5f851f08c6a4ef47c;p=catagits%2FCatalyst-Devel.git diff --git a/t/generated_app.t b/t/generated_app.t index 46e708c..3da66de 100644 --- a/t/generated_app.t +++ b/t/generated_app.t @@ -64,6 +64,8 @@ is system($^X, 'Makefile.PL'), 0, 'Ran Makefile.PL'; 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,9 @@ sub runperl { 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 +96,15 @@ sub test_fn { 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 { + local $ENV{TEST_POD} = 1; + local $ENV{CATALYST_DEBUG} = 0; + foreach my $fn (@generated_component_tests) { subtest "Generated app test: $fn", sub { require $fn; };