Skip to content

Commit 69800ed

Browse files
committed
Expand test for nqp::setinvokespec
1 parent a4caa5d commit 69800ed

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

t/nqp/070-invokespec.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plan(11);
1+
plan(13);
22
class Foo {
33
has $!here_we_keep_the_code_ref;
44
has $!other_place_we_could_keep_the_code_ref_in;
@@ -31,6 +31,15 @@ class Baz {
3131
ok(nqp::isinvokable(Foo) == 1, "nqp::isinvokable works on objects that have a set invokespec");
3232
ok(nqp::isinvokable(Baz) == 0, "nqp::isinvokable works on objects that don't have a set invokespec");
3333

34+
my $with_args := Foo.new();
35+
$with_args.set_code_ref(sub (*@args) {
36+
is(nqp::elems(@args), 2, 'correct number of elements with setinvokespec');
37+
ok(@args[0] eq 'fooarg' && @args[1] eq 'bararg', '...with correct values');
38+
});
39+
$with_args('fooarg', 'bararg');
40+
41+
42+
3443
class Second {
3544
has $!attr;
3645
has $!ret;

0 commit comments

Comments
 (0)