Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 124 lines (100 sloc) 2.887 kb
ebc0a2c0 »
2008-05-11 [t/spec]
1 use v6;
2 use Test;
cdb3f48b »
2011-09-22 Improve test for role composition conflict error; don't require it us…
3 plan 25;
ebc0a2c0 »
2008-05-11 [t/spec]
4
605c16f2 »
2009-04-26 [t/spec] fix some of the S12/Roles smartlinks
5 # L<S14/Roles/"Roles may be composed into a class at compile time">
c2f8fec1 »
2008-12-14 [t] and [t/spec] (two train travels worth of changes):
6
ebc0a2c0 »
2008-05-11 [t/spec]
7 role rA {
8 method mA1 {
9 'mA1';
10 }
11 method mA2 {
12 'mA2';
13 }
14 };
15
16 role rB {
17 method mB1 {
18 'mB1';
19 }
20 method mB2 {
21 'mB2';
22 }
23 };
24
25 class C1 does rA {
26 method mC1 {
27 'mC1';
28 }
29 };
30
31 my $x = C1.new();
32
33 is $x.mC1, 'mC1', 'Can call method of class with mixed in role';
34 is $x.mA1, 'mA1', 'Call first method from role';
35 is $x.mA2, 'mA2', 'Call second method from role';
36
37 class C2 does rA does rB {
38 method mC2 {
39 'mC2';
40 }
41 }
42
43 my $y = C2.new();
44
45 is $y.mC2, 'mC2', 'Can call method of class with two roles mixed in';
46 is $y.mA1, 'mA1', 'Can call mixed in method (two roles) 1';
47 is $y.mA2, 'mA2', 'Can call mixed in method (two roles) 2';
48 is $y.mB1, 'mB1', 'Can call mixed in method (two roles) 3';
49 is $y.mB2, 'mB2', 'Can call mixed in method (two roles) 4';
50
e376edf1 »
2009-07-29 [t/spec] Test for RT #64002
51 ok C2 ~~ rA, 'class matches first role';
52 ok C2 ~~ rB, 'class matches second role';
53 ok rA !~~ C2, 'first role does not match class';
54 ok rB !~~ C2, 'second role does not match class';
55
56 role RT64002 does rA does rB {}
57 ok RT64002 ~~ rA, 'role matches first role it does';
58 ok RT64002 ~~ rB, 'role matches second role it does';
59 ok rA !~~ RT64002, 'role not matched by first role it does';
60 ok rB !~~ RT64002, 'role not matched by second role it does';
61
86dbfdc8 »
2009-01-11 Fixes from moritz++ to do the test properly
62 {
975b429a »
2009-01-11 [t/spec] indent lines in composition.t to not confuse the fudge script
63 class D1 does rA {
64 method mA1 {
65 'D1.mA1';
66 }
a8fc3f95 »
2009-01-11 test for RT #62200: classes overriding methods from roles
67 }
68
975b429a »
2009-01-11 [t/spec] indent lines in composition.t to not confuse the fudge script
69 my $z = D1.new();
a8fc3f95 »
2009-01-11 test for RT #62200: classes overriding methods from roles
70
975b429a »
2009-01-11 [t/spec] indent lines in composition.t to not confuse the fudge script
71 is $z.mA1, 'D1.mA1', 'Can override method in a role with method in a class';
86dbfdc8 »
2009-01-11 Fixes from moritz++ to do the test properly
72 }
a8fc3f95 »
2009-01-11 test for RT #62200: classes overriding methods from roles
73
afb3675a »
2009-05-08 [t/spec] Unfudge test for RT#63330.
74 # diamond composition
2f37cb1d »
2009-02-19 [t/spec] tests for RT #63330 and RT #63332
75 {
76 role DA {
77 method foo { "OH HAI" };
78 }
79 role DB does DA { }
80 role DC does DA { }
81 class DD does DB does DC { };
82 is DD.new.foo, 'OH HAI', 'diamond role composition';
83 class DE is DB is DC { };
84 is DE.new.foo, 'OH HAI', 'same with punning and inheritance';
85 }
86
4898b49c »
2009-10-21 [t/spec] Test for RT #69919
87 # RT #69919
88 {
89 role RT69919 {
90 my $lex = 'Luthor';
91 method rt69919 { return $lex }
92 }
93 class IL does RT69919 {}
94
95 is IL.new.rt69919, 'Luthor', 'access lexical declared in role from method called via class that does the role';
96 }
97
a8fc23f8 »
2010-03-11 [t/spec] tests for RT #69254, role composition can transport inheritance
98
99 # inheritance through role composition - specced in A12
100 # RT 69254
101 {
102 class irA {};
103 role irB is irA {};
104 class irC does irB {};
105 ok irC ~~ irB, 'role composition worked';
106 ok irC ~~ irA, 'role composition transported inheritance';
107
108 }
109
095ac1f6 »
2010-06-28 [t/spec] tests for RT #72856 Null PMC access when two methods from di…
110 # RT #72856
111 {
112 role RT72856A { method foo {} };
113 role RT72856B { method foo {} };
114 eval 'class RT72856C does RT72856A does RT72856B {}';
cdb3f48b »
2011-09-22 Improve test for role composition conflict error; don't require it us…
115 ok $! ~~ /foo/,
095ac1f6 »
2010-06-28 [t/spec] tests for RT #72856 Null PMC access when two methods from di…
116 'method of the same name from two different roles collide in a class composition';
cdb3f48b »
2011-09-22 Improve test for role composition conflict error; don't require it us…
117 ok $! ~~ /RT72856A/, 'colliding role mentioned in error (1)';
118 ok $! ~~ /RT72856B/, 'colliding role mentioned in error (2)';
095ac1f6 »
2010-06-28 [t/spec] tests for RT #72856 Null PMC access when two methods from di…
119 }
a8fc23f8 »
2010-03-11 [t/spec] tests for RT #69254, role composition can transport inheritance
120
e76dd4c7 »
2010-12-31 s/done_testing/done/ as per recent S24 changes
121 done;
4898b49c »
2009-10-21 [t/spec] Test for RT #69919
122
ebc0a2c0 »
2008-05-11 [t/spec]
123 # vim: syn=perl6
Something went wrong with that request. Please try again.