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
index de4eab6..8f4ca17 100644 (file)
@@ -1,25 +1,28 @@
-use Test::More tests => 2;
+use Test::More tests => 4;
 
 use strict;
 use warnings;
 
 {
-  package Foo::Singleton;
+    package Foo::Singleton;
+    use Moose;
 
-  use Moose;
+    with qw/MooseX::Singleton/;
 
-  has gravy => (is => 'rw');
-
-  with qw/MooseX::Singleton/;
+    has gravy => (is => 'rw');
 }
 
-ok (Foo::Singleton->new,'new');
+my $ante = Foo::Singleton->instance;
 
-my $foo = Foo::Singleton->instance;
+ok(Foo::Singleton->new,'new');
 
+my $foo = Foo::Singleton->instance;
 my $bar = Foo::Singleton->instance;
+my $baz = Foo::Singleton->new;
 
-$foo->gravy ('sauce');
+$foo->gravy('sauce');
 
-is ($bar->gravy,'sauce','singleton');
+is($bar->gravy,'sauce','singleton');
+is($baz->gravy,'sauce','singleton');
+is($ante->gravy,'sauce','singleton');