Skip to content

Commit

Permalink
Update S12-attributes/undeclared.t to handle compilers that can detec…
Browse files Browse the repository at this point in the history
…t undeclared attributes at compile time; remove two tests that are invalid.
  • Loading branch information
jnthn committed Aug 3, 2011
1 parent c0a9803 commit 2603206
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions S12-attributes/undeclared.t
Expand Up @@ -8,7 +8,7 @@ use Test;
=end pod

plan 12;
plan 10;


dies_ok { class A { method set_a { $.a = 1 }}; A.new.set_a; },
Expand All @@ -17,9 +17,9 @@ dies_ok { role B { method set_b { $.b = 1 }};class C does B{ }; C.new.set_b; },
"Test Undeclared public attribute assignment from a role";

#?pugs 2 todo 'bug'
dies_ok { class D { method d { $!d = 1 }}; D.new.d; },
eval_dies_ok ' class D { method d { $!d = 1 }}; D.new.d; ',
"Test Undeclared private attribute assignment from a class";
dies_ok { role E { method e { $!e = 1 }};class F does E{ }; F.new.e; },
eval_dies_ok ' role E { method e { $!e = 1 }};class F does E{ }; F.new.e; ',
"Test Undeclared private attribute assignment from a role";

##### access the undeclared attribute
Expand All @@ -29,23 +29,16 @@ dies_ok { role I { method set_i { $.i }};class J does I{ }; J.new.set_i; },
"Test Undeclared public attribute access from a role";

#?pugs 2 todo 'bug'
dies_ok { class K { method k { $!k }}; K.new.k; },
eval_dies_ok ' class K { method k { $!k }}; K.new.k; ',
"Test Undeclared private attribute access from a class";
dies_ok { role L { method l { $!l }};class M does L{ }; M.new.l; },
eval_dies_ok ' role L { method l { $!l }};class M does L{ }; M.new.l; ',
"Test Undeclared private attribute access from a role";


dies_ok { class N { method set_n { $.n := 1 }}; N.new.set_n; },
"Test Undeclared public attribute binding from a class";
dies_ok { role O { method set_o { $.o := 1 }}; class P does O{ }; P.new.set_o },
"Test Undeclared public attribute binding from a role";

## skip class 'Q' here to avoid quote operator conflict.

dies_ok { role R { method r { $!r := 1 }};class S does R{ }; S.new.r; },
eval_dies_ok ' role R { method r { $!r := 1 }};class S does R{ }; S.new.r; ',
"Test Undeclared private attribute binding from a role";
dies_ok { class T { method t { $!t := 1 }}; ::T.new.t; },
eval_dies_ok ' class T { method t { $!t := 1 }}; ::T.new.t; ',
"Test Undeclared private attribute binding from a class";


# vim: ft=perl6

0 comments on commit 2603206

Please sign in to comment.