Skip to content

Commit

Permalink
variable declaration and access through long names, RT #75632
Browse files Browse the repository at this point in the history
  • Loading branch information
bbkr committed Jul 15, 2012
1 parent 84fa0c2 commit c5c61f6
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions S02-packages/package-lookup.t
@@ -1,11 +1,13 @@
use v6;
use Test;

plan 4;
plan 6;

# L<S02/Package lookup/>

class A {
my $x;
method x { $A::x = 5; return $A::x; }
our sub foo() { 'I am foo' };
}

Expand All @@ -14,15 +16,11 @@ ok A::<&foo>, 'can access a subroutine in the stash';
ok A:: === A.WHO, 'A:: returns the same as A.WHO';

# RT 74412
{
class P {
my $q;
method r {
$P::q = 5;
return $P::q;
}
};
lives_ok { A.new.x ~~ 5 or die },
'can access a variable in a class package through its long name from class method';

lives_ok { P.new.r ~~ 5 or die },
'can access a variable in a class package through its long name';
}
# RT 75632
lives_ok { my $A::y = 6; $A::y ~~ 6 or die },
'can declare and access variable in a class package through its long name from outside class';
lives_ok { my $B::x = 7; $B::x ~~ 7 or die },
'can declare and access variable through its long name without declaring package';

0 comments on commit c5c61f6

Please sign in to comment.