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