Anonymous avatar Anonymous committed b089c36

Added more tests to ->next_obj() - they all pass.

Comments (0)

Files changed (1)

 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 37;
 
 BEGIN
 {
                 'subs' =>
                 [
                     {
+                        'name' => "file.txt",
+                        'contents' => "A file that should come before yet/",
+                    },
+                    {
                         'name' => "yet/",
                     },
                 ],
         is ($r->basename(), "b.doc", "Basename is 'b.doc'");
     }
 
-=begin Hello
-    is_deeply(
-        \@results,
-        [(map { $t->get_path("t/sample-data/traverse-1/$_") }
-            ("", qw(
-                a
-                b.doc
-                foo
-                foo/yet
-            ))),
-         undef
-        ],
-        "Checking for regular, lexicographically sorted order",
-    );
-=end Hello
+    {
+        my $r = $ff->next_obj();
 
-=cut
+        # TEST
+        is ($r->path(), $t->get_path("t/sample-data/traverse-1/foo"), "Path");
+
+        # TEST
+        is ($r->base(), $t->get_path("./t/sample-data/traverse-1"), "Base");
+
+        # TEST
+        is_deeply ($r->dir_components(), [qw(foo)], 
+            "Dir_Components are 'foo'"
+        );
+
+        # TEST
+        ok ($r->is_dir(), "Is a directory");
+
+        # TEST
+        is_deeply ($r->full_components(), [qw(foo)], 
+            "Full components are 'foo'"
+        );
+    }
+
+    {
+        my $r = $ff->next_obj();
+
+        # TEST
+        is ($r->path(), $t->get_path("t/sample-data/traverse-1/foo/file.txt"), 
+            "Path",
+        );
+
+        # TEST
+        is ($r->base(), $t->get_path("./t/sample-data/traverse-1"), 
+            "Base"
+        );
+
+        # TEST
+        is_deeply ($r->dir_components(), [qw(foo)], 
+            "Dir_Components are 'foo'"
+        );
+
+        # TEST
+        ok (!$r->is_dir(), "Not a directory");
+
+        # TEST
+        is_deeply ($r->full_components(), [qw(foo file.txt)], 
+            "Full components are 'foo/file.txt'"
+        );
+
+        # TEST
+        is ($r->basename(), "file.txt", "Basename is 'file.txt'");
+    }
+
+    {
+        my $r = $ff->next_obj();
+
+        # TEST
+        is ($r->path(), $t->get_path("t/sample-data/traverse-1/foo/yet"), 
+            "Path",
+        );
+
+        # TEST
+        is ($r->base(), $t->get_path("./t/sample-data/traverse-1"), "Base");
+
+        # TEST
+        is_deeply ($r->dir_components(), [qw(foo yet)], 
+            "Dir_Components are 'foo/yet'"
+        );
+
+        # TEST
+        ok ($r->is_dir(), "Is a directory");
+
+        # TEST
+        is_deeply ($r->full_components(), [qw(foo yet)], 
+            "Full components are 'foo/yet'"
+        );
+    }
 
     rmtree($t->get_path("./t/sample-data/traverse-1"))
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.