File: 15-same_name.t

package info (click to toggle)
libtemplate-provider-fromdata-perl 0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 164 kB
  • ctags: 105
  • sloc: perl: 1,171; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (5)
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
use Test::More tests => 6;

use strict;
use warnings;

use lib 't/lib';

use_ok( 'Template' );
use_ok( 'Template::Provider::FromDATA' );

my $provider = Template::Provider::FromDATA->new( {
    CLASSES => [ 'My::Templates', 'My::Other::Templates' ]
} );
isa_ok( $provider, 'Template::Provider::FromDATA' );

my $template = Template->new( {
    LOAD_TEMPLATES => [ $provider ],
} );
isa_ok( $template, 'Template' );

{ # non-qualified
    my $output;
    $template->process( 'test', {}, \$output );
    is( $output, "template data\n" );
}

{ # qualified
    my $output;
    $template->process( 'My-Other-Templates/test', {}, \$output );
    is( $output, "other template data\n" );
}