Mercurial > pub > Impl
diff _test/Test/Object/Fields.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 |
line wrap: on
line diff
--- a/_test/Test/Object/Fields.pm Tue Apr 10 08:13:22 2012 +0400 +++ b/_test/Test/Object/Fields.pm Tue Apr 10 20:08:29 2012 +0400 @@ -8,47 +8,47 @@ __PACKAGE__->PassThroughArgs; { - package Fields::Foo; - use base qw(IMPL::Object::Fields); - - use fields qw(name info); - - sub CTOR { - my ($this,$name,$info) = @_; - - $this->{name} = $name; - $this->{info} = $info; - } - - package Fields::Bar; - use base qw(Fields::Foo); - use fields qw(id); - - our %CTOR = ( - 'Fields::Foo' => sub { - my %args = @_; - Bar => $args{info}; - } - ); - - sub CTOR { - my ($this,%args) = @_; - - $this->{id} = $args{id}; - } + package Fields::Foo; + use base qw(IMPL::Object::Fields); + + use fields qw(name info); + + sub CTOR { + my ($this,$name,$info) = @_; + + $this->{name} = $name; + $this->{info} = $info; + } + + package Fields::Bar; + use base qw(Fields::Foo); + use fields qw(id); + + our %CTOR = ( + 'Fields::Foo' => sub { + my %args = @_; + Bar => $args{info}; + } + ); + + sub CTOR { + my ($this,%args) = @_; + + $this->{id} = $args{id}; + } } test constructObject => sub { - my $obj = new Fields::Foo( Peter => '34-fg-78' ); - - $obj->{name} eq 'Peter' or failed "A value of 'name' field is wrong","Expected: 'Peter'","Got: '$obj->{name}'"; + my $obj = new Fields::Foo( Peter => '34-fg-78' ); + + $obj->{name} eq 'Peter' or failed "A value of 'name' field is wrong","Expected: 'Peter'","Got: '$obj->{name}'"; }; test inheritance => sub { - my $obj = new Fields::Bar( id => '1ba356f', info => 'standard bar'); - - $obj->{name} eq 'Bar' or failed "A value of 'name' property is wrong","Expected: 'Bar'","Got: '$obj->{name}'"; - $obj->{id} eq '1ba356f' or failed "A value of 'id' property is wrong","Expected: '1ba356f'","Got: '$obj->{id}'"; + my $obj = new Fields::Bar( id => '1ba356f', info => 'standard bar'); + + $obj->{name} eq 'Bar' or failed "A value of 'name' property is wrong","Expected: 'Bar'","Got: '$obj->{name}'"; + $obj->{id} eq '1ba356f' or failed "A value of 'id' property is wrong","Expected: '1ba356f'","Got: '$obj->{id}'"; }; 1;