1Test::Moose(3) User Contributed Perl Documentation Test::Moose(3)
2
3
4
6 Test::Moose - Test functions for Moose specific features
7
9 use Test::More plan => 1;
10 use Test::Moose;
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 Moose 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 in between the two runs.
36
38 Convert the Moose test suite to use this module.
39 Here is a list of possible functions to write
40 immutability predicates
41 anon-class predicates
42 discovering original method from modified method
43 attribute metaclass predicates (attribute_isa?)
44
46 Test::More
47
49 See "BUGS" in Moose for details on reporting bugs.
50
52 Anders Nor Berle <debolaz@gmail.com>
53
54 Stevan Little <stevan@iinteractive.com>
55
57 Copyright 2007-2009 by Infinity Interactive, Inc.
58
59 <http://www.iinteractive.com>
60
61 This library is free software; you can redistribute it and/or modify it
62 under the same terms as Perl itself.
63
64
65
66perl v5.12.2 2010-08-28 Test::Moose(3)