Skip to content

Commit edf9493

Browse files
author
Tadeusz Sośnierz
committed
Add tests for nqp::existspos
1 parent f88e4e8 commit edf9493

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

t/nqp/59-nqpop.t

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Test nqp::op pseudo-functions.
44

5-
plan(94);
5+
plan(101);
66

77

88
ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
@@ -129,3 +129,14 @@ my %hash;
129129
%hash<foo> := 1;
130130
ok( nqp::existskey(%hash,"foo"),"existskey with existing key");
131131
ok( !nqp::existskey(%hash,"bar"),"existskey with missing key");
132+
133+
my @arr;
134+
@arr[1] := 3;
135+
ok(!nqp::existspos(@arr, 0), 'existspos with missing pos');
136+
ok(nqp::existspos(@arr, 1), 'existspos with existing pos');
137+
ok(!nqp::existspos(@arr, 2), 'existspos with missing pos');
138+
ok(nqp::existspos(@arr, -1), 'existspos with existing pos');
139+
ok(!nqp::existspos(@arr, -2), 'existspos with missing pos');
140+
ok(!nqp::existspos(@arr, -100), 'existspos with absurd values');
141+
@arr[1] := NQPMu;
142+
ok(nqp::existspos(@arr, 1), 'existspos with still existing pos');

0 commit comments

Comments
 (0)