annotate _test/Test/Web/TDocument.pm @ 31:d59526f6310e

Small fixes to Test framework (correct handlinf of the compilation errors in the test units) Imported and refactored SQL DB schema from the old project
author Sergey
date Mon, 09 Nov 2009 01:39:16 +0300
parents 94d47b388442
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
1 package Test::Web::TDocument;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
2 use strict;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
3 use warnings;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
4 use encoding 'cp1251';
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
5
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
6 use base qw(IMPL::Test::Unit);
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
7 use IMPL::Test qw(test failed);
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
8 use IMPL::Web::TDocument;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
9 __PACKAGE__->PassThroughArgs;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
10
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
11 test Creation => sub {
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
12 my $document = new IMPL::Web::TDocument();
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
13
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
14 failed "Failed to create document" unless $document;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
15 };
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
16
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
17 test SimpleTemplate => sub {
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
18 my $document = new IMPL::Web::TDocument();
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
19
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
20 failed "Failed to create document" unless $document;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
21
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
22 $document->loadFile('Resources/simple.tt','cp1251');
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
23
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
24 my $out = $document->Render;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
25
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
26 open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
27 local $/;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
28 my $eta = <$hFile>;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
29
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
30 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta;
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
31 };
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
32
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
33
94d47b388442 Улучшены тесты
Sergey
parents:
diff changeset
34 1;