[Practicalxml-commits] SF.net SVN: practicalxml:[65] trunk/src
Brought to you by:
kdgregory
|
From: Auto-Generated S. C. M. <pra...@li...> - 2008-12-29 01:56:42
|
Revision: 65
http://practicalxml.svn.sourceforge.net/practicalxml/?rev=65&view=rev
Author: kdgregory
Date: 2008-12-29 01:31:37 +0000 (Mon, 29 Dec 2008)
Log Message:
-----------
AbstractFunction: wasn't handling Number arguments
Modified Paths:
--------------
trunk/src/main/java/net/sf/practicalxml/xpath/AbstractFunction.java
trunk/src/test/java/net/sf/practicalxml/xpath/TestAbstractFunction.java
Modified: trunk/src/main/java/net/sf/practicalxml/xpath/AbstractFunction.java
===================================================================
--- trunk/src/main/java/net/sf/practicalxml/xpath/AbstractFunction.java 2008-12-29 00:42:26 UTC (rev 64)
+++ trunk/src/main/java/net/sf/practicalxml/xpath/AbstractFunction.java 2008-12-29 01:31:37 UTC (rev 65)
@@ -280,6 +280,8 @@
{
if (arg instanceof String)
helper = processArg(idx, (String)arg, helper);
+ else if (arg instanceof Number)
+ helper = processArg(idx, (Number)arg, helper);
else if (arg instanceof NodeList)
helper = processArg(idx, (NodeList)arg, helper);
else if (arg instanceof Node)
Modified: trunk/src/test/java/net/sf/practicalxml/xpath/TestAbstractFunction.java
===================================================================
--- trunk/src/test/java/net/sf/practicalxml/xpath/TestAbstractFunction.java 2008-12-29 00:42:26 UTC (rev 64)
+++ trunk/src/test/java/net/sf/practicalxml/xpath/TestAbstractFunction.java 2008-12-29 01:31:37 UTC (rev 65)
@@ -228,6 +228,22 @@
}
+ public void testEvaluateNumber() throws Exception
+ {
+ List args = Arrays.asList(new Object[] {Integer.valueOf(10)});
+ MyMockFunction fn = new MyMockFunction("zippy");
+
+ assertEquals("zippy", fn.evaluate(args));
+ assertEquals(1, fn._initCalls);
+ assertEquals(0, fn._processStringCalls);
+ assertEquals(1, fn._processNumberCalls);
+ assertEquals(0, fn._processBooleanCalls);
+ assertEquals(0, fn._procesNodeCalls);
+ assertEquals(0, fn._procesNodeListCalls);
+ assertEquals(1, fn._getResultCalls);
+ }
+
+
public void testEvaluateNode() throws Exception
{
// since any JDK Node implementation is also a NodeList, we have to
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|