annotate _test/Test/Web/TDocument.pm @ 54:f4e045e47770

commit
author wizard@linux-odin.local
date Tue, 02 Mar 2010 20:15:57 +0300
parents 16ada169ca75
children b0c068da93ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
1 package Test::Web::TDocument;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
4 use encoding 'cp1251';
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
5
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
6 use base qw(IMPL::Test::Unit);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
7 use IMPL::Test qw(test failed);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
8 use IMPL::Web::TDocument;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
9 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
11 test Creation => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
12 my $document = new IMPL::Web::TDocument();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
13
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
14 failed "Failed to create document" unless $document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
15 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
16
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
17 test SimpleTemplate => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
18 my $document = new IMPL::Web::TDocument();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
20 failed "Failed to create document" unless $document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
21
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
22 $document->loadFile('Resources/simple.tt','cp1251');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
23
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
24 my $out = $document->Render;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
25
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
26 open my $hFile,'<:encoding(cp1251)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
27 local $/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
28 my $eta = <$hFile>;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
29
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
30 failed "Rendered data doesn't match the etalon data","Expected:\n$eta","Actual:\n$out" if $out ne $eta;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
31 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
32
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
34 1;