Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

52 lines (42 sloc) 1.724 kB
use v6;
use Test;
plan 15;
# L<S32::IO/IO::Path>
my $path = '/foo/bar.txt'.IO;
isa-ok $path, IO::Path, "Str.IO returns an IO::Path";
is'/foo/bar.txt'), $path,
"Constructor works without named arguments";
"Can use either :basename or positional argument";
is</foo>, :basename<bar.txt>).cleanup, $path.cleanup,
"Can construct path from :dirname and :basename";
# This assumes slash-separated paths, so it will break on, say, VMS
is $path.volume, '', 'volume';
is $path.dirname, '/foo', 'dirname';
is $path.basename, 'bar.txt', 'basename';
#?niecza 2 skip '.parent NYI'
is $path.parent, '/foo', 'parent';
is $path.parent.parent, '/', 'parent of parent';
#?niecza 2 skip '.is-absolute, .is-relative NYI'
is $, True, 'is-absolute';
is $, False, 'is-relative';
isa-ok $path.path, Str, 'IO::Path.path returns Str';
#?niecza skip 'IO::Handle still called IO'
isa-ok $path.IO, IO::Path, 'IO::Path.IO returns IO::Path';
# Try to guess from context that the correct backend is loaded:
#?niecza skip 'is-absolute NYI'
#?DOES 2
if $* eq any <win32 mswin32 os2 dos symbian netware> {
ok "c:\\", "Win32ish OS loaded (volume)";
is "/".IO.cleanup, "\\", "Win32ish OS loaded (back slash)"
elsif $* eq 'cygwin' {
ok "c:\\", "Cygwin OS loaded (volume)";
is "/".IO.cleanup, "/", "Cygwin OS loaded (forward slash)"
else { # assume POSIX
nok "c:\\", "POSIX OS loaded (no volume)";
is "/".IO.cleanup, "/", "POSIX OS loaded (forward slash)"
Jump to Line
Something went wrong with that request. Please try again.