Commits

Anonymous committed 0b3fd3d

Initial support for directory types.

Comments (0)

Files changed (2)

File-Dir-Dumper/lib/File/Dir/Dumper/Scanner.pm

     }
     else
     {
-        if (! $result->is_dir())
+        if ($result->is_dir())
+        {
+             push @{$self->_queue()},
+                {
+                    type => "dir",
+                    filename => $result->full_components()->[-1],
+                    depth => scalar(@{$result->full_components()}),
+                };
+        }
+        else
         {
             my @stat = stat($result->path());
             push @{$self->_queue()},

File-Dir-Dumper/t/dumper.t

 use strict;
 use warnings;
 
-use Test::More tests => 9;
+use Test::More tests => 12;
 
 use POSIX qw(mktime strftime);
 use File::Path;
     # TEST
     is ($token->{depth}, 1, "Token depth is 1");
 
+    $token = $scanner->fetch();
+
+    # TEST
+    is ($token->{type}, "dir", "Token is dir");
+
+    # TEST
+    is ($token->{depth}, 1, "Token depth is 1");
+
+    # TEST
+    is ($token->{filename}, "b", "dir name is 'b'");
+
     rmtree($t->get_path($test_dir))
 }