Shlomi Fish avatar Shlomi Fish committed 5673acc

Convert close_hash to Counter.

Comments (0)

Files changed (1)

t/27new_callbacks_simple.t

     }
 );
 
+my $close_hash_counter = Counter->new(
+    {
+        gen_cb => sub {
+            my $inc_cb = shift;
+
+            sub {
+                my $h   = shift;
+                undef $h;
+                $inc_cb->();
+
+                return;
+            }
+        }
+    }
+);
+
 my $read_hash_counter = Counter->new(
     {
         gen_cb => sub {
 ok($icb2, ' TODO : Add test name');
 
 $icb2->register_callbacks( [ $match_hash_counter->cb(), $open_hash_counter->cb(),
-                             $read_hash_counter->cb(), \&close_hash ] );
+                             $read_hash_counter->cb(), $close_hash_counter->cb() ] );
 
 $parser->input_callbacks($icb2);
 $doc = $parser->parse_string($string);
 $read_hash_counter->test(6, 'read_hash called six times.');
 
 # TEST
+$close_hash_counter->test(1, 'close_hash called once.');
+
+# TEST
 ok($doc, ' TODO : Add test name');
 
 # TEST
 
 is($doc->string_value(),"testbar..", ' TODO : Add test name');
 
-# --------------------------------------------------------------------- #
-# callback set 2 (perl hash reader)
-# --------------------------------------------------------------------- #
-
-sub close_hash {
-        my $h   = shift;
-        undef $h;
-        # TEST
-        ok(1, 'close_hash');
-}
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.