New modules
[gitmo/Moose.git] / lib / Test / Moose.pm
1 package Test::Moose;
2
3 use Exporter;
4 use Moose::Util qw/can_role/;
5 use Test::Builder;
6
7 use strict;
8 use warnings;
9
10 our $VERSION = '0.01';
11
12 our $AUTHORITY = 'cpan:BERLE';
13
14 our @EXPORT = qw/can_role/;
15
16 my $tester = Test::Builder->new;
17
18 sub import {
19   my $class = shift;
20
21   if (@_) {
22     my $package = caller;
23     
24     $tester->exported_to ($package);
25
26     $tester->plan (@_);
27   }
28
29   @_ = ($class);
30
31   goto &Exporter::import;
32 }
33
34 sub does_ok ($$;$) {
35   my ($class,$does,$name) = @_;
36
37   return $tester->ok (can_role ($class,$does),$name)
38 }
39
40 1;
41
42 __END__
43
44 =pod
45
46 =head1 NAME
47
48 Test::Moose - Test functions for Moose specific features
49
50 =head1 SYNOPSIS
51
52   use Test::Moose plan => 1;
53
54   does_ok ($class,$role,"Does $class do $role");
55
56 =head1 TESTS
57
58 =over 4
59
60 =item does_ok
61
62   does_ok ($class,$role,$name);
63
64 Tests if a class does a certain role, similar to what isa_ok does for
65 isa.
66
67 =back
68
69 =head1 SEE ALSO
70
71 =over 4
72
73 =item L<Test::More>
74
75 =back
76
77 =head1 BUGS
78
79 All complex software has bugs lurking in it, and this module is no 
80 exception. If you find a bug please either email me, or add the bug
81 to cpan-RT.
82
83 =head1 AUTHOR
84
85 Anders Nor Berle E<lt>debolaz@gmail.comE<gt>
86
87 =head1 COPYRIGHT AND LICENSE
88
89 Copyright 2007 by Infinity Interactive, Inc.
90
91 L<http://www.iinteractive.com>
92
93 This library is free software; you can redistribute it and/or modify
94 it under the same terms as Perl itself. 
95
96 =cut
97