use strict;
use warnings;
+use Scalar::Util qw( refaddr );
use Test::More;
BEGIN {
plan skip_all => 'These tests require Test::Warn';
}
else {
- plan tests => 17;
+ plan tests => 18;
}
}
-BEGIN {
+{
package MooseX::Singleton::Test;
use MooseX::Singleton;
$self->bag->{$key} += $value;
}
- ::warning_is sub { make_immutable }, '',
+ ::warning_is sub { __PACKAGE__->meta->make_immutable }, '',
'no warnings when calling make_immutable';
}
is($mst2->distinct_keys, 0, "Package->clear works");
is(MooseX::Singleton::Test->distinct_keys, 0, "Package->clear works");
+{
+ my $addr;
+
+ {
+ $addr = refaddr( MooseX::Singleton::Test->instance );
+ }
+
+ is( $addr, refaddr( MooseX::Singleton::Test->instance ),
+ 'singleton is not randomly destroyed' );
+}
+