1Test::Mouse(3) User Contributed Perl Documentation Test::Mouse(3)
2
3
4
6 Test::Mouse - Test functions for Mouse specific features
7
9 use Test::More plan => 1;
10 use Test::Mouse;
11
12 meta_ok($class_or_obj, "... Foo has a ->meta");
13 does_ok($class_or_obj, $role, "... Foo does the Baz role");
14 has_attribute_ok($class_or_obj, $attr_name, "... Foo has the 'bar' attribute");
15
17 This module provides some useful test functions for Mouse based
18 classes. It is an experimental first release, so comments and
19 suggestions are very welcome.
20
22 meta_ok ($class_or_object)
23 Tests if a class or object has a metaclass.
24
25 does_ok ($class_or_object, $role, ?$message)
26 Tests if a class or object does a certain role, similar to what
27 "isa_ok" does for the "isa" method.
28
29 has_attribute_ok($class_or_object, $attr_name, ?$message)
30 Tests if a class or object has a certain attribute, similar to what
31 "can_ok" does for the methods.
32
33 with_immutable { CODE } @class_names
34 Runs CODE *which should contain normal tests) twice, and make each
35 class in @class_names immutable between the two runs.
36
38 Mouse
39
40 Test::Moose
41
42 Test::More
43
44
45
46perl v5.32.0 2020-07-28 Test::Mouse(3)