annotate _test/Test/Class/Template.pm @ 180:d1676be8afcc

Перекодировка в utf-8
author sourcer
date Fri, 30 Dec 2011 23:40:00 +0300
parents 76515373dac0
children 4d0e1962161c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
165
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
1 package Test::Class::Template;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
2 use strict;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
3 use warnings;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
4
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
5 use parent qw(IMPL::Test::Unit);
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
6
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
7 __PACKAGE__->PassThroughArgs;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
8
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
9 use IMPL::Test qw(test failed);
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
10 use IMPL::lang;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
11
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
12 {
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
13 package My::Collection;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
14 use parent qw(IMPL::Object);
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
15 use IMPL::Class::Property;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
16
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
17 use IMPL::template (
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
18 parameters => [qw(TValue)],
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
19 declare => sub {
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
20 my ($class) = @_;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
21
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
22 public $class->CreateProperty( items => prop_get | owner_set | prop_list, { type => $class->TValue } );
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
23 }
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
24 );
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
25
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
26 BEGIN {
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
27 public property name => prop_all;
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
28 }
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
29 };
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
30
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
31 test IsDerivedFromTemplate => sub {
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
32 failed "My::Collection should be a subclass of IMPL::Class:Template" unless is('My::Collection','IMPL::Class::Template');
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
33 };
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
34
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
35 test Specialize => sub {
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
36 my $colList = spec My::Collection('IMPL::Object::List');
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
37 my $colObj = spec My::Collection('IMPL::Object');
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
38 my $colList2 = spec My::Collection('IMPL::Object::List');
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
39
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
40 failed "Wrong class name", "expected: My::ColectionLis", "got: $colList" unless $colList eq 'My::CollectionList';
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
41 failed "Wrong template parameter type", "expected: IMPL::Object::List", "got" . $colList->TValue unless $colList->TValue eq 'IMPL::Object::List';
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
42
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
43 };
76515373dac0 Added Class::Template,
wizard
parents:
diff changeset
44
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 165
diff changeset
45 1;