-
Notifications
You must be signed in to change notification settings - Fork 134
/
pod.t
65 lines (50 loc) 路 1.8 KB
/
pod.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
use v6;
use Test;
plan 6;
# See "=begin DATA" at the end of file.
# L<S02/Double-underscore forms/filehandle, "named as" $=pod{'DATA'}>
#?rakudo skip 'postcircumfix:<{ }> not defined for type Array RT #125130'
{
ok $=pod{'DATA'}, '=begin DATA works and $=pod<DATA> defined';
my $line = get $=pod<DATA>;
is($line, "hello, world!", q/$=pod{'DATA'} can be read/);
}
# L<S02/Double-underscore forms/Pod stream as a scalar>
#?v6.0.0+ skip 'isn\'t the iterator exhausted already, since it\'s been used previously?'
{
my $line = get $=DATA;
is($line, "hello, world!", q/$=DATA contains the right string/);
}
# L<S02/Double-underscore forms/"Pod stream" "as an array" via @=DATA>
#?v6.0.0+ skip 'isn\'t the iterator exhausted already, since it\'s been used previously?'
{
is @=DATA.elems, 1, '@=DATA contains a single elem';
is @=DATA[0], "hello, world!\n", '@=DATA[0] contains the right value';
}
# The following commented-out tests are currnetly unspecified:
# others will be added later, or you can do it.
#ok EVAL('
#=begin DATA LABEL1
#LABEL1.1
#LABEL1.2
#LABEL1.3
#=end DATA
#=begin DATA LABEL2
#LABEL2.1
#LABEL2.2
#=end DATA
#'), "=begin DATA works", :todo;
#is(EVAL('%=DATA<LABEL1>[0]'), 'LABEL1.1', '@=DATA<LABEL1>[0] is correct', :todo);
#is(EVAL('%=DATA<LABEL1>[2]'), 'LABEL1.3', '@=DATA<LABEL1>[2] is correct', :todo);
#is(EVAL('~ %=DATA<LABEL1>'), 'LABEL1.1LABEL1.2LABEL1.3', '~ %=DATA<LABEL1> is correct', :todo);
#is(EVAL('~ $=LABEL2'), 'LABEL2.1LABEL2.2', '~ $=LABEL2 is correct', :todo);
#is(EVAL('$=LABEL2[1]'), 'LABEL2.2', '$=LABEL2[1] is correct', :todo);
=begin DATA
hello, world!
=end DATA
# RT #132339
is-deeply $=pod.grep(*.name eq 'SEE-ALSO').head.contents.head.contents.head,
'foo132339',
'custom named paras with `-` in identifiers works';
=SEE-ALSO foo132339
# vim: ft=perl6