Author: mbenson Date: Tue Jul 10 12:29:34 2007 New Revision: 555050 URL: http://svn.apache.org/viewvc?view=rev&rev=555050 Log: [JXPATH-94] equality test for multi-valued variables does not conform to spec
Modified: jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java Modified: jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java?view=diff&rev=555050&r1=555049&r2=555050 ============================================================================== --- jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java (original) +++ jakarta/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/compiler/CoreOperationCompare.java Tue Jul 10 12:29:34 2007 @@ -54,11 +54,19 @@ // (l == null ? "null" : l.getClass().getName()) + " " + // (r == null ? "null" : r.getClass().getName())); - if (l instanceof InitialContext || l instanceof SelfContext) { + if (l instanceof InitialContext) { + ((EvalContext) l).reset(); + } + + if (l instanceof SelfContext) { l = ((EvalContext) l).getSingleNodePointer(); } - if (r instanceof InitialContext || r instanceof SelfContext) { + if (r instanceof InitialContext) { + ((EvalContext) r).reset(); + } + + if (r instanceof SelfContext) { r = ((EvalContext) r).getSingleNodePointer(); } Modified: jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java?view=diff&rev=555050&r1=555049&r2=555050 ============================================================================== --- jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java (original) +++ jakarta/commons/proper/jxpath/trunk/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java Tue Jul 10 12:29:34 2007 @@ -272,4 +272,10 @@ assertXPathValue(context, "count($a | /document/vendor/location)", new Double(3)); assertXPathValue(context, "count($a | /list)", new Double(7)); //$o + list which contains six discrete values (one is duped, wrapped in a Container) } + + public void testIterateVariable() throws Exception { + assertXPathValueIterator(context, "$d", list("a", "b")); + assertXPathValue(context, "$d = 'a'", Boolean.TRUE); + assertXPathValue(context, "$d = 'b'", Boolean.TRUE); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]