Mercurial > pub > Impl
annotate _test/Test/Web/TT.pm @ 231:ff1e8fa932f2
sync
author | sergey |
---|---|
date | Tue, 09 Oct 2012 03:09:41 +0400 |
parents | ae8072f2f2a3 |
children |
rev | line source |
---|---|
77 | 1 package Test::Web::TT; |
49 | 2 use strict; |
3 use warnings; | |
181 | 4 use encoding 'utf8'; |
49 | 5 |
166 | 6 use parent qw(IMPL::Test::Unit); |
49 | 7 use IMPL::Test qw(test failed); |
77 | 8 use IMPL::Web::TT::Document; |
185 | 9 |
49 | 10 __PACKAGE__->PassThroughArgs; |
11 | |
12 test Creation => sub { | |
77 | 13 my $document = new IMPL::Web::TT::Document(); |
49 | 14 |
15 failed "Failed to create document" unless $document; | |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
16 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
17 $document->Dispose(); |
49 | 18 }; |
19 | |
20 test SimpleTemplate => sub { | |
77 | 21 my $document = new IMPL::Web::TT::Document(); |
49 | 22 |
23 failed "Failed to create document" unless $document; | |
24 | |
181 | 25 $document->LoadFile('Resources/simple.tt','utf8'); |
49 | 26 |
27 my $out = $document->Render; | |
28 | |
181 | 29 open my $hFile,'<:encoding(utf8)',"Resources/simple.txt" or die "Failed to open etalon file: $!"; |
49 | 30 local $/; |
31 my $eta = <$hFile>; | |
32 | |
33 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
|
34 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
35 $document->Dispose(); |
49 | 36 }; |
37 | |
38 | |
39 1; |