Skip to content

Commit 652b299

Browse files
committed
Basic tests for nqp::getlexrel, and nqp::existkeys with a outer variable
1 parent 1c3a513 commit 652b299

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

t/nqp/77-curlexpad.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plan(6);
1+
plan(9);
22
my $outer := "hello there";
33
sub foo() {
44
my $foo := "hello";
@@ -7,11 +7,15 @@ sub foo() {
77
ok(nqp::atkey($lexpad,'$foo') eq "hello","accessing a variable using nqp::curlexpad()");
88
ok(nqp::atkey($lexpad,'$bar') eq "hi","accessing a different variable using nqp::curlexpad()");
99

10+
ok(!nqp::existskey($lexpad, '$outer'), "nqp::existskey on a outer variable in a lexpad");
1011
ok(nqp::existskey($lexpad, '$foo'), "nqp::existskey on a lexpad with a variable that does exists");
1112
ok(!nqp::existskey($lexpad, '$no_such_var_ever'), "nqp::existskey on a lexpad with a variable that doesn't exist");
1213

1314
nqp::bindkey($lexpad,'$foo', 'ciao');
1415
ok($foo eq 'ciao', "binding to a variable using curlexpad");
16+
17+
ok(nqp::getlexrel($lexpad, '$bar') eq 'hi', 'accessing a variable using getlexrel');
18+
ok(nqp::isnull(nqp::getlexrel($lexpad, '$no_such')), 'nqp::getlexrel returns null for a missing variable');
1519
$lexpad;
1620
}
1721
my $pad := foo();

0 commit comments

Comments
 (0)