Tidy code and use Test::Exception
[gitmo/MooseX-Singleton.git] / t / 006-cooperative.t
CommitLineData
8eec3c69 1use strict;
2use warnings;
3
4use Test::More;
5
6BEGIN {
7 eval "require MooseX::StrictConstructor; use Test::Exception; 1;";
8 plan skip_all => 'This test requires MooseX::StrictConstructor and Test::Exception'
9 if $@;
10}
11
12plan 'no_plan';
13
14{
15 package MySingleton;
16 use Moose;
17 use MooseX::Singleton;
18 use MooseX::StrictConstructor;
19
20 has 'attrib' =>
21 is => 'rw';
22}
23
24throws_ok {
25 MySingleton->new( bad_name => 42 )
26}
27qr/Found unknown attribute/,
28'singleton class also has a strict constructor';