6 use Test::More tests => 18;
15 has 'bar' => (is => 'rw', isa => 'ArrayRef | HashRef');
23 } '... set bar successfully with an ARRAY ref';
27 } '... set bar successfully with a HASH ref';
31 } '... couldnt set bar successfully with a number';
35 } '... couldnt set bar successfully with a CODE ref';
37 # check the constructor
41 } '... created new Foo with bar successfully set with an ARRAY ref';
45 } '... created new Foo with bar successfully set with a HASH ref';
49 } '... didnt create a new Foo with bar as a number';
52 Foo->new(bar => sub {})
53 } '... didnt create a new Foo with bar as a CODE ref';
59 has 'baz' => (is => 'rw', isa => 'Str | CodeRef');
67 } '... set baz successfully with a string';
70 $bar->baz(sub { 'a sub' })
71 } '... set baz successfully with a CODE ref';
74 $bar->baz(\(my $var1))
75 } '... couldnt set baz successfully with a SCALAR ref';
79 } '... couldnt set bar successfully with a HASH ref';
81 # check the constructor
84 Bar->new(baz => 'a string')
85 } '... created new Bar with baz successfully set with a string';
88 Bar->new(baz => sub { 'a sub' })
89 } '... created new Bar with baz successfully set with a CODE ref';
92 Bar->new(baz => \(my $var2))
93 } '... didnt create a new Bar with baz as a number';
97 } '... didnt create a new Bar with baz as a HASH ref';