4 if( $ENV{PERL_CORE} ) {
6 @INC = ('../lib', 'lib');
16 use MakeMaker::Test::Utils;
18 my $Is_VMS = $^O eq 'VMS';
19 my $Is_Win32 = $^O eq 'MSWin32';
21 use Test::More tests => 7;
23 my $perl = which_perl;
24 my $mm = bless { NAME => "Foo" }, "MM";
26 # I don't expect anything to have a length shorter than 256 chars.
27 cmp_ok( $mm->max_exec_len, '>=', 256, 'max_exec_len' );
29 my $echo = $mm->oneliner(q{print @ARGV}, ['-l']);
31 # Force a short command length to make testing split_command easier.
32 $mm->{_MAX_EXEC_LEN} = length($echo) + 15;
33 is( $mm->max_exec_len, $mm->{_MAX_EXEC_LEN}, ' forced a short max_exec_len' );
35 my @test_args = qw(foo bar baz yar car har ackapicklerootyjamboree);
36 my @cmds = $mm->split_command($echo, @test_args);
39 @results = _run(@cmds);
40 is( join('', @results), join('', @test_args));
43 my %test_args = ( foo => 42, bar => 23, car => 'har' );
44 $even_args = $mm->oneliner(q{print !(@ARGV % 2)});
45 @cmds = $mm->split_command($even_args, %test_args);
48 @results = _run(@cmds);
49 like( join('', @results ), qr/^1+$/, 'pairs preserved' );
51 is( $mm->split_command($echo), 0, 'no args means no commands' );
57 s{\$\(PERLRUN\)}{$perl} foreach @cmds;
59 s{-\n}{} foreach @cmds
62 s{\\\n}{} foreach @cmds;
65 return map { s/\n+$//; $_ } map { `$_` } @cmds