From: Jesse Luehrs Date: Sat, 5 Jun 2010 09:09:46 +0000 (-0500) Subject: todo test for insertion order from roles X-Git-Tag: 1.07~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21fd40b05a5551682a50a23e9d3768a8dcf76f1e;p=gitmo%2FMoose.git todo test for insertion order from roles --- diff --git a/t/600_todo_tests/004_role_insertion_order.t b/t/600_todo_tests/004_role_insertion_order.t new file mode 100644 index 0000000..92f3462 --- /dev/null +++ b/t/600_todo_tests/004_role_insertion_order.t @@ -0,0 +1,42 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +{ + package Foo::Role; + use Moose::Role; + has 'a' => (is => 'ro'); + has 'b' => (is => 'ro'); + has 'c' => (is => 'ro'); +} + +{ + package Foo; + use Moose; + has 'd' => (is => 'ro'); + with 'Foo::Role'; + has 'e' => (is => 'ro'); +} + +my %role_insertion_order = ( + a => 0, + b => 1, + c => 2, +); + +is_deeply({ map { $_->name => $_->insertion_order } map { Foo::Role->meta->get_attribute($_) } Foo::Role->meta->get_attribute_list }, \%role_insertion_order, "right insertion order within the role"); + +my %class_insertion_order = ( + d => 0, + a => 1, + b => 2, + c => 3, + e => 4, +); + +{ local $TODO = "insertion order is lost during role application"; +is_deeply({ map { $_->name => $_->insertion_order } Foo->meta->get_all_attributes }, \%class_insertion_order, "right insertion order within the class"); +} + +done_testing;