Mercurial > pub > Impl
comparison _test/Test/Class/Template.pm @ 165:76515373dac0
Added Class::Template,
Rewritten SQL::Schema
'use parent' directive instead of 'use base'
author | wizard |
---|---|
date | Sat, 23 Apr 2011 23:06:48 +0400 |
parents | |
children | d1676be8afcc |
comparison
equal
deleted
inserted
replaced
164:eb3e9861a761 | 165:76515373dac0 |
---|---|
1 package Test::Class::Template; | |
2 use strict; | |
3 use warnings; | |
4 | |
5 use parent qw(IMPL::Test::Unit); | |
6 | |
7 __PACKAGE__->PassThroughArgs; | |
8 | |
9 use IMPL::Test qw(test failed); | |
10 use IMPL::lang; | |
11 | |
12 { | |
13 package My::Collection; | |
14 use parent qw(IMPL::Object); | |
15 use IMPL::Class::Property; | |
16 | |
17 use IMPL::template ( | |
18 parameters => [qw(TValue)], | |
19 declare => sub { | |
20 my ($class) = @_; | |
21 | |
22 public $class->CreateProperty( items => prop_get | owner_set | prop_list, { type => $class->TValue } ); | |
23 } | |
24 ); | |
25 | |
26 BEGIN { | |
27 public property name => prop_all; | |
28 } | |
29 }; | |
30 | |
31 test IsDerivedFromTemplate => sub { | |
32 failed "My::Collection should be a subclass of IMPL::Class:Template" unless is('My::Collection','IMPL::Class::Template'); | |
33 }; | |
34 | |
35 test Specialize => sub { | |
36 my $colList = spec My::Collection('IMPL::Object::List'); | |
37 my $colObj = spec My::Collection('IMPL::Object'); | |
38 my $colList2 = spec My::Collection('IMPL::Object::List'); | |
39 | |
40 failed "Wrong class name", "expected: My::ColectionLis", "got: $colList" unless $colList eq 'My::CollectionList'; | |
41 failed "Wrong template parameter type", "expected: IMPL::Object::List", "got" . $colList->TValue unless $colList->TValue eq 'IMPL::Object::List'; | |
42 | |
43 }; | |
44 | |
45 1; |