comparison _test/Test/Web/TT.pm @ 181:47dac58691ee

New templating system, small fixes
author sourcer
date Thu, 26 Jan 2012 01:15:57 +0400
parents 4267a2ac3d46
children ae8072f2f2a3
comparison
equal deleted inserted replaced
180:d1676be8afcc 181:47dac58691ee
1 package Test::Web::TT; 1 package Test::Web::TT;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 use encoding 'cp1251'; 4 use encoding 'utf8';
5 5
6 use parent qw(IMPL::Test::Unit); 6 use parent qw(IMPL::Test::Unit);
7 use IMPL::Test qw(test failed); 7 use IMPL::Test qw(test failed);
8 use IMPL::Web::TT::Document; 8 use IMPL::Web::TT::Document;
9 __PACKAGE__->PassThroughArgs; 9 __PACKAGE__->PassThroughArgs;
19 test SimpleTemplate => sub { 19 test SimpleTemplate => sub {
20 my $document = new IMPL::Web::TT::Document(); 20 my $document = new IMPL::Web::TT::Document();
21 21
22 failed "Failed to create document" unless $document; 22 failed "Failed to create document" unless $document;
23 23
24 $document->LoadFile('Resources/simple.tt','cp1251'); 24 $document->LoadFile('Resources/simple.tt','utf8');
25 25
26 my $out = $document->Render; 26 my $out = $document->Render;
27 27
28 open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!"; 28 open my $hFile,'<:encoding(utf8)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
29 local $/; 29 local $/;
30 my $eta = <$hFile>; 30 my $eta = <$hFile>;
31 31
32 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta; 32 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta;
33 33