Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 44 lines (32 sloc) 1.074 kb
dd2b31bf »
2008-09-03 [t] move var/is_readonly.t to spec
1 use v6;
2 use Test;
3
4 # L<S06/"Parameter traits"/"=item is readonly">
5 # should be moved with other subroutine tests?
6
7 plan 9;
8
9 {
10 my $a is readonly := 42;
11 is $a, 42, "basic declaration of a 'is readonly' variable works";
12
13 dies_ok { $a = 23 }, "a var declared with 'is readonly' is readonly (1)";
14 is $a, 42, "a var declared with 'is readonly' is readonly (2)";
15 }
16
17 {
18 my $a is readonly;
19 ok !$a, "declaration of an 'is readonly' var without supplying a container to bind to works";
20 try { $a := 42 };
21 is $a, 42, "binding the variable now works";
22
f25f151e »
2009-06-19 [t/spec] Change more Pugs todo flags to fudge commands
23 #?pugs todo 'feature'
24 dies_ok { $a := 17 }, "but binding it again does not work";
dd2b31bf »
2008-09-03 [t] move var/is_readonly.t to spec
25 }
26
27 {
28 my $a is readonly;
7aab93d8 »
2008-10-10 [t] excise exists and delete functions
29 ok !(try { VAR($a).defined }), ".VAR returns undefined on an uninitialized var declared with 'is readonly'";
dd2b31bf »
2008-09-03 [t] move var/is_readonly.t to spec
30
31 $a := 42;
f25f151e »
2009-06-19 [t/spec] Change more Pugs todo flags to fudge commands
32 #?pugs todo 'feature'
33 ok (try { VAR($a).defined }), ".VAR returns defined now";
dd2b31bf »
2008-09-03 [t] move var/is_readonly.t to spec
34 }
35
36 {
37 my $a = 3;
38
f25f151e »
2009-06-19 [t/spec] Change more Pugs todo flags to fudge commands
39 #?pugs todo 'feature'
40 ok (try { VAR($a).defined }), ".VAR on a plain normal initialized variable returns true";
dd2b31bf »
2008-09-03 [t] move var/is_readonly.t to spec
41 }
7f29bc53 »
2009-08-08 [t/spec] Add vim: lines everywhere.
42
43 # vim: ft=perl6
Something went wrong with that request. Please try again.