Mercurial > pub > Impl
comparison _test/Test/Web/TT.pm @ 77:9d24db321029
Refactoring Web::TT
docs
author | wizard |
---|---|
date | Fri, 02 Apr 2010 20:18:46 +0400 |
parents | _test/Test/Web/TDocument.pm@b0c068da93ac |
children | 4267a2ac3d46 |
comparison
equal
deleted
inserted
replaced
76:b1652a158b2b | 77:9d24db321029 |
---|---|
1 package Test::Web::TT; | |
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::TT::Document; | |
9 __PACKAGE__->PassThroughArgs; | |
10 | |
11 test Creation => sub { | |
12 my $document = new IMPL::Web::TT::Document(); | |
13 | |
14 failed "Failed to create document" unless $document; | |
15 | |
16 $document->Dispose(); | |
17 }; | |
18 | |
19 test SimpleTemplate => sub { | |
20 my $document = new IMPL::Web::TT::Document(); | |
21 | |
22 failed "Failed to create document" unless $document; | |
23 | |
24 $document->LoadFile('Resources/simple.tt','cp1251'); | |
25 | |
26 my $out = $document->Render; | |
27 | |
28 open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!"; | |
29 local $/; | |
30 my $eta = <$hFile>; | |
31 | |
32 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta; | |
33 | |
34 $document->Dispose(); | |
35 }; | |
36 | |
37 | |
38 1; |