File: meta.t

package info (click to toggle)
libtemplate-perl 3.102-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,680 kB
  • sloc: perl: 14,945; makefile: 11; sh: 5
file content (37 lines) | stat: -rw-r--r-- 881 bytes parent folder | download
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
#============================================================= -*-perl-*-
#
# t/meta.t
#
# Test the meta() method in Template::Document.
#
# Written by Andy Wardley <abw@wardley.org>
#
# Copyright (C) 2022 Andy Wardley.  All Rights Reserved.
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#========================================================================

use strict;
use lib qw( ./lib ../lib );
use Template;
use Template::Test;

$^W = 1;

my $tt = Template->new || die Template->error;
my $template = $tt->template(\*DATA);
my $meta = $template->meta;

is( $meta->{ author }, 'Andy Wardley', 'fetched META author' );
is( $meta->{ animal }, 'Badger', 'fetched META animal' );
is( scalar(keys %$meta), 2, 'two items in meta' );


__END__
[% META
    author = 'Andy Wardley'
    animal = 'Badger'
%]
Hello world!