Skip to content

Commit

Permalink
Test nqp::curcode with methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Feb 23, 2016
1 parent ba2aa73 commit c7b640d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/nqp/75-curcode.t
@@ -1,4 +1,4 @@
plan(3);
plan(4);

sub foo($arg) {
my $this := nqp::curcode();
Expand All @@ -22,3 +22,17 @@ sub bar($arg) {
}
nqp::setcodeobj(&bar,"first");
bar(1);

class Foo {
method foo($arg) {
my $this := nqp::curcode();
if $arg == 1 {
nqp::setcodeobj($this,"third");
$this(self, 7);
} elsif $arg == 7 {
ok(nqp::getcodeobj($this) eq "third","nqp::curcode in combination with methods");
}
}
}

Foo.foo(1);

0 comments on commit c7b640d

Please sign in to comment.