annotate _test/Test/Class/Meta.pm @ 197:6b1dda998839

Added IMPL::declare, IMPL::require, to simplify module definitions IMPL::Transform now admires object inheritance while searching for the transformation Added HTTP some exceptions IMPL::Web::Application::RestResource almost implemented
author sergey
date Thu, 19 Apr 2012 02:10:02 +0400
parents 4d0e1962161c
children a8db61d0ed33
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
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
8 use IMPL::Test qw(test failed);
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
11 Foo->class_data(info => {});
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
15 Foo->class_data('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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
19 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
23 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
24 };
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 test updateBarClassData => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
27 Bar->class_data('info')->{data} = 'Bar';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
28 };
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 test getBarClassData => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
31 failed "Wrong class data", "Expected: Bar", "Got: ".Bar->class_data('info')->{data} unless Bar->class_data('info')->{data} eq 'Bar';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
32 };
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 test validatetFooClassData => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
35 failed "Wrong class data", "Expected: Foo", "Got: ".Foo->class_data('info')->{data} unless Foo->class_data('info')->{data} eq 'Foo';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
36 };
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 test validateBazClassData => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
39 failed "Wrong class data", "Expected: Foo", "Got: ".Baz->class_data('info')->{data} unless Baz->class_data('info')->{data} eq 'Foo';
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
40 };
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 test getwrongBazClassData => sub {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 165
diff changeset
43 failed "Wrong class data", "Expected: undef", "Got: ".Foo->class_data( 'info2' ) if Foo->class_data( 'info2' );
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
44 };
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 package Foo;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
49 use parent qw(IMPL::Class::Meta);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
50
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
51 package Bar;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
52 use parent qw(-norequire Foo);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
53
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
54 package Baz;
165
76515373dac0 Added Class::Template,
wizard
parents: 90
diff changeset
55 use parent qw(-norequire Foo);
90
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
56
dc1da0389db7 Small improvements in the abstract object class
wizard
parents:
diff changeset
57 1;