2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
10 $TODO = q{Mouse is not yet completed};
22 my ($self, $value, $callback, $attr) = @_;
24 ::isa_ok($attr, 'Mouse::Meta::Attribute');
25 ::is($attr->name, 'foo', '... got the right name');
27 $callback->($value * 2);
32 reader => 'get_lazy_foo',
36 my ($self, $value, $callback, $attr) = @_;
38 ::isa_ok($attr, 'Mouse::Meta::Attribute');
39 ::is($attr->name, 'lazy_foo', '... got the right name');
41 $callback->($value * 2);
45 has 'lazy_foo_w_type' => (
46 reader => 'get_lazy_foo_w_type',
51 my ($self, $value, $callback, $attr) = @_;
53 ::isa_ok($attr, 'Mouse::Meta::Attribute');
54 ::is($attr->name, 'lazy_foo_w_type', '... got the right name');
56 $callback->($value * 2);
60 has 'lazy_foo_builder' => (
61 reader => 'get_lazy_foo_builder',
62 builder => 'get_foo_builder',
64 my ($self, $value, $callback, $attr) = @_;
66 ::isa_ok($attr, 'Mouse::Meta::Attribute');
67 ::is($attr->name, 'lazy_foo_builder', '... got the right name');
69 $callback->($value * 2);
73 has 'lazy_foo_builder_w_type' => (
74 reader => 'get_lazy_foo_builder_w_type',
76 builder => 'get_foo_builder_w_type',
78 my ($self, $value, $callback, $attr) = @_;
80 ::isa_ok($attr, 'Mouse::Meta::Attribute');
81 ::is($attr->name, 'lazy_foo_builder_w_type', '... got the right name');
83 $callback->($value * 2);
87 sub get_foo_builder { 100 }
88 sub get_foo_builder_w_type { 1000 }
92 my $foo = Foo->new(foo => 10);
95 is($foo->get_foo, 20, 'initial value set to 2x given value');
96 is($foo->get_lazy_foo, 20, 'initial lazy value set to 2x given value');
97 is($foo->get_lazy_foo_w_type, 40, 'initial lazy value with type set to 2x given value');
98 is($foo->get_lazy_foo_builder, 200, 'initial lazy value with builder set to 2x given value');
99 is($foo->get_lazy_foo_builder_w_type, 2000, 'initial lazy value with builder and type set to 2x given value');
110 my ($self, $value, $callback, $attr) = @_;
112 ::isa_ok($attr, 'Mouse::Meta::Attribute');
113 ::is($attr->name, 'foo', '... got the right name');
115 $callback->($value * 2);
119 __PACKAGE__->meta->make_immutable;
123 my $bar = Bar->new(foo => 10);
126 is($bar->get_foo, 20, 'initial value set to 2x given value');
138 my ($self, $value, $callback, $attr) = @_;
140 ::isa_ok($attr, 'Mouse::Meta::Attribute');
141 ::is($attr->name, 'foo', '... got the right name');
143 $callback->("Hello $value World");
147 __PACKAGE__->meta->make_immutable;
151 Fail::Bar->new(foo => 10)
152 } '... this fails, because initializer returns a bad type';