comparison _test/Test/Class/Template.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children 56364d0c4b4f
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
8 8
9 use IMPL::Test qw(test failed); 9 use IMPL::Test qw(test failed);
10 use IMPL::lang; 10 use IMPL::lang;
11 11
12 { 12 {
13 package My::Collection; 13 package My::Collection;
14 use parent qw(IMPL::Object); 14 use parent qw(IMPL::Object);
15 use IMPL::Class::Property; 15 use IMPL::Class::Property;
16 16
17 use IMPL::template ( 17 use IMPL::template (
18 parameters => [qw(TValue)], 18 parameters => [qw(TValue)],
19 declare => sub { 19 declare => sub {
20 my ($class) = @_; 20 my ($class) = @_;
21 21
22 public $class->CreateProperty( items => prop_get | owner_set | prop_list, { type => $class->TValue } ); 22 public $class->CreateProperty( items => prop_get | owner_set | prop_list, { type => $class->TValue } );
23 } 23 }
24 ); 24 );
25 25
26 BEGIN { 26 BEGIN {
27 public property name => prop_all; 27 public property name => prop_all;
28 } 28 }
29 }; 29 };
30 30
31 test IsDerivedFromTemplate => sub { 31 test IsDerivedFromTemplate => sub {
32 failed "My::Collection should be a subclass of IMPL::Class:Template" unless is('My::Collection','IMPL::Class::Template'); 32 failed "My::Collection should be a subclass of IMPL::Class:Template" unless is('My::Collection','IMPL::Class::Template');
33 }; 33 };
34 34
35 test Specialize => sub { 35 test Specialize => sub {
36 my $colList = spec My::Collection('IMPL::Object::List'); 36 my $colList = spec My::Collection('IMPL::Object::List');
37 my $colObj = spec My::Collection('IMPL::Object'); 37 my $colObj = spec My::Collection('IMPL::Object');
38 my $colList2 = spec My::Collection('IMPL::Object::List'); 38 my $colList2 = spec My::Collection('IMPL::Object::List');
39 39
40 failed "Wrong class name", "expected: My::ColectionLis", "got: $colList" unless $colList eq 'My::CollectionList'; 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'; 41 failed "Wrong template parameter type", "expected: IMPL::Object::List", "got" . $colList->TValue unless $colList->TValue eq 'IMPL::Object::List';
42 42
43 }; 43 };
44 44
45 1; 45 1;