5 use Test::More tests => 6;
7 BEGIN { use_ok('File::chdir') }
11 # Don't want to depend on File::Spec::Functions
12 sub catdir { File::Spec->catdir(@_); }
14 my($cwd) = getcwd =~ /(.*)/; # detaint otherwise nothing's gonna work
16 # First, let's try normal chdir()
19 ::is( getcwd, catdir($cwd,'t'), 'void chdir still works' );
27 ::fail('chdir() failed completely in boolean context!');
29 ::is( getcwd, catdir($cwd,'t'), ' even in boolean context' );
32 ::is( getcwd, catdir($cwd,'t'), ' unneffected by blocks' );
35 # Ok, reset ourself for the real test.
36 chdir($cwd) or die $!;
39 local $ENV{HOME} = 't';
41 ::is( getcwd, catdir($cwd, 't'), 'chdir() with no args' );
42 ::is( $CWD, catdir($cwd, 't'), ' $CWD follows' );
45 # Final chdir() back to the original or we confuse the debugger.