Skip to content

Commit

Permalink
Test changes for newio branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Dec 20, 2014
1 parent d91bcc4 commit c8f613e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion S16-io/cwd.t
Expand Up @@ -5,6 +5,7 @@ use Test;

plan 3;

isa_ok $*CWD, IO::Path;
#?rakudo todo 'still in newio branch'
isa_ok $*CWD, IO::Dir;
lives_ok { $*CWD.perl }, '$*CWD.perl works';
lives_ok { $*CWD.gist }, '$*CWD.gist works';
3 changes: 2 additions & 1 deletion S16-io/tmpdir.t
Expand Up @@ -4,6 +4,7 @@ use Test;

plan 3;

isa_ok $*TMPDIR, IO::Path;
#?rakudo todo 'still in newio branch'
isa_ok $*TMPDIR, IO::Dir;
lives_ok { $*TMPDIR.perl }, '$*TMPDIR.perl works';
lives_ok { $*TMPDIR.gist }, '$*TMPDIR.gist works';
22 changes: 11 additions & 11 deletions S22-package-format/local.t
Expand Up @@ -14,12 +14,12 @@ my $module := 'NanooNanoo';
my $srcext := 'pm';
my $src := "$module.$srcext";
my $base := "$cwd/t/spec/S22-package-format";
my $srcdir := "$base/local-file-src";
my $srcsrc := $*KERNEL.name eq 'win32' ?? "$srcdir\\$src" !! "$srcdir/$src";
my $srcdir := "$base/local-file-src/";
my $srcsrc := $srcdir ~ $src;
my $cmpext := $*VM.precomp-ext;
my $cmpdir := "$base/local-file-cmp";
my $cmpsrc := "$cmpdir/$src"; # should not exist
my $cmpcmp := "$cmpdir/$src.$cmpext";
my $cmpdir := "$base/local-file-cmp/";
my $cmpsrc := $cmpdir ~ $src; # should not exist
my $cmpcmp := "$cmpdir$src.$cmpext";

# creating dirs / files needed
my $initialized = True; # try to cleanup from here on out
Expand All @@ -34,8 +34,8 @@ ok signal(SIGINT).tap( {die} ), 'install Ctrl-C handler for cleanup in END';
# basic CURLF sanity
my $curlf1 = CompUnitRepo::Local::File.new($cwd);
isa_ok $curlf1, CompUnitRepo::Local::File;
isa_ok $curlf1.path, IO::Path;
is $curlf1.path, $cwd, 'is . looking at the right directory';
isa_ok $curlf1.IO, IO::Path;
is $curlf1.IO, $cwd, 'is . looking at the right directory';
is $curlf1.short-id, 'file', 'is the short-id right';
dies_ok { $curlf1.install( "foo" ) }, 'Cannot install on CUR::File';

Expand All @@ -46,8 +46,8 @@ ok $curlf1 === $curlf2, 'are they the same';
my $curlf = CompUnitRepo::Local::File.new($srcdir);
isa_ok $curlf, CompUnitRepo::Local::File;
ok $curlf2 !=== $curlf, 'are they different';
isa_ok $curlf.path, IO::Path;
is $curlf.path, IO::Path.new($srcdir), "is '$srcdir' looking at the right dir";
isa_ok $curlf.IO, IO::Path;
is $curlf.IO, IO::Path.new($srcdir), "is '$srcdir' looking at the right dir";

# all candidates
my $candidates = $curlf.candidates('NanooNanoo');
Expand All @@ -70,7 +70,7 @@ is $candidates.elems, 0, "did we get 0 candidates";
is $compunit-src.from, 'Perl6', "is the language 'Perl6'";
is $compunit-src.name, $module, "is the name '$module'";
is $compunit-src.extension, $srcext, "is the extension '$srcext'";
is $compunit-src.path, $srcsrc, "is the path '$srcsrc'";
is $compunit-src.abspath, $srcsrc, "is the abspath '$srcsrc'";
is $compunit-src.is-loaded, False, "is the module is-loaded";
is $compunit-src.has-source, True, "do we have the source?";
is $compunit-src.has-precomp, False, "is the module pre-compiled";
Expand All @@ -89,7 +89,7 @@ isa_ok $compunit-cmp, CompUnit;
is $compunit-cmp.from, 'Perl6', "is the language 'Perl6'";
is $compunit-cmp.name, $module, "is the name '$module'";
is $compunit-cmp.extension, $srcext, "is the extension '$srcext'";
is $compunit-cmp.path, $cmpsrc, "is the path '$cmpsrc'";
is $compunit-cmp.abspath, $cmpsrc, "is the path '$cmpsrc'";
is $compunit-cmp.is-loaded, False, "is the module is-loaded";
is $compunit-cmp.has-source, False, "don't we have the source?";
is $compunit-cmp.has-precomp, True, "is the module pre-compiled";
Expand Down
4 changes: 2 additions & 2 deletions S32-io/io-path-win.t
Expand Up @@ -5,7 +5,7 @@ use Test;
plan 49;

my $*SPEC = IO::Spec::Win32; # .IO needs to have IO::Spec::Win32
my $*CWD = 'C:\\zip\\loc'.IO;
my $*CWD = 'C:\\zip\\loc\\'; # for the sake of testing here, it's just a string

my $relpath = IO::Path::Win32.new('foo\\bar' );
my $abspath = IO::Path::Win32.new('\\foo\\bar');
Expand Down Expand Up @@ -61,7 +61,7 @@ is IO::Path::Win32.new("\\usr\\bin").relative("/usr"), "bin", "rel

is $relpath.absolute.IO.relative, "foo\\bar", "relative inverts absolute";
is $relpath.absolute("/foo").IO.relative("\\foo"), "foo\\bar","absolute inverts relative";
#?rakudo 1 todo 'resolve NYI, needs nqp::readlink'
#?rakudo 1 skip 'resolve NYI, needs nqp::readlink'
is $abspath.relative.IO.absolute.IO.resolve, "\\foo\\bar", "absolute inverts relative with resolve";

is IO::Path::Win32.new("foo/bar").parent, "foo", "parent of 'foo/bar' is 'foo'";
Expand Down
3 changes: 2 additions & 1 deletion S32-io/io-spec-unix.t
Expand Up @@ -193,6 +193,7 @@ if $*DISTRO.name ~~ any(<mswin32 os2 netware symbian dos cygwin>) {
}
else {
isa_ok $*SPEC, IO::Spec::Unix, "unix: loads correct module";
is $*SPEC.rel2abs( $*SPEC.curdir ), $*CWD, "rel2abs: \$*CWD test";
#?rakudo todo "awaiting newio merge"
is $*SPEC.rel2abs( $*SPEC.curdir ), $*CWD.chop, "rel2abs: \$*CWD test";
ok {.IO.d && .IO.w}.( $*SPEC.tmpdir ), "tmpdir: {$*SPEC.tmpdir} is a writable directory";
}

0 comments on commit c8f613e

Please sign in to comment.