Update of /cvsroot/perl-xml/XML-LibXML-XPathContext/t
In directory sc8-pr-cvs1:/tmp/cvs-serv6905/t
Modified Files:
02-functions.t
Log Message:
- large nodelists test
Index: 02-functions.t
===================================================================
RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/02-functions.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 02-functions.t 20 Mar 2003 17:10:00 -0000 1.3
+++ 02-functions.t 21 Mar 2003 16:27:49 -0000 1.4
@@ -1,6 +1,6 @@
# -*- cperl -*-
use Test;
-BEGIN { plan tests => 19 };
+BEGIN { plan tests => 22 };
use XML::LibXML;
use XML::LibXML::XPathContext;
@@ -67,9 +67,24 @@
$xc->registerFunction('new-chunk',
sub {
- XML::LibXML->new->parse_string('<x><a/><a/><a/></x>')->find('/x/*')
+ XML::LibXML->new->parse_string('<x><a/><a/><a/></x>')->find('//*')
});
-ok($xc->findnodes('new-chunk()')->size() == 3);
+ok($xc->findnodes('new-chunk()')->size() == 4);
my ($x)=$xc->findnodes('new-chunk()/parent::*');
ok($x->nodeName() eq 'x');
ok($xc->findvalue('name(new-chunk()/parent::*)') eq 'x');
+
+my $largedoc=XML::LibXML->new->parse_string('<a>'.('<b/>' x 3000).'</a>');
+$xc->setContextNode($largedoc);
+$xc->registerFunction('pass1',
+ sub {
+ [$largedoc->findnodes('(//*)')]
+ });
+$xc->registerFunction('pass2',sub { $_[0] } );
+$xc->registerVarLookupFunc( sub { [$largedoc->findnodes('(//*)')] }, undef);
+$largedoc->toString();
+
+ok($xc->find('$a[name()="b"]')->size()==3000);
+my @pass1=$xc->findnodes('pass1()');
+ok(@pass1==3001);
+ok($xc->find('pass2(//*)')->size()==3001);
|