You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2014/06/25 10:05:13 UTC
svn commit: r1605287 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
Author: kahatlen
Date: Wed Jun 25 08:05:13 2014
New Revision: 1605287
URL: http://svn.apache.org/r1605287
Log:
DERBY-6634: Improve test coverage of SqlXmlUtil.java
Add missing test cases for:
- XMLQUERY that returns an atomic boolean
- XMLEXISTS where the query returns an atomic value
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java?rev=1605287&r1=1605286&r2=1605287&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java Wed Jun 25 08:05:13 2014
@@ -1481,6 +1481,27 @@ public final class XMLTypeAndOpsTest ext
JDBC.assertFullResultSet(rs, expRS, true);
+ // If the query returns an atomic value (not a sequence), the XMLEXISTS
+ // operator should return TRUE.
+
+ expRS = new String[][] {
+ { "true" },
+ { "true" },
+ { "true" },
+ { "true" },
+ { "true" },
+ };
+
+ JDBC.assertFullResultSet(
+ st.executeQuery(
+ "select xmlexists('1+1' passing by ref x) from xqExists3"),
+ expRS);
+
+ JDBC.assertFullResultSet(
+ st.executeQuery(
+ "select xmlexists('1=2' passing by ref x) from xqExists3"),
+ expRS);
+
// Cleanup.
st.executeUpdate("drop table xqExists1");
@@ -2674,6 +2695,9 @@ public final class XMLTypeAndOpsTest ext
{ "0 div 0", "NaN" },
{ "3.14 div 0", "Infinity" },
{ "-3.14 div 0", "-Infinity" },
+ // Not strictly numeric, but let's test boolean too
+ { "1=1", "true" },
+ { "1=2", "false" },
};
Statement s = createStatement();