Debian lenny version packages
[pkg-perl] / deb-src / libtest-harness-perl / libtest-harness-perl-3.12 / t / compat / env.t
1 #!/usr/bin/perl -w
2
3 # Test that env vars are honoured.
4
5 use strict;
6 use lib 't/lib';
7
8 use Test::More (
9     $^O eq 'VMS'
10     ? ( skip_all => 'VMS' )
11     : ( tests => 1 )
12 );
13
14 use Test::Harness;
15
16 # HARNESS_PERL_SWITCHES
17
18 my $test_template = <<'END';
19 #!/usr/bin/perl
20
21 use Test::More tests => 1;
22
23 is $ENV{HARNESS_PERL_SWITCHES}, '-w';
24 END
25
26 open TEST, ">env_check_t.tmp";
27 print TEST $test_template;
28 close TEST;
29
30 END { unlink 'env_check_t.tmp'; }
31
32 {
33     local $ENV{HARNESS_PERL_SWITCHES} = '-w';
34     my ( $tot, $failed )
35       = Test::Harness::execute_tests( tests => ['env_check_t.tmp'] );
36     is $tot->{bad}, 0;
37 }
38
39 1;