5 use Test::More tests => 11;
7 BEGIN { use_ok('File::chdir') }
11 # Don't want to depend on File::Spec::Functions
12 sub catdir { File::Spec->catdir(@_) }
16 ok( tied $CWD, '$CWD is fit to be tied' );
18 # First, let's try unlocalized $CWD.
21 ::is( getcwd, catdir($cwd,'t'), 'unlocalized $CWD works' );
22 ::is( $CWD, catdir($cwd,'t'), ' $CWD set' );
25 ::is( getcwd, catdir($cwd,'t'), 'unlocalized $CWD unneffected by blocks' );
26 ::is( $CWD, catdir($cwd,'t'), ' and still set' );
29 # Ok, reset ourself for the real test.
35 ::is( $old_dir, $cwd, '$CWD fetch works' );
36 ::is( getcwd, catdir($cwd,'t'), 'localized $CWD works' );
39 ::is( getcwd, $cwd, ' and resets automatically!' );
40 ::is( $CWD, $cwd, ' $CWD reset, too' );
44 is( $CWD, catdir($cwd,'t'), 'chdir() and $CWD work together' );