annotate Lib/IMPL/Test/BadUnit.pm @ 35:f25d021780b3

DOM::Navigator::Builder working version
author Sergey
date Tue, 17 Nov 2009 17:46:24 +0300
parents d59526f6310e
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 package IMPL::Test::BadUnit;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3 use warnings;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
4
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
5 use base qw(IMPL::Test::Unit);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6 use IMPL::Class::Property;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
7
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
8 BEGIN {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
9 public property UnitName => prop_all;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
10 public property Message => prop_all;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 public property Error => prop_all;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
12 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
13
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
14 our %CTOR = (
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
15 'IMPL::Test::Unit' => sub {
31
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
16 if (@_>1) {
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
17 # Unit construction
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
18 my ($unit,$message,$error) = @_;
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
19 return new IMPL::Test::Unit::TestInfo(
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
20 BadUnitTest => sub {
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
21 die new IMPL::Test::FailException($message,$unit,eval {$error->isa('IMPL::Exception')} ? $error->toString(1) : $error)
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
22 }
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
23 );
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
24 } else {
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
25 # test construction
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
26 return @_;
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
27 }
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
28 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
29 );
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
30
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
31 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
32 my ($this,$name,$message,$error) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
33
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
34 $this->UnitName($name);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
35 $this->Message($message);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
36 $this->Error($error);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
37 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
38
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
39 sub save {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
40 my ($this,$ctx) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
41
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
42 defined ($this->$_()) and $ctx->AddVar($_ => $this->$_()) foreach qw(UnitName Message);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
43 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
44
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
45 sub restore {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
46 my ($class,$data,$inst) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
47
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
48 my %args = @$data;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
49
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
50 $inst ||= $class->surrogate;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
51 $inst->callCTOR(@args{qw(UnitName Message)});
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
52 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
53
31
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
54 sub List {
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
55 my ($this) = @_;
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
56 my $error = $this->Error;
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
57 return new IMPL::Test::Unit::TestInfo(
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
58 BadUnitTest => sub {
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
59 die new IMPL::Test::FailException($this->Message,$this->UnitName,eval {$error->isa('IMPL::Exception')} ? $error->toString(1) : $error)
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
60 }
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
61 );
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
62 }
d59526f6310e Small fixes to Test framework (correct handlinf of the compilation errors in the test units)
Sergey
parents: 0
diff changeset
63
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
64
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
65 1;