.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Test::Moose::More 3pm" .TH Test::Moose::More 3pm "2014-05-14" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::Moose::More \- More tools for testing Moose packages .SH "VERSION" .IX Header "VERSION" This document describes version 0.024 of Test::Moose::More \- released May 14, 2014 as part of Test-Moose-More. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Test::Moose::More; \& \& is_class \*(AqSome::Class\*(Aq; \& is_role \*(AqSome::Role\*(Aq; \& has_method_ok \*(AqSome::Class\*(Aq, \*(Aqfoo\*(Aq; \& \& # ... etc .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package contains a number of additional tests that can be employed against Moose classes/roles. It is intended to replace Test::Moose in your tests, and re-exports any tests that it has and we do not, yet. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "known_sugar" .IX Subsection "known_sugar" Returns a list of all the known standard Moose sugar (has, extends, etc). .SH "TEST_FUNCTIONS" .IX Header "TEST_FUNCTIONS" .ie n .SS "meta_ok $thing" .el .SS "meta_ok \f(CW$thing\fP" .IX Subsection "meta_ok $thing" Tests \f(CW$thing\fR to see if it has a metaclass; \f(CW$thing\fR may be the class name or instance of the class you wish to check. .ie n .SS "does_ok $thing, < $role | \e@roles >, [ $message ]" .el .SS "does_ok \f(CW$thing\fP, < \f(CW$role\fP | \e@roles >, [ \f(CW$message\fP ]" .IX Subsection "does_ok $thing, < $role | @roles >, [ $message ]" Checks to see if \f(CW$thing\fR does the given roles. \f(CW$thing\fR may be the class name or instance of the class you wish to check. .PP Note that the message will be taken verbatim unless it contains \f(CW%s\fR somewhere; this will be replaced with the name of the role being tested for. .ie n .SS "does_not_ok $thing, < $role | \e@roles >, [ $message ]" .el .SS "does_not_ok \f(CW$thing\fP, < \f(CW$role\fP | \e@roles >, [ \f(CW$message\fP ]" .IX Subsection "does_not_ok $thing, < $role | @roles >, [ $message ]" Checks to see if \f(CW$thing\fR does not do the given roles. \f(CW$thing\fR may be the class name or instance of the class you wish to check. .PP Note that the message will be taken verbatim unless it contains \f(CW%s\fR somewhere; this will be replaced with the name of the role being tested for. .ie n .SS "has_attribute_ok $thing, $attribute_name, [ $message ]" .el .SS "has_attribute_ok \f(CW$thing\fP, \f(CW$attribute_name\fP, [ \f(CW$message\fP ]" .IX Subsection "has_attribute_ok $thing, $attribute_name, [ $message ]" Checks \f(CW$thing\fR for an attribute named \f(CW$attribute_name\fR; \f(CW$thing\fR may be a class name, instance, or role name. .ie n .SS "has_method_ok $thing, @methods" .el .SS "has_method_ok \f(CW$thing\fP, \f(CW@methods\fP" .IX Subsection "has_method_ok $thing, @methods" Queries \f(CW$thing\fR's metaclass to see if \f(CW$thing\fR has the methods named in \f(CW@methods\fR. .ie n .SS "requires_method_ok $thing, @methods" .el .SS "requires_method_ok \f(CW$thing\fP, \f(CW@methods\fP" .IX Subsection "requires_method_ok $thing, @methods" Queries \f(CW$thing\fR's metaclass to see if \f(CW$thing\fR requires the methods named in \&\f(CW@methods\fR. .PP Note that this really only makes sense if \f(CW$thing\fR is a role. .ie n .SS "is_role $thing" .el .SS "is_role \f(CW$thing\fP" .IX Subsection "is_role $thing" Passes if \f(CW$thing\fR's metaclass is a Moose::Meta::Role. .ie n .SS "is_class $thing" .el .SS "is_class \f(CW$thing\fP" .IX Subsection "is_class $thing" Passes if \f(CW$thing\fR's metaclass is a Moose::Meta::Class. .ie n .SS "is_anon $thing" .el .SS "is_anon \f(CW$thing\fP" .IX Subsection "is_anon $thing" Passes if \f(CW$thing\fR is \*(L"anonymous\*(R". .ie n .SS "is_not_anon $thing" .el .SS "is_not_anon \f(CW$thing\fP" .IX Subsection "is_not_anon $thing" Passes if \f(CW$thing\fR is not \*(L"anonymous\*(R". .ie n .SS "check_sugar_removed_ok $thing" .el .SS "check_sugar_removed_ok \f(CW$thing\fP" .IX Subsection "check_sugar_removed_ok $thing" Ensures that all the standard Moose sugar is no longer directly callable on a given package. .ie n .SS "check_sugar_ok $thing" .el .SS "check_sugar_ok \f(CW$thing\fP" .IX Subsection "check_sugar_ok $thing" Checks and makes sure a class/etc can still do all the standard Moose sugar. .SS "validate_thing" .IX Subsection "validate_thing" Runs a bunch of tests against the given \f(CW$thing\fR, as defined: .PP .Vb 1 \& validate_class $thing => ( \& \& attributes => [ ... ], \& methods => [ ... ], \& isa => [ ... ], \& \& # ensures $thing does these roles \& does => [ ... ], \& \& # ensures $thing does not do these roles \& does_not => [ ... ], \& ); .Ve .PP \&\f(CW$thing\fR can be the name of a role or class, an object instance, or a metaclass. .SS "validate_role" .IX Subsection "validate_role" The same as \fIvalidate_thing()\fR, but ensures \f(CW$thing\fR is a role, and allows for additional role-specific tests. .PP .Vb 1 \& validate_role $thing => ( \& \& required_methods => [ ... ], \& \& # ...and all other options from validate_thing() .Ve .SS "validate_class" .IX Subsection "validate_class" The same as \fIvalidate_thing()\fR, but ensures \f(CW$thing\fR is a class, and allows for additional class-specific tests. .SS "validate_attribute" .IX Subsection "validate_attribute" \&\fIvalidate_attribute()\fR allows you to test how an attribute looks once built and attached to a class. .PP Let's say you have an attribute defined like this: .PP .Vb 7 \& has foo => ( \& traits => [ \*(AqTestRole\*(Aq ], \& is => \*(Aqro\*(Aq, \& isa => \*(AqInt\*(Aq, \& builder => \*(Aq_build_foo\*(Aq, \& lazy => 1, \& ); .Ve .PP You can use \fIvalidate_attribute()\fR to ensure that it's built out in the way you expect: .PP .Vb 10 \& validate_attribute TestClass => foo => ( \& \-does => [ \*(AqTestRole\*(Aq ], \& \-isa => [ \*(AqMoose::Meta::Attribute\*(Aq ], # for demonstration\*(Aqs sake \& traits => [ \*(AqTestRole\*(Aq ], \& isa => \*(AqInt\*(Aq, \& does => \*(AqBar\*(Aq, \& handles => { }, \& reader => \*(Aqfoo\*(Aq, \& builder => \*(Aq_build_foo\*(Aq, \& default => undef, \& init_arg => \*(Aqfoo\*(Aq, \& lazy => 1, \& required => undef, \& ); .Ve .PP Not yet documented or tested exhaustively; please see t/validate_attribute.t for details at the moment. This test routine is likely to change in implementation and scope, with every effort to maintain backwards compatibility. .SS "attribute_options_ok" .IX Subsection "attribute_options_ok" Validates that an attribute is set up as expected; like \fIvalidate_attribute()\fR, but only concerns itself with attribute options. .PP Not yet documented or tested exhaustively; please see t/validate_attribute.t for details at the moment. This test routine is likely to change in implementation and scope, with every effort to maintain backwards compatibility. .SH "SEE ALSO" .IX Header "SEE ALSO" Please see those modules/websites for more information related to this module. .IP "\(bu" 4 Test::Moose .SH "SOURCE" .IX Header "SOURCE" The development version is on github at and may be cloned from .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests on the bugtracker website https://github.com/RsrchBoy/Test\-Moose\-More/issues .PP When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. .SH "AUTHOR" .IX Header "AUTHOR" Chris Weyl .SS "I'm a material boy in a material world" .IX Subsection "I'm a material boy in a material world" Please note \fBI do not expect to be gittip'ed or flattr'ed for this work\fR, rather \fBit is simply a very pleasant surprise\fR. I largely create and release works like this because I need them or I find it enjoyable; however, don't let that stop you if you feel like it ;) .PP Flattr this , gittip me , or indulge my Amazon Wishlist ... If you so desire. .SH "CONTRIBUTOR" .IX Header "CONTRIBUTOR" Karen Etheridge .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2012 by Chris Weyl. .PP This is free software, licensed under: .PP .Vb 1 \& The GNU Lesser General Public License, Version 2.1, February 1999 .Ve