X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F001_mouse%2F810-isa-or.t;h=aeb326a5181f1f78a76e0d011cb279a024f3c999;hp=57b212cd11dbae7174f3171add6b28a0b0ee090e;hb=b880de945fcf59e9811132613b5bcbca8a6d8696;hpb=c489a4771291bba160fa598a9293e1efdfc41c2e diff --git a/t/001_mouse/810-isa-or.t b/t/001_mouse/810-isa-or.t index 57b212c..aeb326a 100644 --- a/t/001_mouse/810-isa-or.t +++ b/t/001_mouse/810-isa-or.t @@ -6,7 +6,7 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 22; { package Foo; @@ -103,3 +103,19 @@ isa_ok $k->foo, 'KLASS'; $k->foo(undef); is $k->foo, undef, 'foo is undef'; +# or-combination operator ('|') +{ + use Mouse::Util::TypeConstraints; + my $Int = find_type_constraint 'Int'; + my $Str = find_type_constraint 'Str'; + my $Object = find_type_constraint 'Object'; + + *t = \&Mouse::Util::TypeConstraints::find_or_parse_type_constraint; # alias + + is $Int | $Str, t('Int | Str'); + is $Str | $Int, t('Int | Str'); + + is $Int | $Str | $Object, t('Int | Str | Object'); + is $Str | $Object | $Int, t('Int | Str | Object'); +} +