1. Shlomi Fish
  2. perl-XML-LibXML

Commits

Shlomi Fish  committed 75809f4

Extract another method.

  • Participants
  • Parent commits 958eed8
  • Branches default

Comments (0)

Files changed (1)

File t/03doc.t

View file
     );
 }
 
+sub _count_children_by_name_ns
+{
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    my ($doc, $ns_and_name, $want_count, $blurb) = @_;
+
+    return _multi_arg_generic_count($doc, 'getChildrenByTagNameNS',
+        [$ns_and_name, $want_count, $blurb]
+    );
+}
+
 {
     print "# 1. Document Attributes\n";
 
             _count_children_by_name($A, 'C:B', 0, q{No C:B children});
             # TEST
             _count_children_by_name($A, "*", 2, q{2 Childern in $A in total});
-
-            my @as   = $A->getChildrenByTagNameNS( "*", "A" );
             # TEST
-            is( scalar( @as ), 2, ' TODO : Add test name');
-            @as   = $A->getChildrenByTagNameNS( "xml://D", "*" );
+            _count_children_by_name_ns($A, ['*', 'A'], 2, 
+                q{2 As of any namespace});
             # TEST
-            is( scalar( @as ), 1, ' TODO : Add test name');
-            @as   = $A->getChildrenByTagNameNS( "*", "*" );
+            _count_children_by_name_ns($A, [ "xml://D", "*" ], 1,
+                q{1 Child of D},
+            );
             # TEST
-            is( scalar( @as ), 2, ' TODO : Add test name');
+            _count_children_by_name_ns($A, [ "*", "*" ], 2,
+                q{2 Children in total},
+            );
             # TEST
             _count_children_by_local_name($A, 'A', 2, q{2 As});
         }