Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 56 lines (49 sloc) 1.295 kB
ff2f9de @sorear Prototype of the Array class
authored
1 # vim: ft=perl6
2 use Test;
9f1bf0e @sorear Implement &sort
authored
3 use MONKEY_TYPING;
ff2f9de @sorear Prototype of the Array class
authored
4
ca4d6f1 @sorear Implement use of submethod BUILD
authored
5 {
6 my class Bt {
7 has $!pie;
8 method get_pie() { $!pie }
9 submethod BUILD(:$x) { $!pie = $x }
10 }
11 is Bt.new(x => 5).get_pie, 5, "BUILD basically works";
12 my class SubBT is Bt {
13 has $!pie2;
14 method get_pie2() { $!pie2 }
15 submethod BUILD(:$y) { $!pie2 = $y }
16 }
17 is SubBT.new(x => 5, y => 2).get_pie, 5, "superclass' BUILD in subclass";
18 is SubBT.new(x => 5, y => 2).get_pie2, 2, "subclass' BUILD in subclass";
904bb14 @sorear Fix binding to existing @vars
authored
19
20 my @l;
21 @l := [1,2,3];
22 is +[@l], 3, 'binding to existing list vars works';
ca4d6f1 @sorear Implement use of submethod BUILD
authored
23 }
24
44f7995 @sorear Steal ... and ...^ from Rakudo
authored
25 is [ 1,2,3 ... 10 ], [1..10];
26 is [ 1,2,4 ... 256 ], [map 2 ** *, 0..8];
27 is [ 1,1,*+* ...^ *>100 ], [1,1,2,3,5,8,13,21,34,55,89];
28
0fa6f23 @sorear Fix Foo::Bar regression
authored
29 #is $?ORIG.substr(0,5), '# vim', '$?ORIG works';
30
31 # {
32 # {
33 # our $x = 5; #OK
34 # }
35 # ok $::x == 5, '$::x finds our variable';
36 #
37 # package Fao { our $y = 6; } #OK
38 # ok $::Fao::y == 6, '$::Fao::y works as $Fao::y';
39 #
40 # { class Mao { } }
41 # ok ::Mao.new.defined, 'can use classes via ::Mao';
42 # }
43 #
44 # {
45 # my $x = 7; #OK
46 # ok $::x == 7, '$::x can find lexicals';
47 # class A3 {
48 # method moo { 42 }
49 # class B4 {
50 # ok ::A3.moo, '::A3 can find outer classes';
51 # }
52 # }
53 # }
ae2e557 @sorear Implement control operators next, redo, last, return
authored
54
025e408 @pmurias [Test.pm6] remove &done-testing and &done_testing
pmurias authored
55 done;
Something went wrong with that request. Please try again.