@@ -15,7 +15,7 @@ use MakeMaker::Test::Utils;
1515my $Is_VMS = $^O eq ' VMS' ;
1616my $Is_Win32 = $^O eq ' MSWin32' ;
1717
18- use Test::More tests => 7 ;
18+ use Test::More tests => 9 ;
1919
2020my $perl = which_perl;
2121my $mm = bless { NAME => " Foo" , MAKE => $Config {make } }, " MM" ;
@@ -36,28 +36,31 @@ isnt( @cmds, 0 );
3636my @results = _run(@cmds );
3737is( join (' ' , @results ), join (' ' , @test_args ));
3838
39-
4039my %test_args = ( foo => 42, bar => 23, car => ' har' );
4140my $even_args = $mm -> oneliner(q{ print !(@ARGV % 2)} );
4241@cmds = $mm -> split_command($even_args , %test_args );
4342isnt( @cmds , 0 );
44-
4543@results = _run(@cmds );
4644like( join (' ' , @results ), qr / ^1+$ / , ' pairs preserved' );
4745
48- is( $mm -> split_command($echo ), 0, ' no args means no commands' );
46+ %test_args = ( foo => 42, bar => 23, car => ' har' );
47+ $even_args = $mm -> oneliner(qq{ \$ x="";\n } .q{ print !(@ARGV % 2)} );
48+ my @save = @cmds = $mm -> split_command($even_args , %test_args );
49+ isnt @cmds , 0 or diag explain \@cmds ;
50+ @results = _run(@cmds );
51+ like join (' ' , @results ), qr / ^1+$ / , ' pairs preserved'
52+ or diag explain [$even_args , \@save , \@cmds , \@results ];
4953
54+ is( $mm -> split_command($echo ), 0, ' no args means no commands' );
5055
5156sub _run {
5257 my @cmds = @_ ;
53-
5458 s {\$\( ABSPERLRUN\) } { $perl } foreach @ cmds;
5559 if( $Is_VMS ) {
56- s{-\n }{} foreach @ cmds
60+ s{-\n }{}g foreach @ cmds
5761 }
5862 elsif ( $Is_Win32 ) {
59- s {\\\n } {} foreach @ cmds;
63+ s {\\\n } {} g foreach @cmds ;
6064 }
61-
62- return map { s/\n +$/ /; $_ } map { `$_ ` } @ cmds
65+ map { s /\n +$// ; $_ } map { ` $_ ` } @cmds
6366}
0 commit comments