10 use MakeMaker::Test::Utils;
12 my $Is_VMS = $^O eq 'VMS';
13 my $Is_Win32 = $^O eq 'MSWin32';
15 use Test::More tests => 7;
17 my $perl = which_perl;
18 my $mm = bless { NAME => "Foo" }, "MM";
20 # I don't expect anything to have a length shorter than 256 chars.
21 cmp_ok( $mm->max_exec_len, '>=', 256, 'max_exec_len' );
23 my $echo = $mm->oneliner(q{print @ARGV}, ['-l']);
25 # Force a short command length to make testing split_command easier.
26 $mm->{_MAX_EXEC_LEN} = length($echo) + 15;
27 is( $mm->max_exec_len, $mm->{_MAX_EXEC_LEN}, ' forced a short max_exec_len' );
29 my @test_args = qw(foo bar baz yar car har ackapicklerootyjamboree);
30 my @cmds = $mm->split_command($echo, @test_args);
33 @results = _run(@cmds);
34 is( join('', @results), join('', @test_args));
37 my %test_args = ( foo => 42, bar => 23, car => 'har' );
38 $even_args = $mm->oneliner(q{print !(@ARGV % 2)});
39 @cmds = $mm->split_command($even_args, %test_args);
42 @results = _run(@cmds);
43 like( join('', @results ), qr/^1+$/, 'pairs preserved' );
45 is( $mm->split_command($echo), 0, 'no args means no commands' );
51 s{\$\(ABSPERLRUN\)}{$perl} foreach @cmds;
53 s{-\n}{} foreach @cmds
56 s{\\\n}{} foreach @cmds;
59 return map { s/\n+$//; $_ } map { `$_` } @cmds