[353373] [xpath2] updating the test stubs to cover the changes for the "following" axis
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373.xml b/tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373_1.xml similarity index 100% rename from tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373.xml rename to tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373_1.xml
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373_2.xml b/tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373_2.xml new file mode 100644 index 0000000..5677ce1 --- /dev/null +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/bugTestFiles/bug353373_2.xml
@@ -0,0 +1,17 @@ +<x> + <uu> + <n1> + <a5/> + </n1> + </uu> + <p/> + <q/> + <c/> + <y> + <z/> + <m1> + <m2/> + </m1> + <u/> + </y> +</x> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java index a16a135..9518df3 100644 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java +++ b/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java
@@ -2462,7 +2462,7 @@ * public void testReverse_axes() throws Exception { // Bug 353373 - URL fileURL = bundle.getEntry("/bugTestFiles/bug353373.xml"); + URL fileURL = bundle.getEntry("/bugTestFiles/bug353373_1.xml"); loadDOMDocument(fileURL); // Get XML Schema Information for the Document @@ -2545,6 +2545,56 @@ } */ + /* "added for future use" + * + public void testForward_axes() throws Exception { + // Bug 353373 + URL fileURL = bundle.getEntry("/bugTestFiles/bug353373_2.xml"); + loadDOMDocument(fileURL); + + // Get XML Schema Information for the Document + XSModel schema = getGrammar(); + + DynamicContext dc = setupDynamicContext(schema); + + // test (a) + String xpath = "count(x/q/following-sibling::*) = 2"; + XPath path = compileXPath(dc, xpath); + Evaluator eval = new DefaultEvaluator(dc, domDoc); + ResultSequence rs = eval.evaluate(path); + XSBoolean result = (XSBoolean) rs.first(); + String actual = result.string_value(); + assertEquals("true", actual); + + // test (b) + xpath = "deep-equal((x/q/following-sibling::*[1]/name(),x/q/following-sibling::*[2]/name()),('c','y'))"; + path = compileXPath(dc, xpath); + eval = new DefaultEvaluator(dc, domDoc); + rs = eval.evaluate(path); + result = (XSBoolean) rs.first(); + actual = result.string_value(); + assertEquals("true", actual); + + // test (c) + xpath = "count(//a5/following::*) = 8"; + path = compileXPath(dc, xpath); + eval = new DefaultEvaluator(dc, domDoc); + rs = eval.evaluate(path); + result = (XSBoolean) rs.first(); + actual = result.string_value(); + assertEquals("true", actual); + + // test (d) + xpath = "deep-equal((//n1/following::*[1]/name(),//n1/following::*[2]/name(),//n1/following::*[3]/name(),//n1/following::*[4]/name(),//n1/following::*[5]/name(),//n1/following::*[6]/name(),//n1/following::*[7]/name(),//n1/following::*[8]/name())," + + "('p','q','c','y','z','m1','m2','u'))"; + path = compileXPath(dc, xpath); + eval = new DefaultEvaluator(dc, domDoc); + rs = eval.evaluate(path); + result = (XSBoolean) rs.first(); + actual = result.string_value(); + assertEquals("true", actual); + } */ + private CollationProvider createLengthCollatorProvider() { final CollationProvider oldProvider = getStaticContext().getCollationProvider(); return new CollationProvider() {