escape INSTALL_BASE properly for EUMM to parse
[catagits/Catalyst-Devel.git] / t / generated_app.t
index a066e81..30b2fce 100644 (file)
@@ -21,8 +21,16 @@ plan skip_all => "No share dir at $share_dir!"
 $ENV{CATALYST_DEVEL_SHAREDIR} = $share_dir;
 my $instdir = tempdir(CLEANUP => 1);
 
-$ENV{PERL_MM_OPT} = "INSTALL_BASE=$instdir";
-$ENV{INSTALL_BASE} = $instdir;
+my $MAKE = $Config{make} || 'make';
+
+my $escaped_path = $instdir;
+$escaped_path =~ s/\\/\\\\/g;
+if ($escaped_path =~ s/ /\\ /g) {
+  $escaped_path = qq{"$escaped_path"};
+}
+
+$ENV{PERL_MM_OPT} = "INSTALL_BASE=$escaped_path";
+
 if ($ENV{MAKEFLAGS}) {
     $ENV{MAKEFLAGS} =~ s/PREFIX=[^\s]+//;
     $ENV{MAKEFLAGS} =~ s/INSTALL_BASE=[^\s]+//;
@@ -89,8 +97,7 @@ create_ok($_, 'My' . $_) for qw/Model View Controller/;
 
 command_ok( [ $^X, 'Makefile.PL' ] );
 ok -e "Makefile", "Makefile generated";
-#NOTE: do not assume that 'make' is always 'make' as e.g. Win32/strawberry perl uses 'dmake'
-command_ok( [ ($Config{make} || 'make') ] );
+command_ok( [ $MAKE ] );
 
 run_generated_component_tests();
 
@@ -129,7 +136,7 @@ my $server_script_new = do {
 is $server_script, $server_script_new;
 
 diag "Installed app is in $instdir";
-command_ok( [ ($Config{make} || 'make', 'install') ] );
+command_ok( [ $MAKE, 'install' ] );
 
 my $inst_app_dir = catdir($instdir);
 chdir($inst_app_dir) or die "Cannot chdir to $inst_app_dir: $!";