|
From: Petr P. <pa...@us...> - 2003-03-20 17:10:35
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext/t
In directory sc8-pr-cvs1:/tmp/cvs-serv28371/t
Modified Files:
02-functions.t
Log Message:
added node pool
Index: 02-functions.t
===================================================================
RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/02-functions.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- 02-functions.t 20 Mar 2003 13:55:24 -0000 1.2
+++ 02-functions.t 20 Mar 2003 17:10:00 -0000 1.3
@@ -1,6 +1,6 @@
# -*- cperl -*-
use Test;
-BEGIN { plan tests => 15 };
+BEGIN { plan tests => 19 };
use XML::LibXML;
use XML::LibXML::XPathContext;
@@ -57,5 +57,19 @@
eval { $xc->findnodes('test-lock2()') };
ok($@);
+# function creating new nodes
+$xc->registerFunction('new-foo',
+ sub {
+ return $doc->createElement('foo');
+ });
+ok($xc->findnodes('new-foo()')->pop()->nodeName eq 'foo');
+my ($test_node) = $xc->findnodes('new-foo()');
-
+$xc->registerFunction('new-chunk',
+ sub {
+ XML::LibXML->new->parse_string('<x><a/><a/><a/></x>')->find('/x/*')
+ });
+ok($xc->findnodes('new-chunk()')->size() == 3);
+my ($x)=$xc->findnodes('new-chunk()/parent::*');
+ok($x->nodeName() eq 'x');
+ok($xc->findvalue('name(new-chunk()/parent::*)') eq 'x');
|