From: Dave Rolsky Date: Fri, 25 Dec 2009 15:35:17 +0000 (-0600) Subject: Add tests for initialize actually working X-Git-Tag: 0.22~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61c6d582b281667dc3a9e988a6c0b372db396344;p=gitmo%2FMooseX-Singleton.git Add tests for initialize actually working --- diff --git a/t/002-init.t b/t/002-init.t index 040547d..0427694 100644 --- a/t/002-init.t +++ b/t/002-init.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 11; use Test::Exception; my $i = 0; @@ -51,3 +51,16 @@ for my $pkg (new_singleton_pkg) { "...but ->initialize() is still an error"; } +{ + package Single; + + use MooseX::Singleton; + + has foo => ( is => 'ro' ); +} + +{ + Single->initialize( foo => 2 ); + ok( Single->new, 'can call ->new without any args' ); + ok( Single->instance, 'can call ->instance without any args' ); +}