summaryrefslogtreecommitdiff
path: root/t/cmop/insertion_order.t
diff options
context:
space:
mode:
Diffstat (limited to 't/cmop/insertion_order.t')
-rw-r--r--t/cmop/insertion_order.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/cmop/insertion_order.t b/t/cmop/insertion_order.t
new file mode 100644
index 0000000..073d3b3
--- /dev/null
+++ b/t/cmop/insertion_order.t
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+use Test::More;
+use Class::MOP;
+
+my $Point = Class::MOP::Class->create('Point' => (
+ version => '0.01',
+ attributes => [
+ Class::MOP::Attribute->new('x' => (
+ reader => 'x',
+ init_arg => 'x'
+ )),
+ Class::MOP::Attribute->new('y' => (
+ accessor => 'y',
+ init_arg => 'y'
+ )),
+ ],
+ methods => {
+ 'new' => sub {
+ my $class = shift;
+ my $instance = $class->meta->new_object(@_);
+ bless $instance => $class;
+ },
+ 'clear' => sub {
+ my $self = shift;
+ $self->{'x'} = 0;
+ $self->{'y'} = 0;
+ }
+ }
+));
+
+is($Point->get_attribute('x')->insertion_order, 0, 'Insertion order of Attribute "x"');
+is($Point->get_attribute('y')->insertion_order, 1, 'Insertion order of Attribute "y"');
+
+done_testing;