Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a test for only_files

  • Loading branch information...
commit 2a20070c9e6a28dc67619ba79793c47980ce0207 1 parent ff4946e
@nothingmuch authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 t/path_class.t
View
32 t/path_class.t
@@ -74,4 +74,36 @@ foreach my $dir ( $dist->subdir("t"), $dist->subdir("lib"), $dist ) {
"depth first traversal order",
);
}
+
+ {
+ my $paths = Data::Stream::Bulk::Path::Class->new(
+ dir => $dir,
+ chunk_size => 2,
+ depth_first => 0,
+ only_files => 1,
+ );
+
+ my $strings = $paths->filter(sub {[ grep { !/tmp/ } map { "$_" } @$_ ]});
+
+ my @rec;
+ $dir->recurse( callback => sub { push @rec, "$_[0]" if $_[0] !~ /tmp/ and -f $_[0] }, depthfirst => 0, preorder => 1 );
+
+ ok( !$_->is_done, "not done" ) for $paths, $strings;
+
+ my @all = $strings->all;
+
+ ok( $_->is_done, "done" ) for $paths, $strings;
+
+ is_deeply(
+ [ sort @all ],
+ [ sort @rec ],
+ "breadth first traversal path set",
+ );
+
+ is_deeply(
+ \@all,
+ \@rec,
+ "breadth first traversal order",
+ );
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.