90
|
1 use strict;
|
|
2
|
|
3 package Test::Class::Meta;
|
165
|
4 use parent qw(IMPL::Test::Unit);
|
90
|
5
|
|
6 __PACKAGE__->PassThroughArgs;
|
|
7
|
|
8 use IMPL::Test qw(test failed);
|
|
9
|
|
10 test defineFooClassData => sub {
|
194
|
11 Foo->class_data(info => {});
|
90
|
12 };
|
|
13
|
|
14 test updateFooClassData => sub {
|
194
|
15 Foo->class_data('info')->{data} = 'Foo' ;
|
90
|
16 };
|
|
17
|
|
18 test getFooClassData => sub {
|
194
|
19 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('info')->{data} eq 'Foo';
|
90
|
20 };
|
|
21
|
|
22 test getBazClassData => sub {
|
194
|
23 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo';
|
90
|
24 };
|
|
25
|
|
26 test updateBarClassData => sub {
|
194
|
27 Bar->class_data('info')->{data} = 'Bar';
|
90
|
28 };
|
|
29
|
|
30 test getBarClassData => sub {
|
194
|
31 failed "Wrong class data", "Expected: Bar", "Got: ".Bar->class_data('info')->{data} unless Bar->class_data('info')->{data} eq 'Bar';
|
90
|
32 };
|
|
33
|
|
34 test validatetFooClassData => sub {
|
194
|
35 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('info')->{data} eq 'Foo';
|
90
|
36 };
|
|
37
|
|
38 test validateBazClassData => sub {
|
194
|
39 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo';
|
90
|
40 };
|
|
41
|
|
42 test getwrongBazClassData => sub {
|
194
|
43 failed "Wrong class data", "Expected: undef", "Got: ".Foo->class_data( 'info2' ) if Foo->class_data( 'info2' );
|
90
|
44 };
|
|
45
|
|
46
|
|
47
|
|
48 package Foo;
|
165
|
49 use parent qw(IMPL::Class::Meta);
|
90
|
50
|
|
51 package Bar;
|
165
|
52 use parent qw(-norequire Foo);
|
90
|
53
|
|
54 package Baz;
|
165
|
55 use parent qw(-norequire Foo);
|
90
|
56
|
|
57 1;
|