Commit | Line | Data |
---|---|---|
7125b244 | 1 | #!/usr/bin/perl |
9a641848 | 2 | |
3 | use strict; | |
4 | use warnings; | |
5 | ||
a28e50e4 | 6 | use Test::Builder::Tester; |
7125b244 | 7 | use Test::More; |
8 | ||
adf82331 | 9 | BEGIN { |
adf82331 | 10 | use_ok('Test::Moose'); |
11 | } | |
12 | ||
9a641848 | 13 | { |
7125b244 | 14 | package Foo; |
15 | use Moose::Role; | |
9a641848 | 16 | } |
17 | ||
18 | { | |
7125b244 | 19 | package Bar; |
20 | use Moose; | |
9a641848 | 21 | |
7125b244 | 22 | with qw/Foo/; |
9a641848 | 23 | } |
24 | ||
25 | { | |
7125b244 | 26 | package Baz; |
27 | use Moose; | |
9a641848 | 28 | } |
29 | ||
30 | # class ok | |
31 | ||
32 | test_out('ok 1 - does_ok class'); | |
33 | ||
34 | does_ok('Bar','Foo','does_ok class'); | |
35 | ||
36 | # class fail | |
37 | ||
38 | test_out ('not ok 2 - does_ok class fail'); | |
9a641848 | 39 | test_fail (+2); |
40 | ||
41 | does_ok('Baz','Foo','does_ok class fail'); | |
42 | ||
43 | # object ok | |
44 | ||
45 | my $bar = Bar->new; | |
46 | ||
47 | test_out ('ok 3 - does_ok object'); | |
48 | ||
49 | does_ok ($bar,'Foo','does_ok object'); | |
50 | ||
51 | # object fail | |
52 | ||
53 | my $baz = Baz->new; | |
54 | ||
55 | test_out ('not ok 4 - does_ok object fail'); | |
9a641848 | 56 | test_fail (+2); |
57 | ||
58 | does_ok ($baz,'Foo','does_ok object fail'); | |
59 | ||
60 | test_test ('does_ok'); | |
61 | ||
a28e50e4 | 62 | done_testing; |