File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,14 @@ function arr:function-item-invalid() {
137137declare
138138 %test:assertError("FOAY0001" )
139139function arr:get-item-out-of-bounds-positive () {
140+ let $a := [13 , 10 , 14 ]
141+ return
142+ array:get ($a, 4 )
143+ };
144+
145+ declare
146+ %test:assertError("FOAY0001" )
147+ function arr:get-item-out-of-bounds-positive-large () {
140148 let $a := [13 , 10 , 14 ]
141149 return
142150 array:get ($a, 22 )
@@ -158,6 +166,31 @@ function arr:get-item-out-of-bounds-negative() {
158166 array:get ($a, -1 )
159167};
160168
169+ declare
170+ %test:pending("eXist-db does not correctly detect the type error. This is likely a larger issue than just arrays." )
171+ %test:assertError("XPTY0004" )
172+ function arr:get-invalid-type () {
173+ let $a := [13 , 10 , 14 ]
174+ return
175+ array:get ($a, xs:double (0.1 ))
176+ };
177+
178+ declare
179+ %test:assertEquals(13 )
180+ function arr:get-first () {
181+ let $a := [13 , 10 , 14 ]
182+ return
183+ array:get ($a, 1 )
184+ };
185+
186+ declare
187+ %test:assertEquals(14 )
188+ function arr:get-last () {
189+ let $a := [13 , 10 , 14 ]
190+ return
191+ array:get ($a, 3 )
192+ };
193+
161194declare
162195 %test:args(1 )
163196 %test:assertEmpty
You can’t perform that action at this time.
0 commit comments