8 use Test::More tests => 5 + 1;
13 my $filename = '/tmp/run_perl_test';
15 my $guard = VPIT::TestHelpers::Guard->new(sub { unlink $filename });
17 my $code = "open my \$fh, q[>], q[$filename] or die \$!; for my \$key (sort keys %ENV) { print \$fh qq[\$key:\$ENV{\$key}\n] } close \$fh";
19 my $ld_path = $Config::Config{ldlibpthname};
22 'MSWin32' => [ qw<SystemRoot> ],
24 'cygwin' => [ qw<PATH> ],
28 push @$_, $ld_path for values %expected_vars;
32 grep !$uniq{$_}++, map @$_, values %expected_vars;
34 push @all_vars, 'DUMMY';
36 my @ignored_vars = qw<
37 VERSIONER_PERL_PREFER_32_BIT
38 VERSIONER_PERL_VERSION
39 __CF_USER_TEXT_ENCODING
42 for my $os (qw<MSWin32 android darwin cygwin linux>) {
43 1 while unlink $filename;
48 @ENV{@all_vars} = @all_vars;
54 open my $fh, '<', $filename;
59 %subprocess_env = map { split /:/, $_, 2 } @lines;
62 delete @subprocess_env{@ignored_vars};
64 my $got = join "\n", sort keys %subprocess_env;
65 my $exp = join "\n", sort @{ $expected_vars{$os} || [] };
67 is $got, $exp, "run_perl preserving $os ENV vars";
73 run_perl 'print "hello\n"';
75 like $@, qr/^Double quotes in evaluated code are not portable/,
76 'croak on double quotes';