Commits

Shlomi Fish committed f51809b

Convert open_hash to Counter.

Comments (0)

Files changed (1)

t/27new_callbacks_simple.t

 use lib './t/lib';
 
 use Counter;
+
 # $Id$
 
 # Should be 19.
     }
 );
 
+my $open_hash_counter = Counter->new(
+    {
+        gen_cb => sub {
+            my $inc_cb = shift;
+
+            sub {
+                my $uri = shift;
+                my $hash = { line => 0,
+                    lines => [ "<foo>", "bar", "<xsl/>", "..", "</foo>" ],
+                }; 
+                $inc_cb->();
+
+                return $hash;
+            }
+        }
+    }
+);
+
 $icb->register_callbacks( [ $match_file_counter->cb(), $open_file_counter->cb(),
                             $read_file_counter->cb(), $close_file_counter->cb() ] );
 
 
 ok($icb2, ' TODO : Add test name');
 
-$icb2->register_callbacks( [ $match_hash_counter->cb(), \&open_hash, 
+$icb2->register_callbacks( [ $match_hash_counter->cb(), $open_hash_counter->cb(),
                              \&read_hash, \&close_hash ] );
 
 $parser->input_callbacks($icb2);
 $match_hash_counter->test(1, 'match_file matched once.');
 
 # TEST
+$open_hash_counter->test(1, 'match_file matched once.');
+
+# TEST
 
 ok($doc, ' TODO : Add test name');
 # TEST
 # callback set 2 (perl hash reader)
 # --------------------------------------------------------------------- #
 
-sub open_hash {
-        my $uri = shift;
-        my $hash = { line => 0,
-                     lines => [ "<foo>", "bar", "<xsl/>", "..", "</foo>" ],
-                   };                
-        # TEST
-        ok(1, 'open_hash');
-
-        return $hash;
-}
-
 sub read_hash {
         my $h   = shift;
         my $buflen = shift;
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.