2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
22 [ sort Foo::Role->meta->get_required_method_list ],
24 '... the Foo::Role has a required method (foo)'
27 # classes which does not implement required method
33 ::dies_ok { with('Foo::Role') }
34 '... no foo method implemented by Foo::Class';
37 # class which does implement required method
43 ::dies_ok { with('Foo::Class') }
44 '... cannot consume a class, it must be a role';
45 ::lives_ok { with('Foo::Role') }
46 '... has a foo method implemented by Bar::Class';
48 sub foo {'Bar::Class::foo'}
51 # role which does implement required method
57 ::lives_ok { with('Foo::Role') }
58 '... has a foo method implemented by Bar::Role';
60 sub foo {'Bar::Role::foo'}
64 [ sort Bar::Role->meta->get_required_method_list ],
66 '... the Bar::Role has not inherited the required method from Foo::Role'
69 # role which does not implement required method
75 ::lives_ok { with('Foo::Role') }
76 '... no foo method implemented by Baz::Role';
80 [ sort Baz::Role->meta->get_required_method_list ],
82 '... the Baz::Role has inherited the required method from Foo::Role'
85 # classes which does not implement required method
91 ::dies_ok { with('Baz::Role') }
92 '... no foo method implemented by Baz::Class2';
95 # class which does implement required method
101 ::lives_ok { with('Baz::Role') }
102 '... has a foo method implemented by Baz::Class2';
104 sub foo {'Baz::Class2::foo'}
112 requires qw( meth1 meth2 meth3 meth4 );
121 ::throws_ok { with('Quux::Role') }
122 qr/\Q'Quux::Role' requires the methods 'meth1', 'meth2', 'meth3', and 'meth4' to be implemented by 'Quux::Class'/,
123 'exception mentions all the missing required methods at once';
127 package Quux::Class2;
132 ::throws_ok { with('Quux::Role') }
133 qr/'Quux::Role' requires the methods 'meth2', 'meth3', and 'meth4' to be implemented by 'Quux::Class2'/,
134 'exception mentions all the missing required methods at once, but not the one that exists';
138 package Quux::Class3;
141 has 'meth1' => ( is => 'ro' );
142 has 'meth2' => ( is => 'ro' );
144 ::throws_ok { with('Quux::Role') }
145 qr/'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class3'/,
146 'exception mentions all the missing methods at once, but not the accessors';
150 package Quux::Class4;
154 has 'meth2' => ( is => 'ro' );
156 ::throws_ok { with('Quux::Role') }
157 qr/'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class4'/,
158 'exception mentions all the require methods that are accessors at once, as well as missing methods, but not the one that exists';