File: 097_cache_only.t

package info (click to toggle)
libpetal-perl 2.19-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,076 kB
  • ctags: 166
  • sloc: perl: 4,732; xml: 726; makefile: 43
file content (38 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (7)
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
35
36
37
38
#!/usr/bin/perl
##############################################################################
# Tests the 'language' option (and 'lang' alias) to Petal->new.
# Uses t/data/language/*
#

# this is identical to t/052_Opt_language but with DISK_CACHE=1

use Test::More 'no_plan';

use warnings;
use lib 'lib';

use Petal;

$Petal::MEMORY_CACHE = 1;
$Petal::DISK_CACHE = 0;
$Petal::CACHE_ONLY = 1;

my $data_dir = 't/data';

my $file     = 'cookbook.html';
my $template = new Petal (file => $file, base_dir => $data_dir);
ok (eval {$template->process()}, 'process() CACHE_ONLY=1 without args should succeed');

$Petal::CACHE_ONLY = 0;
$Petal::MEMORY_CACHE = 0;

$file          = 'children.xml';
my $template_A = new Petal (file => $file, base_dir => $data_dir);
ok (!eval {$template_A->process()}, 'process() without args should fail');

$Petal::MEMORY_CACHE = 1;

$file          = 'children.xml';
my $template_B = new Petal (file => $file, base_dir => $data_dir, cache_only => 1);
ok (eval {$template_B->process()}, 'process() cache_only=1 without args should succeed');