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() {
137
137
declare
138
138
%test:assertError("FOAY0001" )
139
139
function 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 () {
140
148
let $a := [13 , 10 , 14 ]
141
149
return
142
150
array:get ($a, 22 )
@@ -158,6 +166,31 @@ function arr:get-item-out-of-bounds-negative() {
158
166
array:get ($a, -1 )
159
167
};
160
168
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
+
161
194
declare
162
195
%test:args(1 )
163
196
%test:assertEmpty
You can’t perform that action at this time.
0 commit comments