6 use Test::More tests => 14;
20 ::ok(!$@, '... created the reader method okay');
24 reader => 'get_lazy_foo',
29 ::ok(!$@, '... created the lazy reader method okay') or warn $@;
34 local $SIG{__WARN__} = sub { $warn = $_[0] };
39 ::ok($warn, '... got a warning for mispelled attribute argument');
46 can_ok($foo, 'get_foo');
47 is($foo->get_foo(), undef, '... got an undefined value');
50 } '... get_foo is a read-only';
52 ok(!exists($foo->{lazy_foo}), '... no value in get_lazy_foo slot');
54 can_ok($foo, 'get_lazy_foo');
55 is($foo->get_lazy_foo(), 10, '... got an deferred value');
57 $foo->get_lazy_foo(100);
58 } '... get_lazy_foo is a read-only';
62 my $foo = Foo->new(foo => 10, lazy_foo => 100);
65 is($foo->get_foo(), 10, '... got the correct value');
66 is($foo->get_lazy_foo(), 100, '... got the correct value');