annotate _test/Test/Web/TT.pm @ 211:2b9b55cfb79b

Completed IMPL::Web::AutoLocator, added tests
author cin
date Tue, 05 Jun 2012 07:45:21 +0400
parents ae8072f2f2a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77
9d24db321029 Refactoring Web::TT
wizard
parents: 60
diff changeset
1 package Test::Web::TT;
49
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;
181
47dac58691ee New templating system, small fixes
sourcer
parents: 166
diff changeset
4 use encoding 'utf8';
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
5
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 77
diff changeset
6 use parent qw(IMPL::Test::Unit);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
7 use IMPL::Test qw(test failed);
77
9d24db321029 Refactoring Web::TT
wizard
parents: 60
diff changeset
8 use IMPL::Web::TT::Document;
185
ae8072f2f2a3 IMPL::Web::View::TTDocument tests, fixes
cin
parents: 181
diff changeset
9
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
10 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
11
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
12 test Creation => sub {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 60
diff changeset
13 my $document = new IMPL::Web::TT::Document();
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
18 };
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 test SimpleTemplate => sub {
77
9d24db321029 Refactoring Web::TT
wizard
parents: 60
diff changeset
21 my $document = new IMPL::Web::TT::Document();
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
23 failed "Failed to create document" unless $document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
24
181
47dac58691ee New templating system, small fixes
sourcer
parents: 166
diff changeset
25 $document->LoadFile('Resources/simple.tt','utf8');
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
27 my $out = $document->Render;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
28
181
47dac58691ee New templating system, small fixes
sourcer
parents: 166
diff changeset
29 open my $hFile,'<:encoding(utf8)',"Resources/simple.txt" or die "Failed to open etalon file: $!";
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
30 local $/;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
31 my $eta = <$hFile>;
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 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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
36 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
37
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 7
diff changeset
39 1;