Mercurial > pub > Impl
annotate _test/Test/Web/TT.pm @ 170:b88b7fe60aa3
refactoring
author | sourcer |
---|---|
date | Tue, 24 May 2011 01:11:16 +0400 |
parents | 4267a2ac3d46 |
children | 47dac58691ee |
rev | line source |
---|---|
77 | 1 package Test::Web::TT; |
49 | 2 use strict; |
3 use warnings; | |
4 use encoding 'cp1251'; | |
5 | |
166 | 6 use parent qw(IMPL::Test::Unit); |
49 | 7 use IMPL::Test qw(test failed); |
77 | 8 use IMPL::Web::TT::Document; |
49 | 9 __PACKAGE__->PassThroughArgs; |
10 | |
11 test Creation => sub { | |
77 | 12 my $document = new IMPL::Web::TT::Document(); |
49 | 13 |
14 failed "Failed to create document" unless $document; | |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
15 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
16 $document->Dispose(); |
49 | 17 }; |
18 | |
19 test SimpleTemplate => sub { | |
77 | 20 my $document = new IMPL::Web::TT::Document(); |
49 | 21 |
22 failed "Failed to create document" unless $document; | |
23 | |
77 | 24 $document->LoadFile('Resources/simple.tt','cp1251'); |
49 | 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; | |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
33 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
34 $document->Dispose(); |
49 | 35 }; |
36 | |
37 | |
38 1; |