Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (26 sloc) 0.947 kb
14b3be1 [spec] added tests for repeated declaration of a variable in same scope
moritz authored
1 use v6;
2 use Test;
d02a688 [t/spec] tests that sub foo {1;}; sub foo {1;}; dies
moritz authored
3 plan 6;
14b3be1 [spec] added tests for repeated declaration of a variable in same scope
moritz authored
4
5 # L<S04/The Relationship of Blocks and Declarations/"If you declare a lexical
6 # twice in the same scope">
7
fc2dbbe @usev6 Add ticket number RT #83430 to existing test
usev6 authored
8 # RT #83430
14b3be1 [spec] added tests for repeated declaration of a variable in same scope
moritz authored
9 eval_lives_ok 'my $x; my $x',
10 'it is legal to declare my $x twice in the same scope.';
11
12 eval_lives_ok 'state $x; state $x',
13 'it is legal to declare state $x twice in the same scope.';
14
15 {
16 my $x = 2;
17 my $y := $x;
18 my $x = 3;
19 is $y, 3, 'Two lexicals with the name in same scope are the same variable';
20 }
d02a688 [t/spec] tests that sub foo {1;}; sub foo {1;}; dies
moritz authored
21
22 # this is not exactly S04 material
23 eval_dies_ok 'sub foo {1; }; sub foo($x) {1; };',
24 'multiple declarations need multi or proto';
25
26 eval_dies_ok 'only sub foo {1; }; sub foo($x) {1; };',
27 'multiple declarations need multi or proto';
28
5f0bdab @coke niecza unfudge
coke authored
29 #?niecza todo "MMD"
db85667 @coke reflect current rakudo/nom state
coke authored
30 #?rakudo todo 'nom regression'
d02a688 [t/spec] tests that sub foo {1;}; sub foo {1;}; dies
moritz authored
31 eval_lives_ok 'proto foo {1; }; sub foo {1; }; sub foo($x) {1; };',
32 'multiple declarations need multi or proto';
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
33
34 # vim: ft=perl6
Something went wrong with that request. Please try again.