From: Ilya M. <m_...@us...> - 2003-03-20 10:16:29
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext/t In directory sc8-pr-cvs1:/tmp/cvs-serv15069/t Modified Files: 00-xpathcontext.t Log Message: Added test case for bug with changing context node Index: 00-xpathcontext.t =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/t/00-xpathcontext.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 00-xpathcontext.t 16 Mar 2003 16:21:28 -0000 1.2 +++ 00-xpathcontext.t 20 Mar 2003 10:16:25 -0000 1.3 @@ -1,5 +1,5 @@ use Test; -BEGIN { plan tests => 15 }; +BEGIN { plan tests => 16 }; use XML::LibXML; use XML::LibXML::XPathContext; @@ -46,9 +46,16 @@ ok($xc->findnodes('.')->pop->isSameNode($doc1->getDocumentElement)); # test xpath context preserves the document -my $xc2=XML::LibXML::XPathContext->new( - XML::LibXML->new->parse_string(<<'XML')); +my $xc2 = XML::LibXML::XPathContext->new( + XML::LibXML->new->parse_string(<<'XML')); <foo/> XML ok($xc2->findnodes('*')->pop->nodeName eq 'foo'); +# test xpath context preserves context node +my $doc2 = XML::LibXML->new->parse_string(<<'XML'); +<foo><bar/></foo> +XML +my $xc3 = XML::LibXML::XPathContext->new($doc2->getDocumentElement); +$xc3->find('/'); +ok($xc3->getContextNode->toString() eq '<foo><bar/></foo>'); |