# HG changeset patch # User wizard # Date 1271176076 -14400 # Node ID 74bae30eb25e4a5df35e860bbeaf74ba1b0a3c09 # Parent 3a4205e7b66336654245eff1c32bcc0bdd41a2ca (no commit message) diff -r 3a4205e7b663 -r 74bae30eb25e Lib/IMPL/Test/Plan.pm --- a/Lib/IMPL/Test/Plan.pm Thu Apr 08 13:15:31 2010 +0400 +++ b/Lib/IMPL/Test/Plan.pm Tue Apr 13 20:27:56 2010 +0400 @@ -73,9 +73,17 @@ $info{Unit} = $Unit; try { - $info{Tests} = [map $Unit->new($_), $Unit->List]; + $info{Tests} = [$Unit->List]; } otherwise { - $info{Tests} = [$info{Unit} = new IMPL::Test::BadUnit($Unit->can('UnitName') ? $Unit->UnitName : $Unit,"Failed to extract tests",$@)]; + my $err = $@; + $Unit = $info{Unit} = new IMPL::Test::BadUnit( + $Unit->can('UnitName') ? + $Unit->UnitName : + $Unit, + "Failed to extract tests", + $err + ); + $info{Tests} = [$Unit->List]; }; $count += @{$info{Tests}}; push @cache, \%info if @{$info{Tests}}; @@ -107,26 +115,48 @@ eval { $data = $info->{Unit}->StartUnit; }; - + my @results; if (not $@) { + foreach my $test (@{$info->{Tests}}) { + my $name = $test->Name; + + #protected creation of the test + $test = eval { $info->{Unit}->new($test); } || new IMPL::Test::BadUnit( + $info->{Unit}->can('UnitName') ? + $info->{Unit}->UnitName : + $info->{Unit}, + "Failed to construct the test $name", + $@ + ); + + # invoke the test $this->_Tell(RunTest => $test); my $result = $test->Run($data); $this->_Tell(EndTest => $test,$result); + push @results,$result; } } else { my $e = $@; + my $badTest = new IMPL::Test::BadUnit( + $info->{Unit}->can('UnitName') ? + $info->{Unit}->UnitName : + $info->{Unit}, + "Failed to initialize the unit", + $@ + ); foreach my $test (@{$info->{Tests}}) { - $this->_Tell(RunTest => $test); + + $this->_Tell(RunTest => $badTest); my $result = new IMPL::Test::Result( Name => $test->Name, State => IMPL::Test::Result::FAIL, Exception => $e ); - $this->_Tell(EndTest => $test,$result); + $this->_Tell(EndTest => $badTest,$result); push @results,$result; } } diff -r 3a4205e7b663 -r 74bae30eb25e Lib/IMPL/Test/Unit.pm --- a/Lib/IMPL/Test/Unit.pm Thu Apr 08 13:15:31 2010 +0400 +++ b/Lib/IMPL/Test/Unit.pm Tue Apr 13 20:27:56 2010 +0400 @@ -8,6 +8,7 @@ use Time::HiRes qw(gettimeofday tv_interval); use Error qw(:try); +use Carp qw(carp); use IMPL::Test::Result; use IMPL::Test::FailException; use IMPL::Exception; diff -r 3a4205e7b663 -r 74bae30eb25e Lib/IMPL/Web/Security.pm --- a/Lib/IMPL/Web/Security.pm Thu Apr 08 13:15:31 2010 +0400 +++ b/Lib/IMPL/Web/Security.pm Tue Apr 13 20:27:56 2010 +0400 @@ -42,7 +42,7 @@ sub MakeContext { my ($this,$principal,$roles,$auth) = @_; - return $this->sourceSession->insert( + return $this->sourceSession->create( { principal => $principal, rolesAssigned => $roles, diff -r 3a4205e7b663 -r 74bae30eb25e _test/temp.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/_test/temp.pl Tue Apr 13 20:27:56 2010 +0400 @@ -0,0 +1,7 @@ +#!/usr/bin/perl + +my @data = (1,2,3); + +$data[4] = 4; + +print @data; \ No newline at end of file