File: 92-template_path-cache.t

package info (click to toggle)
libtext-micromason-perl 2.13-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 624 kB
  • ctags: 180
  • sloc: perl: 3,222; makefile: 23
file content (33 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/perl -w
use strict;
use Test::More tests => 9;

use_ok 'Text::MicroMason';

# Test TemplatePath with CompileCache

######################################################################
#
# Compile and cache test-relative.msn with one path. Executing it again
# with a different path should get us different results.

my $m1 = Text::MicroMason->new( -CompileCache,
                                -TemplatePath, template_path => [ qw(samples/subdir/ samples/) ]);
PATH1: {
    ok (my $scr_hello = $m1->execute( file => 'test-relative.msn', name => 'Dave'));
    ok (my $res_hello = "Test greeting:\nGuten Tag, Dave!\n");
    like ($scr_hello, qr/\Q$res_hello\E/);
    like ($m1->execute(text => $scr_hello), qr/\Q$res_hello\E/);
}

my $m2 = Text::MicroMason->new( -CompileCache,
                                -TemplatePath, template_path => [ qw(samples/ samples/subdir/) ]);

PATH2: {
    ok (my $scr_hello = $m2->execute( file => 'test-relative.msn', name => 'Dave'));
    ok (my $res_hello = "Test greeting:\nGood afternoon, Dave!\n");
    like ($scr_hello, qr/\Q$res_hello\E/);
    like ($m2->execute(text => $scr_hello), qr/\Q$res_hello\E/);
}