Mercurial > pub > Impl
comparison _test/Test/Web/View.pm @ 190:cd1ff7029a63
IMLP::Web::View refactored, added new method 'require' which is available inside templates. Changed document rendering.
| author | cin |
|---|---|
| date | Wed, 04 Apr 2012 17:51:27 +0400 |
| parents | 08015e2803f1 |
| children | 78a18a2b6266 |
comparison
equal
deleted
inserted
replaced
| 189:08015e2803f1 | 190:cd1ff7029a63 |
|---|---|
| 20 | 20 |
| 21 sub AssertMemoryLeak { | 21 sub AssertMemoryLeak { |
| 22 my $code = shift; | 22 my $code = shift; |
| 23 my $dump = shift; | 23 my $dump = shift; |
| 24 | 24 |
| 25 my $data = MProfiler->Monitor($code, sub { $_ =~ m/^IMPL::/} ); | 25 my $data = MProfiler->Monitor($code); |
| 26 | 26 |
| 27 if ($data->isLeak and $dump) { | 27 if ($data->isLeak and $dump) { |
| 28 write_file("dump.out", { binmode => ':utf8' }, $data->Dump() ); | 28 write_file("dump.out", { binmode => ':utf8' }, $data->Dump() ); |
| 29 } | 29 } |
| 30 | 30 |
| 106 my ($this) = @_; | 106 my ($this) = @_; |
| 107 | 107 |
| 108 my $loader = $this->CreateLoader(); | 108 my $loader = $this->CreateLoader(); |
| 109 | 109 |
| 110 my $doc = $loader->document('simple'); | 110 my $doc = $loader->document('simple'); |
| 111 $doc->templateVars(data => ['one','two','hello world']); | |
| 111 | 112 |
| 112 assert(defined $doc); | 113 assert(defined $doc); |
| 113 | 114 |
| 114 my $factory = $doc->require('My/Org/Panel'); | 115 my $factory = $doc->require('My/Org/Panel'); |
| 115 | 116 |
| 130 | 131 |
| 131 assert($factory->instances == 1); | 132 assert($factory->instances == 1); |
| 132 | 133 |
| 133 $doc->appendChild($ctl); | 134 $doc->appendChild($ctl); |
| 134 | 135 |
| 135 my $text = $ctl->Render({ data => ['one','two','hello world']}); | 136 |
| 137 | |
| 138 my $text = $ctl->Render(); | |
| 136 my $expected = read_file($this->GetResourceFile('Resources', 'TTView.Output', 'Panel.txt'), binmode => ':utf8'); | 139 my $expected = read_file($this->GetResourceFile('Resources', 'TTView.Output', 'Panel.txt'), binmode => ':utf8'); |
| 137 | 140 |
| 138 assert($text eq $expected, '$ctl->Render(): Bad output', "Got: $text", "Expected: $expected"); | 141 assert($text eq $expected, '$ctl->Render(): Bad output', "Got: $text", "Expected: $expected"); |
| 139 | 142 |
| 140 }; | 143 }; |
