Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some intermediate dir() fudging
  • Loading branch information
lizmat committed Nov 3, 2014
1 parent ac87c83 commit 0277bfb
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions S32-io/dir.t
Expand Up @@ -9,21 +9,25 @@ my @files;
ok (@files = dir()), "dir() runs in cwd()";

# see roast's README as for why there is always a t/ available
#?niecza skip "Grepping Str against a list of IO::Path does not work"
ok @files.grep('t'), 'current directory contains a t/ dir';
#?niecza skip "Grepping Str against a list of IO::Local does not work"
#?rakudo todo 'directories are not marked with trailing / yet'
ok @files>>.relative.grep('t/'), 'current directory contains a t/ dir';
ok @files.grep(*.basename eq 't'), 'current directory contains a t/ dir';
isa_ok @files[0], IO::Path, 'dir() returns IO::Path';
is @files[0].dirname, '.', 'dir() returns IO::Path object in the current directory';
#?rakudo todo 'entries are still IO::Path'
ok @files[0] ~~ IO::Local, 'dir() returns IO::Local';
#?rakudo todo 'dirname is not yet absolute'
is @files[0].dirname, $*CWD, 'dir() returns IO::Path object in the current directory';

#?niecza 3 skip "Grepping Str against a list of IO::Path does not work"
nok @files.grep('.'|'..'), '"." and ".." are not returned';
is +dir(:test).grep('.'|'..'), 2, "... unless you override :test";
nok dir( test=> none('.', '..', 't') ).grep('t'), "can exclude t/ dir";
#?niecza 3 skip "Grepping Str against a list of IO::Local does not work"
nok @files>>.relative.grep('.'|'..'), '"." and ".." are not returned';
is +dir(:test).grep(*.basename eq '.'|'..'), 2, "... unless you override :test";
nok dir( test=> none('.', '..', 't') ).grep(*.basename eq 't'), "can exclude t/ dir";

# previous tests rewritten to not smartmatch against IO::Path.
# previous tests rewritten to not smartmatch against IO::Local.
# Niecza also seems to need the ~, alas.
nok @files.grep(*.IO.basename eq '.'|'..'), '"." and ".." are not returned';
is +dir(:test).grep(*.IO.basename eq '.'|'..'), 2, "... unless you override :test";
nok @files.grep(*.basename eq '.'|'..'), '"." and ".." are not returned';
is +dir(:test).grep(*.basename eq '.'|'..'), 2, "... unless you override :test";
nok dir( test=> none('.', '..', 't') ).grep(*.basename eq 't'), "can exclude t/ dir";

is dir('t').[0].IO.dirname, 't', 'dir("t") returns paths with .dirname of "t"';
#?rakudo todo '$*CWD misses slash at end still'
is dir('t').[0].dirname, $*CWD ~ 't', 'dir("t") returns paths with .dirname of "t"';

0 comments on commit 0277bfb

Please sign in to comment.