-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* does_metaroles_ok: Add 'class_metaroles' option to validate_class() Test class_metaroles option to validate_class()
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use strict; | ||
use warnings; | ||
|
||
{ package MetaRole::attribute; use Moose::Role; } | ||
{ package TestClass; use Moose; } | ||
|
||
use Test::Builder::Tester; | ||
use Test::More; | ||
use Test::Moose::More; | ||
use TAP::SimpleOutput 0.007 'counters'; | ||
|
||
use Moose::Util::MetaRole; | ||
|
||
Moose::Util::MetaRole::apply_metaroles for => 'TestClass', | ||
class_metaroles => { attribute => [ 'MetaRole::attribute' ] }; | ||
|
||
subtest 'Sanity, simple run' => sub { | ||
validate_class 'TestClass' => ( | ||
class_metaroles => { attribute => [ 'MetaRole::attribute' ] }, | ||
); | ||
}; | ||
|
||
{ | ||
my ($_ok, $_nok) = counters; | ||
test_out $_ok->(q{TestClass has a metaclass}); | ||
test_out $_ok->(q{TestClass is a Moose class}); | ||
test_out $_ok->(q{TestClass's attribute metaclass Moose::Meta::Class::__ANON__::SERIAL::1 does MetaRole::attribute}); | ||
validate_class 'TestClass' => ( | ||
class_metaroles => { attribute => [ 'MetaRole::attribute' ] }, | ||
); | ||
test_test 'class_metaroles option honored'; | ||
|
||
} | ||
|
||
|
||
done_testing; |