Mercurial > pub > Impl
annotate _test/Test/Class/Template.pm @ 364:82b6c967bcf1
sync, working on metadata
author | cin |
---|---|
date | Fri, 29 Nov 2013 16:33:07 +0400 |
parents | 4ddb27ff4a0b |
children |
rev | line source |
---|---|
165 | 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 { | |
194 | 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 | |
278 | 22 $class->CreateProperty( items => prop_get | owner_set | prop_list, { type => $class->TValue } ); |
194 | 23 } |
24 ); | |
25 | |
26 BEGIN { | |
27 public property name => prop_all; | |
28 } | |
165 | 29 }; |
30 | |
31 test IsDerivedFromTemplate => sub { | |
271
56364d0c4b4f
+IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents:
194
diff
changeset
|
32 failed "My::Collection should be a subclass of IMPL::Class:Template" unless isclass('My::Collection','IMPL::Class::Template'); |
165 | 33 }; |
34 | |
35 test Specialize => sub { | |
194 | 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 | |
165 | 43 }; |
44 | |
180 | 45 1; |