File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
main/java/org/exist/xquery/functions/map Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,10 @@ private Sequence merge(final Sequence[] args) throws XPathException {
250
250
251
251
final MergeDuplicates mergeDuplicates ;
252
252
if (args .length == 2 ) {
253
- final Sequence mapValue = ((MapType ) args [1 ]).get (new StringValue (this , "duplicates" ));
254
- if (mapValue != null ) {
253
+ final MapType map = (MapType ) args [1 ];
254
+ final StringValue key = new StringValue (this , "duplicates" );
255
+ if (map .contains (key )) {
256
+ final Sequence mapValue = map .get (key );
255
257
mergeDuplicates = MergeDuplicates .fromDuplicatesValue (mapValue .getStringValue ());
256
258
if (mergeDuplicates == null ) {
257
259
throw new XPathException (this , ErrorCodes .FOJS0005 , "value for duplicates key was not recognised: " + mapValue .getStringValue ());
Original file line number Diff line number Diff line change @@ -976,3 +976,16 @@ function mt:immutable-merge-duplicates-then-merge() {
976
976
$expected ne $result($mt:test-key-one)
977
977
)
978
978
};
979
+
980
+ (:~
981
+ : ensure that empty options map is allowed and behaves like
982
+ : map:merge#1
983
+ :)
984
+ declare
985
+ %test:assertTrue
986
+ function mt:map-merge-2-empty-options-map () {
987
+ let $maps := (mt:getMapFixture (), map { "Su" : "Sunnuntai" })
988
+ let $expected := map:merge ($maps)
989
+ let $actual := map:merge ($maps, map {})
990
+ return $expected?Su eq $actual?Su
991
+ };
You can’t perform that action at this time.
0 commit comments