- Notifications
You must be signed in to change notification settings - Fork 135
/
Copy path14-defn.t
91 lines (73 loc) · 1.89 KB
/
14-defn.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
useTest;
plan30;
my$o;
my$o1;
my$p=-1;
#=== valid ways to write a =defn block:
# delimited, uses %config
=begindefn :numbered
B<term 1>
B<def 1>
=enddefn
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
ok$o.config<numbered>:exists;
is$o.term, 'B<term 1>';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'B<def 1>';
# abbreviated, no %config, uses data on first line for term
=defnterm 2
def 2 line1
def 2 line2
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
is$o.term, 'term 2';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'def 2 line1 def 2 line2';
# abbreviated, no %config, uses data on first line for term
# hash on first line is alias for %config ':numbered'
=defn# term 3
def 3 line1
def 3 line2
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
ok$o.config<numbered>:exists;
is$o.term, 'term 3';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'def 3 line1 def 3 line2';
# paragraph, uses %config
=for defn
term 4
def 4 line1
def 4 line2
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
is$o.term, 'term 4';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'def 4 line1 def 4 line2';
# paragraph, uses %config
=for defn :numbered(0)
term 5
def 5 line1
def 5 line2
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
is$o.config<numbered>, 0;
is$o.term, 'term 5';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'def 5 line1 def 5 line2';
# delimited, uses %config, multiple paragraphs
=begindefn :numbered
term 6
def 6 line 1
def 6 line 2 after blank line
=enddefn
$o=$=pod[++$p];
isa-ok$o, 'Pod::Defn';
is$o.config<numbered>, True;
is$o.term, 'term 6';
isa-ok$o.contents[0], 'Pod::Block::Para';
is$o.contents[0].contents[0], 'def 6 line 1';
isa-ok$o.contents[1], 'Pod::Block::Para';
is$o.contents[1].contents[0], 'def 6 line 2 after blank line';
# vim: expandtab shiftwidth=4