Skip to content
This repository
Newer
Older
100644 102 lines (88 sloc) 2.297 kb
ff2f9dec »
2010-08-04 Prototype of the Array class
1 # vim: ft=perl6
2 use Test;
9f1bf0e2 »
2010-10-13 Implement &sort
3 use MONKEY_TYPING;
ff2f9dec »
2010-08-04 Prototype of the Array class
4
9f864d48 »
2010-12-26 Add .split, .index, .rindex, .lines, .words, more features to .comb
5 {
dc2fc3bb »
2010-12-28 Fix INIT block test
6 my $str;
7 INIT $str = '';
b46d150b »
2010-12-09 Reimplement monkey typing using phasers
8 $str ~= 1;
9 INIT $str ~= 2;
10 $str ~= 3;
11 INIT $str ~= 4;
12 is $str, '2413', 'INIT blocks run in correct order';
589fce1f »
2010-12-23 Miscellaneous fixes to get STD/tryfile.exe working again
13 }
14
c2857c1c »
2010-12-28 Allow passing initial attribute values to .new
15 {
16 my class X3 {
17 has $.a;
18 }
19 my $x = X3.new(a => 5);
20 is $x.a, 5, 'Attribute values can be passed in constructors';
b0d9226f »
2010-12-29 Test for binding $/
21
22 sub foo($/) { $<a> }
23 is foo({ a => 5 }), 5, 'Can bind $/ in signature';
b508f750 »
2010-12-29 Implement method calls with computed names
24
25 my class X4 {
26 method foo { 13 }
27 method !bar { 17 }
28 method sam($x) { self!"$x"() }
29 }
30
31 is X4."foo"(), 13, 'indirect method calls work'; #OK
32 is X4."{ "fo" ~ "o" }"(), 13, 'indirect calls work with interpolation';
33 is X4.sam("bar"), 17, "indirect private method calls work";
c2857c1c »
2010-12-28 Allow passing initial attribute values to .new
34 }
35
20bd9a4e »
2010-12-29 Implement regex abstract objects
36 {
37 "foo" ~~ /oo/;
38 is $/.ast, 'oo', '.ast defaults to .Str';
39 "foo" ~~ /oo { make 15 }/;
40 is $/.ast, 15, 'make can change .ast';
41 "foo" ~~ /{make 30} oo/;
42 is $/.ast, 30, 'make works in the middle';
43
44 my grammar X5 {
45 proto token TOP {*}
46 token TOP:x { foo { make 45 } }
47 }
48 is X5.parse("foo").ast, 45, 'make works in multiregexes';
49 }
50
ba795bf8 »
2010-12-29 Implement action methods
51 {
52 my grammar X6 {
53 token a { <?> }
54 proto token b {*}
55 token b:x { <?> }
56 proto token c {*}
57 token c:x { <?> }
58 }
59
60 my class A6 {
61 method a($/) { make 1 }
62 method b($/) { make 2 }
63 method c:x ($/) { make 3 }
64 }
65
66 is X6.parse("", :actions(A6), :rule<a>).ast, 1,
67 'action methods work (simple rule)';
68 #is X6.parse("", :actions(A6), :rule<b>).ast, 2,
69 # 'action methods work (proto rule)';
70 is X6.parse("", :actions(A6), :rule<c>).ast, 3,
71 'action methods work (candidate rule)';
72 }
73
0fa6f238 »
2010-10-06 Fix Foo::Bar regression
74 #is $?FILE, 'test.pl', '$?FILE works';
75 #is $?ORIG.substr(0,5), '# vim', '$?ORIG works';
76
77 # {
78 # {
79 # our $x = 5; #OK
80 # }
81 # ok $::x == 5, '$::x finds our variable';
82 #
83 # package Fao { our $y = 6; } #OK
84 # ok $::Fao::y == 6, '$::Fao::y works as $Fao::y';
85 #
86 # { class Mao { } }
87 # ok ::Mao.new.defined, 'can use classes via ::Mao';
88 # }
89 #
90 # {
91 # my $x = 7; #OK
92 # ok $::x == 7, '$::x can find lexicals';
93 # class A3 {
94 # method moo { 42 }
95 # class B4 {
96 # ok ::A3.moo, '::A3 can find outer classes';
97 # }
98 # }
99 # }
ae2e557b »
2010-09-15 Implement control operators next, redo, last, return
100
025e4086 »
2010-12-31 [Test.pm6] remove &done-testing and &done_testing
101 done;
Something went wrong with that request. Please try again.