Mercurial > pub > Impl
comparison Lib/IMPL/Test.pm @ 3:2e546a5175dd
in developing
author | Sergey |
---|---|
date | Tue, 11 Aug 2009 17:45:52 +0400 |
parents | 03e58a454b20 |
children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
2:78cd38551534 | 3:2e546a5175dd |
---|---|
2 use strict; | 2 use strict; |
3 use warnings; | 3 use warnings; |
4 | 4 |
5 require Exporter; | 5 require Exporter; |
6 our @ISA = qw(Exporter); | 6 our @ISA = qw(Exporter); |
7 our @EXPORT_OK = qw(&test &shared); | 7 our @EXPORT_OK = qw(&test &shared &failed &cmparray); |
8 | 8 |
9 require IMPL::Test::Unit; | 9 require IMPL::Test::Unit; |
10 use IMPL::Class::Member; | 10 use IMPL::Class::Member; |
11 | 11 |
12 sub test($$) { | 12 sub test($$) { |
27 die new IMPL::Exception("You can't mark the readonly property as shared",$propInfo->Name) unless $propInfo->canSet; | 27 die new IMPL::Exception("You can't mark the readonly property as shared",$propInfo->Name) unless $propInfo->canSet; |
28 die new IMPL::Exception("Only public properties could be declared as shared",$propInfo->Name) unless $propInfo->Access == IMPL::Class::Member::MOD_PUBLIC; | 28 die new IMPL::Exception("Only public properties could be declared as shared",$propInfo->Name) unless $propInfo->Access == IMPL::Class::Member::MOD_PUBLIC; |
29 | 29 |
30 $class->set_meta(new IMPL::Test::Unit::SharedData($propInfo->Name)); | 30 $class->set_meta(new IMPL::Test::Unit::SharedData($propInfo->Name)); |
31 } | 31 } |
32 | |
33 sub failed($;@) { | |
34 die new IMPL::Test::FailException(@_); | |
35 } | |
36 | |
37 sub cmparray { | |
38 my ($a,$b) = @_; | |
39 | |
40 return 0 unless @$a == @$b; | |
41 | |
42 for (my $i=0; $i < @$a; $i++ ) { | |
43 return 0 unless $a->[$i] eq $b->[$i]; | |
44 } | |
45 | |
46 return 1; | |
47 } | |
32 1; | 48 1; |