Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get chdir() test up to (newio) spec
  • Loading branch information
lizmat committed Feb 24, 2015
1 parent 7fd4756 commit caf44a2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions S32-io/chdir.t
Expand Up @@ -10,9 +10,6 @@ eval_dies_ok ' chdir() ', 'Cannot call chdir without an argument';
### Although you can use Unix style folder separator / to set folders, what's returned
### is in the native style, such as \ for windows
my $sep = '/';
if $*DISTRO.is-win {
$sep = '\\';
}

# change to t subfolder and see if cwd is updated
my $subdir = 't';
Expand All @@ -21,18 +18,18 @@ if $subdir.IO !~~ :d {
}
else {
my $cwd = $*CWD;
ok chdir("$*CWD/$subdir"), 'chdir gave a true value';
ok chdir("$*CWD$subdir"), 'chdir gave a true value';
isnt $*CWD, $cwd, 'Directory has changed';
is $*CWD, "$cwd$sep$subdir",
is $*CWD, "$cwd$subdir/",
"Current directory is '$subdir' subfolder (absolute)";

# relative change back up.
ok chdir( ".." ), 'chdir gave a true value';
is $*CWD, $cwd, 'Change back up to .. worked';

# relative change to t
ok chdir( "$subdir" ), 'chdir gave a true value';
is $*CWD, "$cwd$sep$subdir",
ok chdir( $subdir ), 'chdir gave a true value';
is $*CWD, "$cwd$subdir/",
"Current directory is '$subdir' subfolder (relative)";
}

Expand All @@ -41,8 +38,7 @@ if $no_subdir.IO ~~ :d {
skip "subdir '$no_subdir' does exist, actually.", 2;
}
else {
#?rakudo 2 skip 'spec non-conformance due to missing sink context'
lives_ok { chdir("$no_subdir") },
lives_ok { chdir("$no_subdir") // 1 },
'chdir to a non-existent does not by default throw an exception';
ok !chdir("$no_subdir"),
'change to non-existent directory gives a false value';
Expand Down

0 comments on commit caf44a2

Please sign in to comment.