annotate _test/Test/Class/Meta.pm @ 284:f2a6bc5f3184

+IMPL::Object::InlineFactory: implement object factory as subroutine
author sergey
date Thu, 14 Feb 2013 19:14:02 +0400
parents a8db61d0ed33
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
1 use strict;
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
2
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
3 package Test::Class::Meta;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
4 use parent qw(IMPL::Test::Unit);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
5
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
6 __PACKAGE__->PassThroughArgs;
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
7
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
8 use IMPL::Test qw(test failed assert);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
9
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
10 test defineFooClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
11 Foo->static_accessor(info => {},'clone');
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
12 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
13
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
14 test updateFooClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
15 Foo->info->{data} = 'Foo' ;
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
16 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
17
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
18 test getFooClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
19 assert( Foo->info->{data} eq 'Foo' );
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
20 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
21
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
22 test getBazClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
23 assert( Baz->info->{data} eq 'Foo' );
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
24 assert( Bar->info->{data} eq 'Foo' );
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
25 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
26
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
27 test updateBarClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
28 Bar->info->{data} = 'Bar';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
29 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
30
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
31 test getBarClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
32 assert( Bar->info->{data} eq 'Bar');
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
33 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
34
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
35 test validatetFooClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
36 assert( Foo->info->{data} eq 'Foo');
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
37 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
38
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
39 test validateBazClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
40 assert( Baz->info->{data} eq 'Foo');
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
41 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
42
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
43 test getwrongBazClassData => sub {
209
a8db61d0ed33 IMPL::Class::Meta refactoring
cin
parents: 194
diff changeset
44 assert( not eval { Foo->info2; 1; } );
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
45 };
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
46
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
47
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
48
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
49 package Foo;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
50 use parent qw(IMPL::Class::Meta);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
51
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
52 package Bar;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
53 use parent qw(-norequire Foo);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
54
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
55 package Baz;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
56 use parent qw(-norequire Foo);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
57
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
58 1;