Do a bit of fixing. instance and new are one and the same. More tests to ensure that...
[gitmo/MooseX-Singleton.git] / t / singleton.t
CommitLineData
14676933 1use Test::More tests => 4;
443f4253 2
3use strict;
4use warnings;
5
6{
14676933 7 package Foo::Singleton;
8 use Moose;
443f4253 9
14676933 10 with qw/MooseX::Singleton/;
443f4253 11
14676933 12 has gravy => (is => 'rw');
443f4253 13}
14
14676933 15my $ante = Foo::Singleton->instance;
443f4253 16
14676933 17ok(Foo::Singleton->new,'new');
443f4253 18
14676933 19my $foo = Foo::Singleton->instance;
443f4253 20my $bar = Foo::Singleton->instance;
14676933 21my $baz = Foo::Singleton->new;
443f4253 22
14676933 23$foo->gravy('sauce');
443f4253 24
14676933 25is($bar->gravy,'sauce','singleton');
26is($baz->gravy,'sauce','singleton');
27is($ante->gravy,'sauce','singleton');
443f4253 28