Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 32 lines (23 sloc) 0.976 kb
939b33e [t] moved chained.t to spec/, don't rely on the exact output of .perl
moritz authored
1 use v6;
2 use Test;
3
4 # L<S03/"Declarators">
5 # This section describes declarators like my, our, etc
6 # Note that the usage of declarators on the RHS is not spec'ed yet,
7 # but works like Perl 5. Also note that the list if declarators here
8 # does not match the list described in the referenced specs.
9
b680ebe [t/spec] throw away a wrong test in chained-declarators.t, and fudge for...
moritz authored
10 plan 5;
939b33e [t] moved chained.t to spec/, don't rely on the exact output of .perl
moritz authored
11
12 # sanity: declarations and very simple use (scoping tests come later)
13 # we take care to use different names to avoid other *kinds* of insanity.
14
15 is((try { my $a1 = my $b1 = 42; $b1++; "$a1, $b1" }), '42, 43', "chained my");
16 is((try { my $a2 = our $b2 = 42; $b2++; "$a2, $b2" }), '42, 43', "chained my, our");
17 is((try { my $a4 = constant $b4 = 42; "$a4, $b4" }), '42, 42', "chained my, constant");
18 is((try { my $a5 = state $b5 = 42; $b5++; "$a5, $b5" }), '42, 43', "chained my, state");
19
20 # scoping
21
22 eval_dies_ok '
23 {
24 our $sa2 = my $sb2 = 42;
25 }
26 ($sa2, $sb2);
27 ', "scoping our, my ('our' doesn't leak)";
28
29 # XXX: add more!
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
30
31 # vim: ft=perl6
Something went wrong with that request. Please try again.