Mercurial > pub > Impl
comparison Lib/IMPL/Test.pm @ 278:4ddb27ff4a0b
core refactoring
| author | cin |
|---|---|
| date | Mon, 04 Feb 2013 02:10:37 +0400 |
| parents | 6253872024a4 |
| children | 546957c50a36 |
comparison
equal
deleted
inserted
replaced
| 277:6585464c4664 | 278:4ddb27ff4a0b |
|---|---|
| 1 package IMPL::Test; | 1 package IMPL::Test; |
| 2 use strict; | 2 use strict; |
| 3 use warnings; | 3 use warnings; |
| 4 | 4 |
| 5 use IMPL::Const qw(:access); | |
| 5 require IMPL::Test::SkipException; | 6 require IMPL::Test::SkipException; |
| 6 | 7 |
| 7 require Exporter; | 8 require Exporter; |
| 8 our @ISA = qw(Exporter); | 9 our @ISA = qw(Exporter); |
| 9 our @EXPORT_OK = qw(&test &shared &failed &cmparray &skip &run_plan &assert &GetCallerSourceLine); | 10 our @EXPORT_OK = qw(&test &shared &failed &cmparray &skip &run_plan &assert &GetCallerSourceLine); |
| 10 | 11 |
| 11 require IMPL::Test::Unit; | 12 require IMPL::Test::Unit; |
| 12 require IMPL::Test::Plan; | 13 require IMPL::Test::Plan; |
| 13 require IMPL::Test::TAPListener; | 14 require IMPL::Test::TAPListener; |
| 14 use IMPL::Class::Member; | |
| 15 | 15 |
| 16 sub test($$) { | 16 sub test($$) { |
| 17 my ($name,$code) = @_; | 17 my ($name,$code) = @_; |
| 18 my $class = caller; | 18 my $class = caller; |
| 19 | 19 |
| 26 my ($propInfo) = @_; | 26 my ($propInfo) = @_; |
| 27 | 27 |
| 28 my $class = caller; | 28 my $class = caller; |
| 29 | 29 |
| 30 die new IMPL::Exception("Only properties could be declared as shared",$propInfo->name) unless eval {$propInfo->isa('IMPL::Class::PropertyInfo')}; | 30 die new IMPL::Exception("Only properties could be declared as shared",$propInfo->name) unless eval {$propInfo->isa('IMPL::Class::PropertyInfo')}; |
| 31 die new IMPL::Exception("You can't mark the readonly property as shared",$propInfo->name) unless $propInfo->canSet; | 31 die new IMPL::Exception("You can't mark the readonly property as shared",$propInfo->name) unless $propInfo->setter; |
| 32 die new IMPL::Exception("Only public properties could be declared as shared",$propInfo->name) unless $propInfo->access == IMPL::Class::Member::MOD_PUBLIC; | 32 die new IMPL::Exception("Only public properties could be declared as shared",$propInfo->name) unless $propInfo->access == ACCESS_PUBLIC; |
| 33 | 33 |
| 34 $class->set_meta(new IMPL::Test::Unit::SharedData($propInfo->name)); | 34 $class->set_meta(new IMPL::Test::Unit::SharedData($propInfo->name)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 sub failed($;@) { | 37 sub failed($;@) { |
