File: 15-comment.t

package info (click to toggle)
libhtml-template-perl 2.95-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 736 kB
  • ctags: 112
  • sloc: perl: 2,572; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 978 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use strict;
use warnings;
#use Test::More tests => 4;
use Test::More skip_all => 'not implemented yet';

use_ok('HTML::Template');

# normal loop with values
my $tmpl_string = 'Hello<tmpl_comment> enemy</tmpl_comment> friend';
my $template = HTML::Template->new_scalar_ref( \$tmpl_string );
$template->param( name => 'Fred');
my $output = $template->output;
is($output, 'Hello friend', 'simple comment');

# comment with a var next to it
$tmpl_string = 'Hello<tmpl_comment> enemy</tmpl_comment> friend <tmpl_var name>';
$template = HTML::Template->new_scalar_ref( \$tmpl_string );
$template->param( name => 'Fred');
$output = $template->output;
is($output, 'Hello friend Fred', 'comment with var');

# comment with a var in it
$tmpl_string = 'Hello<tmpl_comment><tmpl_var name></tmpl_comment> friend';
$template = HTML::Template->new_scalar_ref( \$tmpl_string );
$template->param( name => 'Fred');
$output = $template->output;
is($output, 'Hello friend', 'comment hiding var');