X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_mouse%2F060-threads.t;h=c6dd87629dc007877cfc83c0bef0ea2a916eaf4d;hb=HEAD;hp=65331f0dd253868a6396472142ca7aa93a52e2b8;hpb=652b2a9784bdd5fdb2d36e941e5dbec965532268;p=gitmo%2FMouse.git diff --git a/t/001_mouse/060-threads.t b/t/001_mouse/060-threads.t index 65331f0..c6dd876 100644 --- a/t/001_mouse/060-threads.t +++ b/t/001_mouse/060-threads.t @@ -2,10 +2,13 @@ use strict; use warnings; use constant HAS_THREADS => eval{ require threads && require threads::shared }; - -use if !HAS_THREADS, 'Test::More', (skip_all => "This is a test for threads ($@)"); use Test::More; +use if !HAS_THREADS, 'Test::More', + (skip_all => "This is a test for threads ($@)"); +use if $Test::More::VERSION >= 2.00, 'Test::More', + (skip_all => "Test::Builder2 has bugs about threads"); + { package MyTraits; use Mouse::Role; @@ -17,6 +20,12 @@ use Test::More; is => 'rw', isa => 'Foo', ); + has bar => ( + is => 'rw', + + lazy => 1, + default => sub { 42 }, + ); package Foo; use Mouse; @@ -28,6 +37,7 @@ use Test::More; traits => [qw(MyTraits)], ); } +pass; my $o = MyClass->new(foo => Foo->new(value => 42)); threads->create(sub{ @@ -46,6 +56,8 @@ threads->create(sub{ $x->foo(Foo->new(value => 20)); is $x->foo->value, 20; + + is $x->bar, 42, 'callback for default'; })->join(); is $o->foo->value, 42; @@ -55,4 +67,6 @@ is $o->foo->value, 43; ok !$o->meta->is_immutable; +pass "done"; + done_testing;