1Test::Moose(3) User Contributed Perl Documentation Test::Moose(3)
2
3
4
6 Test::Moose - Test functions for Moose specific features
7
9 version 2.2013
10
12 use Test::More plan => 1;
13 use Test::Moose;
14
15 meta_ok($class_or_obj, "... Foo has a ->meta");
16 does_ok($class_or_obj, $role, "... Foo does the Baz role");
17 has_attribute_ok($class_or_obj, $attr_name, "... Foo has the 'bar' attribute");
18
20 This module provides some useful test functions for Moose based
21 classes. It is an experimental first release, so comments and
22 suggestions are very welcome.
23
25 meta_ok ($class_or_object)
26 Tests if a class or object has a metaclass.
27
28 does_ok ($class_or_object, $role, ?$message)
29 Tests if a class or object does a certain role, similar to what
30 "isa_ok" does for the "isa" method.
31
32 has_attribute_ok($class_or_object, $attr_name, ?$message)
33 Tests if a class or object has a certain attribute, similar to what
34 "can_ok" does for the methods.
35
36 with_immutable { CODE } @class_names
37 Runs CODE (which should contain normal tests) twice, and make each
38 class in @class_names immutable in between the two runs.
39
40 The CODE block is called with a single boolean argument indicating
41 whether or not the classes have been made immutable yet.
42
44 Convert the Moose test suite to use this module.
45 Here is a list of possible functions to write
46 immutability predicates
47 anon-class predicates
48 discovering original method from modified method
49 attribute metaclass predicates (attribute_isa?)
50
52 Test::More
53
55 See "BUGS" in Moose for details on reporting bugs.
56
58 · Stevan Little <stevan.little@iinteractive.com>
59
60 · Dave Rolsky <autarch@urth.org>
61
62 · Jesse Luehrs <doy@tozt.net>
63
64 · Shawn M Moore <code@sartak.org>
65
66 · יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
67
68 · Karen Etheridge <ether@cpan.org>
69
70 · Florian Ragwitz <rafl@debian.org>
71
72 · Hans Dieter Pearcey <hdp@weftsoar.net>
73
74 · Chris Prather <chris@prather.org>
75
76 · Matt S Trout <mst@shadowcat.co.uk>
77
79 This software is copyright (c) 2006 by Infinity Interactive, Inc.
80
81 This is free software; you can redistribute it and/or modify it under
82 the same terms as the Perl 5 programming language system itself.
83
84
85
86perl v5.32.0 2020-07-28 Test::Moose(3)