Skip to content

Commit 3b36d4d

Browse files
committed
[io grant] Test IO::Path.sibling
Rakudo impl: rakudo/rakudo@8bacad8f84
1 parent dcedcc2 commit 3b36d4d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

S32-io/io-path.t

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use lib <t/spec/packages/>;
33
use Test;
44
use Test::Util;
55

6-
plan 30;
6+
plan 31;
77

88
# L<S32::IO/IO::Path>
99

@@ -221,3 +221,22 @@ subtest 'secureness of .child' => {
221221
'resolved parent fails (given path is not a child, via combiners)';
222222
}
223223
}
224+
225+
subtest '.sibling' => {
226+
my @path-types = IO::Path, IO::Path::Cygwin, IO::Path::QNX, IO::Path::Unix,
227+
IO::Path::Win32;
228+
my @tests = 'foo' => 'bar', '/foo' => '/bar', '../foo' => '../bar',
229+
'C:/foo' => 'C:/bar', 'C:/foo/../meow' => 'C:/foo/../bar',
230+
'/' => '/bar', './' => 'bar', '/foo/' => '/bar', '/foo/.' => '/foo/bar';
231+
plan 1 + @tests * @path-types;
232+
233+
for @tests -> (:key($start-path), :value($res-path)) {
234+
for @path-types -> $Path {
235+
is-path $Path.new($start-path).sibling('bar'), $Path.new($res-path),
236+
"$Path.perl() with $start-path.perl()";
237+
}
238+
}
239+
240+
is-path IO::Path::Win32.new('C:/').sibling('bar'),
241+
IO::Path::Win32.new('C:/bar'), '"C:/" with IO::Path::Win32';
242+
}

0 commit comments

Comments
 (0)