X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-UndefTolerant.git;a=blobdiff_plain;f=t%2Froles.t;h=bd56a22e5ffbf02fce82640ffd487c68ae0300b2;hp=cfc989fc5d7531a68ec8c2bca644a07603f58878;hb=26dd75e6d164e2526bd80de2021e544cdf5982d0;hpb=fff0a09d7aa2aaccf7ab93d2f5cb005ada59a1d9 diff --git a/t/roles.t b/t/roles.t index cfc989f..bd56a22 100644 --- a/t/roles.t +++ b/t/roles.t @@ -1,6 +1,6 @@ -#!/usr/bin/env perl use strict; use warnings; + use Test::More; use Test::Moose; use Test::Fatal; @@ -39,6 +39,27 @@ plan skip_all => "only relevant for Moose 2.0" with 'Foo::Role', 'Bar::Role'; } +{ + package Baz::Role; + use Moose::Role; + with 'Foo::Role'; +} + +{ + package Baz; + use Moose; + + with 'Baz::Role'; +} + +{ + package Quux; + use Moose; + + with 'Foo::Role'; + with 'Bar::Role'; +} + with_immutable { my $foo; is(exception { $foo = Foo->new(foo => undef) }, undef, @@ -49,6 +70,16 @@ with_immutable { is(exception { $bar = Bar->new(foo => undef) }, undef, "can set to undef in constructor"); ok(!$bar->has_foo, "role attribute isn't set"); -} 'Foo', 'Bar'; + + my $baz; + is(exception { $baz = Baz->new(foo => undef) }, undef, + "can set to undef in constructor"); + ok(!$baz->has_foo, "role attribute isn't set"); + + my $quux; + is(exception { $quux = Quux->new(foo => undef) }, undef, + "can set to undef in constructor"); + ok(!$quux->has_foo, "role attribute isn't set"); +} 'Foo', 'Bar', 'Baz', 'Quux'; done_testing;