4 use Test::More tests => 30;
13 isa => 'Test::Builder',
16 package Test::Builder::Subclass;
17 our @ISA = qw(Test::Builder);
20 can_ok(Class => 'tb');
23 Class->new(tb => Test::Builder->new);
27 # Test::Builder was a bizarre choice, because it's a singleton. Because of
28 # that calling new on T:B:S won't work. Blessing directly -- rjbs,
30 Class->new(tb => (bless {} => 'Test::Builder::Subclass'));
34 my $class = Class->new;
35 $class->tb(Test::Builder->new);
36 isa_ok($class->tb, 'Test::Builder');
41 } qr/Attribute \(tb\) does not pass the type constraint because: Validation failed for 'Test::Builder' failed with value 3/;
44 my $class = Class->new;
46 } qr/Attribute \(tb\) does not pass the type constraint because: Validation failed for 'Test::Builder' failed with value 3/;
49 Class->new(tb => Class->new);
50 } qr/Attribute \(tb\) does not pass the type constraint because: Validation failed for 'Test::Builder' failed with value Class=HASH\(\w+\)/;
64 } qr/Attribute \(oops\) does not pass the type constraint because: Validation failed for 'Int' failed with value yikes/;
67 Other->new(oops => 10);
70 # ClassName coverage tests
83 our @ISA = 'Mouse::Object';
98 package ClassNameTests;
107 for ('B'..'E', 'G::H') {
109 ClassNameTests->new(class => $_);
113 my $obj = ClassNameTests->new;
119 local $TODO = "Moose throws errors here. Mouse does not";
121 ClassNameTests->new(class => 'A');
122 } qr/Attribute \(class\) does not pass the type constraint because: Validation failed for 'ClassName' failed with value A/;
125 my $obj = ClassNameTests->new;
127 } qr/Attribute \(class\) does not pass the type constraint because: Validation failed for 'ClassName' failed with value A/;
130 for ('F', 'G', 'I', 'Z') {
132 ClassNameTests->new(class => $_);
133 } qr/Attribute \(class\) does not pass the type constraint because: Validation failed for 'ClassName' failed with value $_/;
136 my $obj = ClassNameTests->new;
138 } qr/Attribute \(class\) does not pass the type constraint because: Validation failed for 'ClassName' failed with value $_/;