Remove useless whitespace
[gitmo/MooseX-Singleton.git] / t / 005-build_bug-immutable.t
1 use strict;
2 use warnings;
3
4 use Test::More;
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
26 is(
27     MySingleton->attrib, 'bar',
28     'BUILDARGS changed value of attrib when instance was auto-instantiated'
29 );
30
31 MySingleton->meta->remove_package_glob('singleton');
32
33 MySingleton->instance;
34
35 is(
36     MySingleton->attrib, 'bar',
37     'BUILDARGS changed value of attrib when instance was explicitly instantiated'
38 );
39
40 done_testing;