~ubuntu-branches/ubuntu/vivid/nqp/vivid-proposed

« back to all changes in this revision

Viewing changes to t/nqp/70-invokespec.t

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2013-11-01 12:09:18 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131101120918-kx51sl0sxl3exsxi
Tags: 2013.10-1
* New upstream release
* Bump versioned (Build-)Depends on parrot
* Update patches
* Install new README.pod
* Fix vcs-field-not-canonical
* Do not install rubyish examples
* Do not Depends on parrot-devel anymore
* Add 07_disable-serialization-tests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
plan(2);
 
2
class Foo {
 
3
    has $!here_we_keep_the_code_ref;
 
4
    has $!other_place_we_could_keep_the_code_ref_in;
 
5
    method set_code_ref($code_ref) {
 
6
        $!here_we_keep_the_code_ref := $code_ref;
 
7
    }
 
8
    method set_code_ref_differently($code_ref) {
 
9
        $!other_place_we_could_keep_the_code_ref_in := $code_ref;
 
10
    }
 
11
}
 
12
class Bar is Foo {
 
13
}
 
14
nqp::setinvokespec(Foo,Foo,'$!here_we_keep_the_code_ref',nqp::null());
 
15
 
 
16
nqp::setinvokespec(Bar,Foo,'$!other_place_we_could_keep_the_code_ref_in',nqp::null());
 
17
 
 
18
my $foo := Foo.new();
 
19
$foo.set_code_ref(sub () {123});
 
20
$foo.set_code_ref_differently(sub () {456});
 
21
ok($foo() == 123,"basic setinvokespec");
 
22
 
 
23
my $bar := Bar.new();
 
24
$bar.set_code_ref(sub () {1001});
 
25
$bar.set_code_ref_differently(sub () {1002});
 
26
ok($bar() == 1002,"setinvokespec with a attribute in a subclass");
 
27