Fix when( scalar ... ) bug
[p5sagit/p5-mst-13.2.git] / ext / Cwd / t / tmpdir.t
1 use strict;
2 use Test;
3
4 # Grab all of the plain routines from File::Spec
5 use File::Spec;
6 use File::Spec::Win32;
7
8 plan tests => 4;
9
10 ok 1, 1, "Loaded";
11
12 if ($^O eq 'VMS') {
13     # hack:
14     # Need to cause the %ENV to get populated or you only get the builtins at
15     # first, and then something else can cause the hash to get populated.
16     my %look_env = %ENV;
17 }
18 my $num_keys = keys %ENV;
19 File::Spec->tmpdir;
20 ok scalar keys %ENV, $num_keys, "tmpdir() shouldn't change the contents of %ENV";
21
22 if ($^O eq 'VMS') {
23   skip("Can't make list assignment to %ENV on this system", 1);
24 } else {
25   local %ENV;
26   File::Spec::Win32->tmpdir;
27   ok scalar keys %ENV, 0, "Win32->tmpdir() shouldn't change the contents of %ENV";
28 }
29
30 File::Spec::Win32->tmpdir;
31 ok scalar keys %ENV, $num_keys, "Win32->tmpdir() shouldn't change the contents of %ENV";