Skip to content

Commit

Permalink
[spec] added tests for repeated declaration of a variable in same scope
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@21069 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Jun 26, 2008
1 parent de174b3 commit 14b3be1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions S04-declarations/multiple.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use v6;
use Test;
plan 3;

# L<S04/The Relationship of Blocks and Declarations/"If you declare a lexical
# twice in the same scope">

eval_lives_ok 'my $x; my $x',
'it is legal to declare my $x twice in the same scope.';

eval_lives_ok 'state $x; state $x',
'it is legal to declare state $x twice in the same scope.';

{
my $x = 2;
my $y := $x;
my $x = 3;
is $y, 3, 'Two lexicals with the name in same scope are the same variable';
}

0 comments on commit 14b3be1

Please sign in to comment.