File: 07-tsay.t

package info (click to toggle)
libscriptalicious-perl 1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 180 kB
  • ctags: 70
  • sloc: perl: 1,150; makefile: 16
file content (41 lines) | stat: -rw-r--r-- 981 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
32
33
34
35
36
37
38
39
40
41
#  -*- perl -*-

use strict;
use warnings;

use Test::More tests => 2;

use Scriptalicious;

$ENV{PERL5LIB} = join ":", "lib", split ":", ($ENV{PERL5LIB} || "");

SKIP: {
    eval 'use Template';
    if ( $@ ) {
	skip "Template not installed", 1;
    }

    my $output = capture($^X, "t/tsay.pl");
    is($output, "Hello, Bernie
tsay.pl: Yo momma's so fat your family portrait has stretchmarks.", "Template say");
}

$ENV{PERL5LIB} = join ":", "t/missing", split ":", ($ENV{PERL5LIB} || "");
delete $ENV{PERL5OPT};

my $output = capture($^X, "t/tsay.pl");
my $expected = <<'EOM';
tsay.pl: warning: failed to include YAML; not able to load config
tsay.pl: warning: install Template Toolkit for prettier messages
tsay.pl: ----- Template `hello' -----
Hello, [% name %]
[% INCLUDE yomomma -%]
tsay.pl: ------ Template variables ------
$x = {
       'name' => 'Bernie'
     };
tsay.pl: -------- end of message --------
EOM
chomp($expected);

is($output, $expected, "no Template say");