comparison Lib/IMPL/Test/Plan.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 4267a2ac3d46
children
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
73 73
74 $info{Unit} = $Unit; 74 $info{Unit} = $Unit;
75 try { 75 try {
76 $info{Tests} = [$Unit->List]; 76 $info{Tests} = [$Unit->List];
77 } otherwise { 77 } otherwise {
78 my $err = $@; 78 my $err = $@;
79 $Unit = $info{Unit} = new IMPL::Test::BadUnit( 79 $Unit = $info{Unit} = new IMPL::Test::BadUnit(
80 $Unit->can('UnitName') ? 80 $Unit->can('UnitName') ?
81 $Unit->UnitName : 81 $Unit->UnitName :
82 $Unit, 82 $Unit,
83 "Failed to extract tests", 83 "Failed to extract tests",
84 $err 84 $err
85 ); 85 );
86 $info{Tests} = [$Unit->List]; 86 $info{Tests} = [$Unit->List];
87 }; 87 };
88 $count += @{$info{Tests}}; 88 $count += @{$info{Tests}};
89 push @cache, \%info if @{$info{Tests}}; 89 push @cache, \%info if @{$info{Tests}};
90 } 90 }
117 }; 117 };
118 118
119 my @results; 119 my @results;
120 120
121 if (not $@) { 121 if (not $@) {
122 122
123 foreach my $test (@{$info->{Tests}}) { 123 foreach my $test (@{$info->{Tests}}) {
124 my $name = $test->Name; 124 my $name = $test->Name;
125 125
126 #protected creation of the test 126 #protected creation of the test
127 $test = eval { $info->{Unit}->new($test); } || new IMPL::Test::BadUnit( 127 $test = eval { $info->{Unit}->new($test); } || new IMPL::Test::BadUnit(
128 $info->{Unit}->can('UnitName') ? 128 $info->{Unit}->can('UnitName') ?
129 $info->{Unit}->UnitName : 129 $info->{Unit}->UnitName :
130 $info->{Unit}, 130 $info->{Unit},
131 "Failed to construct the test $name", 131 "Failed to construct the test $name",
132 $@ 132 $@
133 ); 133 );
134 134
135 # invoke the test 135 # invoke the test
136 $this->_Tell(RunTest => $test); 136 $this->_Tell(RunTest => $test);
137 my $result = $test->Run($data); 137 my $result = $test->Run($data);
138 $this->_Tell(EndTest => $test,$result); 138 $this->_Tell(EndTest => $test,$result);
139 139
140 push @results,$result; 140 push @results,$result;
141 } 141 }
142 } else { 142 } else {
143 my $e = $@; 143 my $e = $@;
144 my $badTest = new IMPL::Test::BadUnit( 144 my $badTest = new IMPL::Test::BadUnit(
145 $info->{Unit}->can('UnitName') ? 145 $info->{Unit}->can('UnitName') ?
146 $info->{Unit}->UnitName : 146 $info->{Unit}->UnitName :
147 $info->{Unit}, 147 $info->{Unit},
148 "Failed to initialize the unit", 148 "Failed to initialize the unit",
149 $@ 149 $@
150 ); 150 );
151 foreach my $test (@{$info->{Tests}}) { 151 foreach my $test (@{$info->{Tests}}) {
152 152
153 $this->_Tell(RunTest => $badTest); 153 $this->_Tell(RunTest => $badTest);
154 my $result = new IMPL::Test::Result( 154 my $result = new IMPL::Test::Result(
155 Name => $test->Name, 155 Name => $test->Name,
156 State => IMPL::Test::Result::FAIL, 156 State => IMPL::Test::Result::FAIL,
157 Exception => $e 157 Exception => $e