Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / todo_tests / role_insertion_order.t
CommitLineData
21fd40b0 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5
6{
7 package Foo::Role;
8 use Moose::Role;
9 has 'a' => (is => 'ro');
10 has 'b' => (is => 'ro');
11 has 'c' => (is => 'ro');
12}
13
14{
15 package Foo;
16 use Moose;
17 has 'd' => (is => 'ro');
18 with 'Foo::Role';
19 has 'e' => (is => 'ro');
20}
21
22my %role_insertion_order = (
23 a => 0,
24 b => 1,
25 c => 2,
26);
27
28is_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");
29
30my %class_insertion_order = (
31 d => 0,
32 a => 1,
33 b => 2,
34 c => 3,
35 e => 4,
36);
37
38{ local $TODO = "insertion order is lost during role application";
39is_deeply({ map { $_->name => $_->insertion_order } Foo->meta->get_all_attributes }, \%class_insertion_order, "right insertion order within the class");
40}
41
42done_testing;