Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (29 sloc) 0.861 kb
e9f933d [t] move is_rw_on_class to spec/
moritz authored
1 use v6;
2
3 use Test;
4
18ad3a6 [t/spec] Test that is readonly on an attr overrides a class-wide is rw.
jnthn authored
5 plan 5;
e9f933d [t] move is_rw_on_class to spec/
moritz authored
6
7 # L<S12/Attributes/If you declare the class as>
8
9 class Foo {
10 has $.readonly_attr;
11 }
12
13 {
14 my Foo $foo .= new;
ba8e84a [t/spec] Change more Pugs todo flags to fudge commands
kyle authored
15 #?pugs todo 'bug'
16 dies_ok { $foo.readonly_attr++ }, "basic sanity";
e9f933d [t] move is_rw_on_class to spec/
moritz authored
17 }
18
19
20 class Bar is rw {
21 has $.readwrite_attr;
18ad3a6 [t/spec] Test that is readonly on an attr overrides a class-wide is rw.
jnthn authored
22 has $.but_not_this is readonly;
e9f933d [t] move is_rw_on_class to spec/
moritz authored
23 }
24
25 {
18ad3a6 [t/spec] Test that is readonly on an attr overrides a class-wide is rw.
jnthn authored
26 my Bar $bar .= new(but_not_this => 42);
27
e9f933d [t] move is_rw_on_class to spec/
moritz authored
28 lives_ok { $bar.readwrite_attr++ },
29 "'is rw' on the class declaration applies to all attributes (1)";
30 is $bar.readwrite_attr, 1,
31 "'is rw' on the class declaration applies to all attributes (2)";
18ad3a6 [t/spec] Test that is readonly on an attr overrides a class-wide is rw.
jnthn authored
32
28ef8dc @coke pugs fudges
coke authored
33 #?pugs todo
18ad3a6 [t/spec] Test that is readonly on an attr overrides a class-wide is rw.
jnthn authored
34 dies_ok { $bar.but_not_this = 42 },
35 "'is readonly' on a specific attribute can overrule the is rw on the class (1)";
36 is $bar.but_not_this, 42,
37 "'is readonly' on a specific attribute can overrule the is rw on the class (2)";
e9f933d [t] move is_rw_on_class to spec/
moritz authored
38 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
39
40 # vim: ft=perl6
Something went wrong with that request. Please try again.