view _test/Test/Web/TDocument.pm @ 63:76b878ad6596

Added serialization support for the IMPL::Object::List More intelligent Exception message Fixed encoding support in the actions Improoved tests Minor fixes
author wizard
date Mon, 15 Mar 2010 02:38:09 +0300
parents b0c068da93ac
children
line wrap: on
line source

package Test::Web::TDocument;
use strict;
use warnings;
use encoding 'cp1251';

use base qw(IMPL::Test::Unit);
use IMPL::Test qw(test failed);
use IMPL::Web::TDocument;
__PACKAGE__->PassThroughArgs;

test Creation => sub {
    my $document = new IMPL::Web::TDocument();
    
    failed "Failed to create document" unless $document;
    
    $document->Dispose();
};

test SimpleTemplate => sub {
    my $document = new IMPL::Web::TDocument();
    
    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;