Remove useless whitespace
[gitmo/MooseX-Singleton.git] / t / 005-build_bug-immutable.t
CommitLineData
e2119ce9 1use strict;
2use warnings;
3
e01c7277 4use Test::More;
e2119ce9 5
6{
7 package MySingleton;
8 use MooseX::Singleton;
9
10 has 'attrib' =>
11 is => 'rw',
12 isa => 'Str',
13 default => 'foo';
14
15 sub hello {'world'}
16
17 sub BUILDARGS {
18 my ( $class, %opts ) = @_;
19
20 { attrib => 'bar', %opts };
21 }
22
23 __PACKAGE__->meta->make_immutable;
24}
25
26is(
27 MySingleton->attrib, 'bar',
28 'BUILDARGS changed value of attrib when instance was auto-instantiated'
29);
30
31MySingleton->meta->remove_package_glob('singleton');
32
33MySingleton->instance;
34
35is(
36 MySingleton->attrib, 'bar',
37 'BUILDARGS changed value of attrib when instance was explicitly instantiated'
38);
e01c7277 39
40done_testing;