Test remaining cases of #1938
This commit is contained in:
@ -95,6 +95,8 @@ public class DocumentNode extends BaseNodeInfo implements DocumentInfo, AstNodeO
|
||||
return new Navigator.DescendantEnumeration(this, true, true);
|
||||
case Axis.CHILD:
|
||||
return SingleNodeIterator.makeIterator(rootNode);
|
||||
case Axis.SELF:
|
||||
return SingleNodeIterator.makeIterator(this);
|
||||
default:
|
||||
return super.iterateAxis(axisNumber);
|
||||
}
|
||||
|
@ -64,6 +64,24 @@ public class SaxonXPathRuleQueryTest {
|
||||
Assert.assertEquals(dummy, result.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRootExpressionIsADocumentNode() {
|
||||
DummyNode dummy = new DummyNode(); // todo in pmd 7 this should be a RootNode
|
||||
|
||||
List<Node> result = assertQuery(1, "(/)[self::document-node()]", dummy);
|
||||
Assert.assertEquals(dummy, result.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRootExpressionWithName() {
|
||||
DummyNode dummy = new DummyNode(0, false, "DummyNodeA"); // todo in pmd 7 this should be a RootNode
|
||||
|
||||
List<Node> result = assertQuery(1, "(/)[self::document-node(element(DummyNodeA))]", dummy);
|
||||
Assert.assertEquals(dummy, result.get(0));
|
||||
|
||||
assertQuery(0, "(/)[self::document-node(element(DummyNodeX))]", dummy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ruleChainVisits() {
|
||||
SaxonXPathRuleQuery query = createQuery("//dummyNode[@Image='baz']/foo | //bar[@Public = 'true'] | //dummyNode[@Public = false()] | //dummyNode");
|
||||
|
Reference in New Issue
Block a user