Commits

Shlomi Fish committed 1c292a9

Convert start_document to Counter in t/14sax.t.

Comments (0)

Files changed (1)

 use strict;
 use warnings;
 
+use lib './t/lib';
+
+use Counter;
+
 use Test::More tests => 55;
 
 # BEGIN { plan tests => 55 }
 # TEST
 ok(1, 'Loaded');
 
+my $SAXTester_start_document_counter = Counter->new(
+    {
+        gen_cb => sub {
+            my $inc_cb = shift;
+
+            sub {
+                $inc_cb->();
+                return;    
+            }
+        }
+    }
+);
+
 # TEST
 ok(XML::SAX->add_parser(q(XML::LibXML::SAX::Parser)), 'add_parser is successful.');
 
 
 $generator->generate($doc); # SAXTester::start_document
 
+# TEST
+$SAXTester_start_document_counter->test(1, 'start_document called once.');
+
 my $builder = XML::LibXML::SAX::Builder->new();
 # TEST
 ok($builder, ' TODO : Add test name');
 ok($parser, ' TODO : Add test name');
 $parser->parse_uri("example/dromeds.xml");
 
+# TEST
+$SAXTester_start_document_counter->test(1, 'start_document called once.');
+
 $parser->parse_string(<<EOT);
 <?xml version='1.0' encoding="US-ASCII"?>
 <dromedaries one="1" />
 EOT
+# TEST
+$SAXTester_start_document_counter->test(1, 'start_document called once.');
 
 $sax = SAXNSTester->new;
 # TEST
 }
 
 sub start_document {
-  # TEST*3
-  ok(1, 'SAXTester::start_document');
+
+  $SAXTester_start_document_counter->cb()->();
+
+  return;
 }
 
 sub end_document {