Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 2089bdb

Implemented the footer token and the undef's afterwards.

  • Participants
  • Parent commits d86efce

Comments (0)

Files changed (2)

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

 __PACKAGE__->mk_accessors(
     qw(
     _file_find
+    _last_result
     _queue
-    _last_result
+    _reached_end
     )
 );
 
 {
     my $self = shift;
 
+    if ($self->_reached_end())
+    {
+        return;
+    }
+
     my $result = $self->_file_find->next_obj();
 
     if (! $self->_last_result())
     elsif (! $result)
     {
         $self->_up_to_level(-1);
+
+        $self->_add({type => "footer"});
+
+        $self->_reached_end(1);
     }
     else
     {

File File-Dir-Dumper/t/dumper.t

 use strict;
 use warnings;
 
-use Test::More tests => 26;
+use Test::More tests => 28;
 
 use POSIX qw(mktime strftime);
 use File::Path;
 
     # TEST
     is ($token->{depth}, 0, "Token depth is 0");
+    
+    $token = $scanner->fetch();
+
+    # TEST
+    is ($token->{type}, "footer", "Token is footer");
+
+    $token = $scanner->fetch();
+
+    # TEST
+    ok (!defined($token), "Token is undefined - reached end.");
 
     rmtree($t->get_path($test_dir))
 }