6 use Test::More tests => 19;
11 require_ok(File::Spec->catdir('examples', 'AttributesWithHistory.pod'));
18 Foo->meta->add_attribute(AttributesWithHistory->new('foo' => (
20 history_accessor => 'get_foo_history',
23 Foo->meta->add_attribute(AttributesWithHistory->new('bar' => (
26 history_accessor => 'get_bar_history',
31 $class->meta->new_object(@_);
39 can_ok($foo, 'get_foo_history');
40 can_ok($foo, 'set_bar');
41 can_ok($foo, 'get_bar');
42 can_ok($foo, 'get_bar_history');
44 is($foo->foo, undef, '... foo is not yet defined');
46 [ $foo->get_foo_history() ],
48 '... got correct empty history for foo');
51 is($foo->foo, 42, '... foo == 42');
53 [ $foo->get_foo_history() ],
55 '... got correct history for foo');
63 [ $foo->get_foo_history() ],
64 [ 42, 43, 44, 45, 46 ],
65 '... got correct history for foo');
67 is($foo->get_bar, undef, '... bar is not yet defined');
69 [ $foo->get_bar_history() ],
71 '... got correct empty history for foo');
75 is($foo->get_bar, "FOO", '... bar == "FOO"');
77 [ $foo->get_bar_history() ],
79 '... got correct history for foo');
85 [ $foo->get_bar_history() ],
87 '... got correct history for bar');
90 [ $foo->get_foo_history() ],
91 [ 42, 43, 44, 45, 46 ],
92 '... still have the correct history for foo');