diff _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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_test/Test/Web/TT.pm	Fri Apr 02 20:18:46 2010 +0400
@@ -0,0 +1,38 @@
+package Test::Web::TT;
+use strict;
+use warnings;
+use encoding 'cp1251';
+
+use base qw(IMPL::Test::Unit);
+use IMPL::Test qw(test failed);
+use IMPL::Web::TT::Document;
+__PACKAGE__->PassThroughArgs;
+
+test Creation => sub {
+    my $document = new IMPL::Web::TT::Document();
+    
+    failed "Failed to create document" unless $document;
+    
+    $document->Dispose();
+};
+
+test SimpleTemplate => sub {
+    my $document = new IMPL::Web::TT::Document();
+    
+    failed "Failed to create document" unless $document;
+    
+    $document->LoadFile('Resources/simple.tt','cp1251');
+    
+    my $out = $document->Render;
+    
+    open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
+    local $/;
+    my $eta = <$hFile>;
+    
+    failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta;
+    
+    $document->Dispose();
+};
+
+
+1;