use Catalyst::Devel;
use Catalyst::Helper;
use Test::More;
+use Config;
eval "use IPC::Run3";
plan skip_all => 'These tests require IPC::Run3' if $@;
command_ok( [ $^X, 'Makefile.PL' ] );
ok -e "Makefile", "Makefile generated";
-command_ok( [ 'make' ] );
+#NOTE: do not assume that 'make' is always 'make' as e.g. Win32/strawberry perl uses 'dmake'
+command_ok( [ ($Config{make} || 'make') ] );
run_generated_component_tests();
+my $server_script_file = File::Spec->catdir(qw/script testapp_server.pl/);
my $server_script = do {
- open(my $fh, '<', File::Spec->catdir(qw/script testapp_server.pl/)) or fail $!;
+ open(my $fh, '<', $server_script_file) or fail $!;
local $/;
<$fh>;
};
'SCRIPT_GEN found in generated output';
is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';
+{
+ open(my $fh, '>', $server_script_file) or fail $!;
+ print $fh "MOO\n";
+}
+my $helper = Catalyst::Helper->new(
+ {
+ '.newfiles' => 0,
+ 'makefile' => 0,
+ 'scripts' => 1,
+ name => '.',
+ }
+);
+$helper->mk_app( '.' ) or fail;
+
+my $server_script_new = do {
+ open(my $fh, '<', $server_script_file) or fail $!;
+ local $/;
+ <$fh>;
+};
+
+is $server_script, $server_script_new;
+
chdir('/');
done_testing;
my $fn = shift;
ok -r $fn, "Have $fn in generated app";
if ($fn =~ /script/) {
- ok -x $fn, "$fn is executable";
+ SKIP: {
+ skip 'Executable file flag test does not make sense on Win32', 1 if ($^O eq 'MSWin32');
+ ok -x $fn, "$fn is executable";
+ }
}
if ($fn =~ /\.p[ml]$/) {
runperl( '-c', $fn, "$fn compiles" );
local $ENV{CATALYST_DEBUG} = 0;
foreach my $fn (@generated_component_tests) {
subtest "Generated app test: $fn", sub {
- require $fn;
+ do $fn;
};
}
}