From c7b640ddeaa7880624ea6ea532bf8810fd2d76c9 Mon Sep 17 00:00:00 2001 From: Pawel Murias Date: Tue, 23 Feb 2016 21:20:51 +0100 Subject: [PATCH] Test nqp::curcode with methods. --- t/nqp/75-curcode.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/t/nqp/75-curcode.t b/t/nqp/75-curcode.t index 48ac89adf7..1607322ab1 100644 --- a/t/nqp/75-curcode.t +++ b/t/nqp/75-curcode.t @@ -1,4 +1,4 @@ -plan(3); +plan(4); sub foo($arg) { my $this := nqp::curcode(); @@ -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);