Skip to content

Commit

Permalink
Test that adverbs are illegal when augmenting a class and only :auth/…
Browse files Browse the repository at this point in the history
…:ver are legal when declaring one.

Bug #124017.
  • Loading branch information
pmurias committed Nov 19, 2015
1 parent f14aab4 commit a9d04f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 14 additions & 1 deletion S12-class/basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 40;
plan 43;

=begin pod
Expand Down Expand Up @@ -153,4 +153,17 @@ eval-lives-ok 'class Test1 { class A {};}; class Test2 {class A {};};',

is class :: { method foo { 42 }}.foo, 42, "Can call method on class definition without parens";


# RT #124017
throws-like 'class RT124017_A:D {}', X::Syntax::Type::Adverb,
"RT124017 - can't declare Foo:D";


throws-like 'class RT124017_B:no_such_adverb {}', X::Syntax::Type::Adverb,
"RT124017 - can't declare Foo:no-such-adverb";

{
eval-lives-ok 'class Adverbed:auth<random_auth>:ver<0.0.1> { }', 'can declare class with :auth and :ver adverbs';
}

# vim: ft=perl6
5 changes: 4 additions & 1 deletion S12-class/open.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;
use MONKEY-TYPING;

use Test;
plan 8;
plan 10;

# L<S12/Open vs Closed Classes>

Expand Down Expand Up @@ -67,4 +67,7 @@ is $x.in_Something, 'ab', 'basic OO sanity';
is @a.last-and-first, '01', 'can extend class Array';
}

throws-like 'use MONKEY-TYPING; class RT124017_A {}; augment class RT124017_A:D {}', X::Syntax::Augment::Adverb, "can't pass :D when augmenting class";
throws-like 'use MONKEY-TYPING; class RT124017_B {}; augment class RT124017_B:auth<random_auth> {}', X::Syntax::Augment::Adverb, "can't pass :auth when augmenting class";

# vim: ft=perl6

0 comments on commit a9d04f4

Please sign in to comment.