7
|
1 package Test::Web::TDocument;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4 use encoding 'cp1251';
|
|
5
|
|
6 use base qw(IMPL::Test::Unit);
|
|
7 use IMPL::Test qw(test failed);
|
|
8 use IMPL::Web::TDocument;
|
|
9 __PACKAGE__->PassThroughArgs;
|
|
10
|
|
11 test Creation => sub {
|
|
12 my $document = new IMPL::Web::TDocument();
|
|
13
|
|
14 failed "Failed to create document" unless $document;
|
|
15 };
|
|
16
|
|
17 test SimpleTemplate => sub {
|
|
18 my $document = new IMPL::Web::TDocument();
|
|
19
|
|
20 failed "Failed to create document" unless $document;
|
|
21
|
|
22 $document->loadFile('Resources/simple.tt','cp1251');
|
|
23
|
|
24 my $out = $document->Render;
|
|
25
|
|
26 open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
|
|
27 local $/;
|
|
28 my $eta = <$hFile>;
|
|
29
|
|
30 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta;
|
|
31 };
|
|
32
|
|
33
|
|
34 1;
|