[301539] [xpath2] adding a test case for the bug
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 d1af8d8..1630307 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
@@ -35,6 +35,8 @@ * Jesper S Moller - bug 297958 Fix fn:nilled for elements * Mukul Gandhi - bug 298519 improvements to fn:number implementation, catering * to node arguments. + * Mukul Gandhi - bug 301539 fix for "context undefined" bug in case of zero + * arity of fn:name function. *******************************************************************************/ package org.eclipse.wst.xml.xpath2.processor.test; @@ -1540,6 +1542,29 @@ assertEquals("true", actual); } + + public void testFnNameContextUndefined() throws Exception { + // Bug 301539 + URL fileURL = bundle.getEntry("/bugTestFiles/attrNodeTest.xml"); + loadDOMDocument(fileURL); + + // Get XML Schema Information for the Document + XSModel schema = getGrammar(); + + DynamicContext dc = setupDynamicContext(schema); + + String xpath = "Example/*[1]/name() eq 'x'"; + 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); + } private CollationProvider createLengthCollatorProvider() { return new CollationProvider() {