- Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathaliasing.t
41 lines (32 loc) · 1.06 KB
/
aliasing.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
useTest;
plan5;
# L<S13/Syntax/This can easily be handled with Raku's aliasing>
# XXX When the two canary tests pass TODO it is time to remove them and unfudge the main test body.
#?rakudo todo "Canary test for &method"
eval-lives-ok'my class Foo { method bar() {}; method bar_ref() { &bar } }', '&method is implemented, consider unfudging this test';
#?rakudo todo "Canary test for ::="
eval-lives-ok'my $foo = 42; my $bar ::= $foo;', '::= is implemented, consider unfudging this test';
#?rakudo eval "Requires &method and ::= to be implemented"
{
myclassFoo {
methodbar() { 42 }
methodbar_ref() { &bar }
}
{
my$foo= Foo.new;
lives-ok { $foo.bar_ref }, "returning a method reference works";
}
myclassBaz {
methodbar() { 42 }
our&baz::=&bar;
}
{
my$ret;
lives-ok {
my$baz= Baz.new;
$ret=$baz.baz();
}, "calling an aliased method worked";
is$ret, 42, "the aliased method returned the right thing";
}
}
# vim: expandtab shiftwidth=4