Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from FROGGS/master

use smartmatch to compare paths
  • Loading branch information...
commit 04761f422b9b821d5db28c7df489dc416fb28f84 2 parents cd3769d + cf6aa47
@tadzik authored
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

0 comments on commit 04761f4

Please sign in to comment.
Something went wrong with that request. Please try again.