Mercurial > pub > Impl
diff Lib/IMPL/Test.pm @ 285:546957c50a36
*IMPL::Web::Handler::TTView Reworked template selection mechanism
*IMPL::Web::Application: refactoring
-Removed obsolete IMPL::Text modules
author | cin |
---|---|
date | Mon, 18 Feb 2013 02:55:59 +0400 |
parents | 4ddb27ff4a0b |
children |
line wrap: on
line diff
--- a/Lib/IMPL/Test.pm Thu Feb 14 19:14:02 2013 +0400 +++ b/Lib/IMPL/Test.pm Mon Feb 18 02:55:59 2013 +0400 @@ -2,12 +2,13 @@ use strict; use warnings; +use IMPL::lang qw(equals_s); use IMPL::Const qw(:access); require IMPL::Test::SkipException; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(&test &shared &failed &cmparray &skip &run_plan &assert &GetCallerSourceLine); +our @EXPORT_OK = qw(&test &shared &failed &cmparray &skip &run_plan &assert &assertarray &GetCallerSourceLine); require IMPL::Test::Unit; require IMPL::Test::Plan; @@ -54,12 +55,26 @@ return 0 unless @$a == @$b; for (my $i=0; $i < @$a; $i++ ) { - return 0 unless $a->[$i] eq $b->[$i]; + return 0 unless + equals_s($a->[$i], $b->[$i]); } return 1; } +sub assertarray { + my ($a,$b) = @_; + + + die IMPL::Test::FailException->new( + "Assert arrays failed", + _GetSourceLine( (caller)[1,2] ), + join(', ', map defined($_) ? $_ : '<undef>', @$a), + join(', ', map defined($_) ? $_ : '<undef>', @$b) + ) + unless cmparray($a,$b); +} + sub _GetSourceLine { my ($file,$line) = @_;