Commits

shl...@6f433eb9-a002-0410-945b-ee5462c261ee  committed 69de4b1

The nocrossfs option was fixed.

  • Participants
  • Parent commits 26cf38e

Comments (0)

Files changed (3)

     - Cleanup: moved some POD'ed out functions to under rejects/ .
     - Optimization: renamed _calc_next_obj() to next_obj(), as next_obj()
     just called it directly. Cleaned up the rest of the logic in next_obj().
+    - Bug fix: the nocrossfs option was fixed. Previously it used an undefined
+    method.
 
 0.1.7 - Thu Jan 15 16:09:49 IST 2009
     - Fixed the check-for-link and for directory semantics on Windows

File lib/File/Find/Object.pm

     }
     
     if ($self->nocrossfs()) {
-        push @clauses, '($s->_top_stat->[0] != $s->dev())';
+        push @clauses, '($s->_top_stat->[0] != $s->_dev())';
     }
 
     push @clauses, '$s->_is_loop()';

File t/03traverse.t

 use strict;
 use warnings;
 
-use Test::More tests => 42;
+use Test::More tests => 43;
 
 BEGIN
 {
 
     rmtree($t->get_path("./t/sample-data/traverse-1"));
 }
+
+{
+    my $tree =
+    {
+        'name' => "traverse-1/",
+        'subs' =>
+        [
+            {
+                'name' => "b.doc",
+                'contents' => "This file was spotted in the wild.",
+            },            
+            {
+                'name' => "a/",
+            },
+            {
+                'name' => "foo/",
+                'subs' =>
+                [
+                    {
+                        'name' => "yet/",
+                    },
+                ],
+            },
+        ],
+    };
+
+    my $t = File::Find::Object::TreeCreate->new();
+    $t->create_tree("./t/sample-data/", $tree);
+    my $ff = 
+        File::Find::Object->new(
+            {nocrossfs => 1,},
+            $t->get_path("./t/sample-data/traverse-1")
+        );
+    my @results;
+    for my $i (1 .. 6)
+    {
+        push @results, $ff->next();
+    }
+    # TEST
+    is_deeply(
+        \@results,
+        [(map { $t->get_path("t/sample-data/traverse-1/$_") }
+            ("", qw(
+                a
+                b.doc
+                foo
+                foo/yet
+            ))),
+         undef
+        ],
+        "Testing nocrossfs",
+    );
+
+    rmtree($t->get_path("./t/sample-data/traverse-1"));
+}