Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

use smartmatch to compare paths #1

Merged
merged 1 commit into from

2 participants

@FROGGS

Be aware that this will only work on a rakudo as of today or newer.
But without this patch the tests will fail on Win32 and panda will do like nothing. So bumping the submodule version in panda is also needed.

@tadzik tadzik closed this
@tadzik tadzik reopened this
@tadzik tadzik merged commit 04761f4 into tadzik:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 14, 2014
  1. @FROGGS

    use smartmatch to compare paths

    FROGGS authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 5 deletions.
  1. +9 −5 t/01-file-find.t
View
14 t/01-file-find.t
@@ -5,13 +5,13 @@ plan 10;
my $res = find(:dir<t/dir1>);
my @test = $res.map({ .Str }).sort;
-is @test, <t/dir1/another_dir t/dir1/another_dir/empty_file t/dir1/another_dir/file.bar t/dir1/file.bar t/dir1/file.foo t/dir1/foodir t/dir1/foodir/not_a_dir>, 'just a dir';
+equals @test, <t/dir1/another_dir t/dir1/another_dir/empty_file t/dir1/another_dir/file.bar t/dir1/file.bar t/dir1/file.foo t/dir1/foodir t/dir1/foodir/not_a_dir>, 'just a dir';
# names
$res = find(:dir<t/dir1>, :name(/foo/));
@test = $res.map({ .Str }).sort;
-is @test, <t/dir1/file.foo t/dir1/foodir t/dir1/foodir/not_a_dir>, 'name with regex';
+equals @test, <t/dir1/file.foo t/dir1/foodir t/dir1/foodir/not_a_dir>, 'name with regex';
# (default) recursive find
@@ -30,15 +30,15 @@ is $res.elems, 0, 'no results';
$res = find(:dir<t/dir1>, :type<dir>);
@test = $res.map({ .Str }).sort;
-is @test, <t/dir1/another_dir t/dir1/foodir>, 'types: dir';
+equals @test, <t/dir1/another_dir t/dir1/foodir>, 'types: dir';
$res = find(:dir<t/dir1>, :type<dir>, :name(/foo/));
@test = $res.map({ .Str }).sort;
-is @test, <t/dir1/foodir>, 'types: dir, combined with name';
+equals @test, <t/dir1/foodir>, 'types: dir, combined with name';
$res = find(:dir<t/dir1>, :type<file>, :name(/foo/));
@test = $res.map({ .Str }).sort;
-is @test, <t/dir1/file.foo t/dir1/foodir/not_a_dir>,
+equals @test, <t/dir1/file.foo t/dir1/foodir/not_a_dir>,
'types: file, combined with name';
#keep-going
@@ -71,4 +71,8 @@ if 0 {
LEAVE { &dir.unwrap($w); }
}
+sub equals(\a, \b, $name) {
+ ok ([&&] a >>~~<< b.map(*.path)), $name
+}
+
exit 0; # I have no idea what I'm doing, but I get Non-zero exit status w/o this
Something went wrong with that request. Please try again.