Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 73 lines (57 sloc) 1.83 kb
44efcc5 @moritz rename S02-types/enum.t to S12-enums/misc.t and delete lots of crufty te...
moritz authored
1 use v6;
2
3 use Test;
4
c8e2a0c @usev6 Add test for RT #123114
usev6 authored
5 plan 16;
b04665c @lizmat Some more plans added
lizmat authored
6
44efcc5 @moritz rename S02-types/enum.t to S12-enums/misc.t and delete lots of crufty te...
moritz authored
7 # RT #63826
8 {
9 class EnumClass { enum C <a b c> }
10 is +EnumClass::C::a, 0, 'enum element in class has the right value';
11
12 module EnumModule { enum M <a b c> }
13 is +EnumModule::M::b, 1, 'enum element in module has the right value';
14
15 package EnumPackage { enum P <a b c> }
16 is +EnumPackage::P::c, 2, 'enum element in package has the right value';
17
18 role EnumRole { enum R <a b c> }
8b6048b @moritz Revert "Remove # chars from fudge messages"
moritz authored
19 #?rakudo skip 'RT #63826'
44efcc5 @moritz rename S02-types/enum.t to S12-enums/misc.t and delete lots of crufty te...
moritz authored
20 is +EnumRole::R::a, 0, 'enum element in role has the right value';
21
22 grammar EnumGrammar { enum G <a b c> }
23 is +EnumGrammar::G::b, 1, 'enum element in grammar has the right value';
24 }
25
25668e6 @coke Prefer RT #XXXXXX
coke authored
26 # RT #66648
44efcc5 @moritz rename S02-types/enum.t to S12-enums/misc.t and delete lots of crufty te...
moritz authored
27 {
28 enum RT66648 <a b c>;
29 dies_ok { RT66648.c }, 'die attempting to access enum item as method';
30 }
31
32 # RT #70894
33
34 {
35 enum SomeEnum <a b c>;
36 lives_ok {SomeEnum::.keys}, 'keys on enum stash works';
37
38 }
39
62d5ffd @moritz tests for conflicts between enums and subs (RT #63650)
moritz authored
40 # L<S12/Miscellaneous Rules>
41 # see also: RT #63650
42 {
43 enum Maybe <OK FAIL>;
44 sub OK { 'sub OK' };
45 is OK, 'OK', 'enum key wins in case of conflict';
46 is +OK, 0, 'enum key wins in case of conflict (numeric)';
3a7da94 @coke niecza fudging
coke authored
47 #?niecza skip 'No value for parameter $key in CORE CommonEnum.postcircumfix:<( )>'
62d5ffd @moritz tests for conflicts between enums and subs (RT #63650)
moritz authored
48 is OK(), 'sub OK', 'but () is still a function call';
49 is FAIL, 'FAIL', 'non-conflicting enum key';
50 is +FAIL, 1, 'non-conflicting enum key (numeric)';
ba52bb7 @moritz RT #112202, SomeEnum.^parents
moritz authored
51 # RT #112202
e1f01c0 @colomon Fudge new test for Niecza.
colomon authored
52 #?niecza todo
ba52bb7 @moritz RT #112202, SomeEnum.^parents
moritz authored
53 lives_ok { OK.^methods }, 'can call .^methods on an enum';
62d5ffd @moritz tests for conflicts between enums and subs (RT #63650)
moritz authored
54 }
55
ef7e125 @lizmat Add tests for RT #122514
lizmat authored
56 # anonymous Enum in our context, # RT #122514
57 {
58 enum :: <un>;
59 is +un, 0, 'is un the right value';
60 is ~un, 'un', 'is un the right string';
61 }
62
c8e2a0c @usev6 Add test for RT #123114
usev6 authored
63 #RT # 123114
64 {
65 module RT123114 {
66 enum A is export <B C>;
67 }
68 import RT123114;
69 is C.value, 1, 'Enum members are exported with enumeration itself';
70 }
71
44efcc5 @moritz rename S02-types/enum.t to S12-enums/misc.t and delete lots of crufty te...
moritz authored
72 # vim: ft=perl6
Something went wrong with that request. Please try again.