simplify more stuff
[gitmo/Class-MOP.git] / t / 308_insertion_order.t
CommitLineData
86a4d873 1use strict;
2use warnings;
3use Test::More;
e237c683 4use Class::MOP;
5
e237c683 6my $Point = Class::MOP::Class->create('Point' => (
7 version => '0.01',
8 attributes => [
9 Class::MOP::Attribute->new('x' => (
10 reader => 'x',
11 init_arg => 'x'
12 )),
13 Class::MOP::Attribute->new('y' => (
14 accessor => 'y',
15 init_arg => 'y'
86a4d873 16 )),
e237c683 17 ],
18 methods => {
19 'new' => sub {
20 my $class = shift;
21 my $instance = $class->meta->new_object(@_);
22 bless $instance => $class;
23 },
24 'clear' => sub {
25 my $self = shift;
26 $self->{'x'} = 0;
86a4d873 27 $self->{'y'} = 0;
e237c683 28 }
29 }
30));
31
32is($Point->get_attribute('x')->insertion_order, 0, 'Insertion order of Attribute "x"');
33is($Point->get_attribute('y')->insertion_order, 1, 'Insertion order of Attribute "y"');
34
86a4d873 35done_testing;