More tests for SimpleObjectUnionConstructor
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/SimpleObjectUnionScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/SimpleObjectUnionScalarEvaluator.java
index 960cea4..4eaf8f7 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/SimpleObjectUnionScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/SimpleObjectUnionScalarEvaluator.java
@@ -64,7 +64,7 @@
op.getKeys(tempTvp);
addPairs(tempTvp, tempValue);
}
- } else {
+ } else if (arg.getTag() == ValueTag.OBJECT_TAG) {
op = (ObjectPointable) ObjectPointable.FACTORY.createPointable();
arg.getValue(op);
addPairs(tempTvp, tempValue);
diff --git a/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q17_object.xq b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q17_object.xq
new file mode 100644
index 0000000..77dcc2c
--- /dev/null
+++ b/vxquery-xtest/src/test/resources/Queries/XQuery/Json/Object/q17_object.xq
@@ -0,0 +1,20 @@
+(: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License. :)
+
+(: Json Object Query :)
+(: Issue VXQUERY-212 :)
+{| { "Captain" : "Kirk" , 123456 : "NUM"} , { "Captain" : "Soft"} |}
\ No newline at end of file
diff --git a/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml
index 1968853..fcb01e7 100644
--- a/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml
+++ b/vxquery-xtest/src/test/resources/cat/JsonObjectQueries.xml
@@ -100,4 +100,9 @@
<query name="q16_object" date="2016-07-16"/>
<output-file compare="Text">q16_object.txt</output-file>
</test-case>
+ <test-case name="json-object-q17" FilePath="Json/Object/" Creator="Riyafa Abdul Hameed">
+ <description>Object.</description>
+ <query name="q17_object" date="2016-07-26"/>
+ <expected-error>JNDY0003</expected-error>
+ </test-case>
</test-group>
\ No newline at end of file