File: tags.t

package info (click to toggle)
libtemplate-multilingual-perl 1.00-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 80 kB
  • ctags: 9
  • sloc: perl: 252; makefile: 15
file content (34 lines) | stat: -rw-r--r-- 804 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
28
29
30
31
32
33
34
#!perl -w

use strict;

my %test = (
    in  => '<t><fr>foo</fr></t>',
    out => 'foo',
    sections => [ { lang => { fr => 'foo' } } ],
);
use Test::More tests => 9;

require_ok('Template::Multilingual');
my $template = Template::Multilingual->new(
  TAG_STYLE => 'star',
);
ok($template);

$template->language('fr');
my $output;
ok($template->process(\$test{in}, {}, \$output), 'process');
is($output, $test{out}, 'output');
is_deeply($template->{PARSER}->sections, $test{sections}, 'sections');


$template = Template::Multilingual->new(
    START_TAG => quotemeta('<+'),
    END_TAG   => quotemeta('+>'),
);
ok($template);
ok($template->process(\$test{in}, {}, \$output), 'process');
is($output, $test{out}, 'output');
is_deeply($template->{PARSER}->sections, $test{sections}, 'sections');

__END__