Author: mbenson
Date: Fri Jul 13 12:43:38 2007
New Revision: 556124
URL: http://svn.apache.org/viewvc?view=rev&rev=556124
Log:
[JXPATH-93] fix nodeset handling for <,>,<=,>=
Modified:
jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java
Modified:
jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java?view=diff&rev=556124&r1=556123&r2=556124
==============================================================================
---
jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
(original)
+++
jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationRelationalExpression.java
Fri Jul 13 12:43:38 2007
@@ -39,8 +39,8 @@
}
public final Object computeValue(EvalContext context) {
- return compute(args[0].computeValue(context), args[1]
- .computeValue(context)) ? Boolean.TRUE : Boolean.FALSE;
+ return compute(args[0].compute(context), args[1].compute(context))
+ ? Boolean.TRUE : Boolean.FALSE;
}
protected final int getPrecedence() {
Modified:
jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java
URL:
http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java?view=diff&rev=556124&r1=556123&r2=556124
==============================================================================
---
jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java
(original)
+++
jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java
Fri Jul 13 12:43:38 2007
@@ -112,6 +112,21 @@
assertXPathValue(context, "$array < 0", Boolean.FALSE, Boolean.class);
}
+ public void testEmptyNodeSetOperations() {
+ assertXPathValue(context, "/idonotexist = 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "/idonotexist != 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "/idonotexist < 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "/idonotexist > 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "/idonotexist >= 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "/idonotexist <= 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] = 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] != 0",
Boolean.FALSE, Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] < 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] > 0", Boolean.FALSE,
Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] >= 0",
Boolean.FALSE, Boolean.class);
+ assertXPathValue(context, "$array[position() < 1] <= 0",
Boolean.FALSE, Boolean.class);
+ }
+
public void testNan() {
assertXPathValue(context, "$nan > $nan", Boolean.FALSE, Boolean.class);
assertXPathValue(context, "$nan < $nan", Boolean.FALSE, Boolean.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]