forked from bestpractical/template-declare
/
tag_sub_list.t
50 lines (38 loc) · 1.23 KB
/
tag_sub_list.t
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
42
43
44
45
46
47
48
49
#use Smart::Comments;
use strict;
use warnings;
use Test::More tests => 8;
{
package Foo;
use List::Util 'first';
use Template::Declare::Tags 'HTML';
my @list = @Template::Declare::Tags::TAG_SUB_LIST;
### @list
my $tag = first { $_ eq 'table' } @list;
::is $tag, 'table', 'table {...} found';
$tag = first { $_ eq 'li' } @list;
::is $tag, 'li', 'li {...} found';
# Backward compatibility:
@list = @Template::Declare::Tags::TagSubs;
### @list
$tag = first { $_ eq 'table' } @list;
::is $tag, 'table', 'table {...} found';
$tag = first { $_ eq 'li' } @list;
::is $tag, 'li', 'li {...} found';
}
{
package Bar;
use List::Util 'first';
use Template::Declare::Tags 'XUL';
my @list = @Template::Declare::Tags::TAG_SUB_LIST;
my $tag = first { $_ eq 'div' } @list;
::is $tag, 'div', 'HTML tag div {...} also found';
$tag = first { $_ eq 'tabbox' } @list;
::is $tag, 'tabbox', 'tabbox {...} found';
# Backward compatibility:
@list = @Template::Declare::Tags::TagSubs;
$tag = first { $_ eq 'div' } @list;
::is $tag, 'div', 'HTML tag div {...} also found';
$tag = first { $_ eq 'tabbox' } @list;
::is $tag, 'tabbox', 'tabbox {...} found';
}