Commits

Tim Brody  committed 0dee306

Code-style plus t/-test for 984c99d192a5

  • Participants
  • Parent commits 984c99d

Comments (0)

Files changed (2)

File lib/XML/LibXML/NodeList.pm

     $self->[$pos - 1];
 }
 
-sub item {
-	my $self = CORE::shift;
-	my ($pos) = @_;
-	$self->[$pos];
+sub item
+{
+    my ($self, $pos) = @_;
+    return $self->[$pos];
 }
 
 sub get_nodelist {

File t/15nodelist.t

 use strict;
 use warnings;
 
-use Test::More tests => 26;
+use Test::More tests => 27;
 
 use XML::LibXML;
 use IO::Handle;
 # TEST
 ok($dom, ' TODO : Add test name');
 
+{
+	my $nodelist = $dom->documentElement->childNodes;
+	# 0 is #text
+	is($nodelist->item(1)->nodeName, 'BBB', 'item is 0-indexed');
+}
+
 my @nodelist = $dom->findnodes('//BBB');
 
 # TEST