Update of /cvsroot/perl-xml/XML-LibXML-XPathContext/t
In directory sc8-pr-cvs1:/tmp/cvs-serv858/t
Modified Files:
01-variables.t 00-xpathcontext.t
Log Message:
fixed bugs in new(), setContextNode(), and register* causing loosing
stored context data passed from a variable if the variable itself gets
changed
Index: 01-variables.t
===================================================================
RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/01-variables.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- 01-variables.t 26 Mar 2003 15:26:47 -0000 1.3
+++ 01-variables.t 4 Apr 2003 18:42:57 -0000 1.4
@@ -1,6 +1,6 @@
# -*- cperl -*-
use Test;
-BEGIN { plan tests => 31 };
+BEGIN { plan tests => 33 };
use XML::LibXML;
use XML::LibXML::XPathContext;
@@ -76,3 +76,10 @@
$xc->unregisterVarLookupFunc();
eval { $xc->find('$a') };
ok($@);
+
+my $foo='foo';
+$xc->registerVarLookupFunc(sub {},$foo);
+ok($xc->getVarLookupData eq 'foo');
+$foo=undef;
+ok($xc->getVarLookupData eq 'foo');
+
Index: 00-xpathcontext.t
===================================================================
RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/00-xpathcontext.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- 00-xpathcontext.t 2 Apr 2003 14:15:55 -0000 1.5
+++ 00-xpathcontext.t 4 Apr 2003 18:42:58 -0000 1.6
@@ -1,5 +1,5 @@
use Test;
-BEGIN { plan tests => 21 };
+BEGIN { plan tests => 23 };
use XML::LibXML;
use XML::LibXML::XPathContext;
@@ -70,6 +70,10 @@
ok(!defined($xc4->getContextNode));
eval { $xc4->find('/') };
ok($@);
-$xc4->setContextNode($doc2->getDocumentElement);
+my $cn=$doc2->getDocumentElement;
+$xc4->setContextNode($cn);
ok($xc4->find('/'));
+ok($xc4->getContextNode->isSameNode($doc2->getDocumentElement));
+$cn=undef;
+ok($xc4->getContextNode);
ok($xc4->getContextNode->isSameNode($doc2->getDocumentElement));
|