Mercurial > pub > Impl
comparison _test/Test/Class/Meta.pm @ 209:a8db61d0ed33
IMPL::Class::Meta refactoring
author | cin |
---|---|
date | Mon, 28 May 2012 19:58:56 +0400 |
parents | 4d0e1962161c |
children |
comparison
equal
deleted
inserted
replaced
208:3d433a977e3b | 209:a8db61d0ed33 |
---|---|
3 package Test::Class::Meta; | 3 package Test::Class::Meta; |
4 use parent qw(IMPL::Test::Unit); | 4 use parent qw(IMPL::Test::Unit); |
5 | 5 |
6 __PACKAGE__->PassThroughArgs; | 6 __PACKAGE__->PassThroughArgs; |
7 | 7 |
8 use IMPL::Test qw(test failed); | 8 use IMPL::Test qw(test failed assert); |
9 | 9 |
10 test defineFooClassData => sub { | 10 test defineFooClassData => sub { |
11 Foo->class_data(info => {}); | 11 Foo->static_accessor(info => {},'clone'); |
12 }; | 12 }; |
13 | 13 |
14 test updateFooClassData => sub { | 14 test updateFooClassData => sub { |
15 Foo->class_data('info')->{data} = 'Foo' ; | 15 Foo->info->{data} = 'Foo' ; |
16 }; | 16 }; |
17 | 17 |
18 test getFooClassData => sub { | 18 test getFooClassData => sub { |
19 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('info')->{data} eq 'Foo'; | 19 assert( Foo->info->{data} eq 'Foo' ); |
20 }; | 20 }; |
21 | 21 |
22 test getBazClassData => sub { | 22 test getBazClassData => sub { |
23 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo'; | 23 assert( Baz->info->{data} eq 'Foo' ); |
24 assert( Bar->info->{data} eq 'Foo' ); | |
24 }; | 25 }; |
25 | 26 |
26 test updateBarClassData => sub { | 27 test updateBarClassData => sub { |
27 Bar->class_data('info')->{data} = 'Bar'; | 28 Bar->info->{data} = 'Bar'; |
28 }; | 29 }; |
29 | 30 |
30 test getBarClassData => sub { | 31 test getBarClassData => sub { |
31 failed "Wrong class data", "Expected: Bar", "Got: ".Bar->class_data('info')->{data} unless Bar->class_data('info')->{data} eq 'Bar'; | 32 assert( Bar->info->{data} eq 'Bar'); |
32 }; | 33 }; |
33 | 34 |
34 test validatetFooClassData => sub { | 35 test validatetFooClassData => sub { |
35 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('info')->{data} eq 'Foo'; | 36 assert( Foo->info->{data} eq 'Foo'); |
36 }; | 37 }; |
37 | 38 |
38 test validateBazClassData => sub { | 39 test validateBazClassData => sub { |
39 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo'; | 40 assert( Baz->info->{data} eq 'Foo'); |
40 }; | 41 }; |
41 | 42 |
42 test getwrongBazClassData => sub { | 43 test getwrongBazClassData => sub { |
43 failed "Wrong class data", "Expected: undef", "Got: ".Foo->class_data( 'info2' ) if Foo->class_data( 'info2' ); | 44 assert( not eval { Foo->info2; 1; } ); |
44 }; | 45 }; |
45 | 46 |
46 | 47 |
47 | 48 |
48 package Foo; | 49 package Foo; |