@podlite/to-jsx 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 9;
4
- my $r;
5
-
6
- sub norm_crlf($str) {
7
- $str.subst("\r\n", "\n", :g)
8
- }
9
-
10
- #---
11
- =begin pod
12
- =for comment
13
- foo foo
14
- bla bla bla
15
-
16
- This isn't a comment
17
- =end pod
18
- #---
19
-
20
- $r = $=pod[0];
21
- isa-ok $r.contents[0], Pod::Block::Comment;
22
- is $r.contents[0].contents.elems, 1;
23
- is norm_crlf($r.contents[0].contents), "foo foo\nbla bla bla\n";
24
-
25
- # from S26
26
- #---
27
- =comment
28
- This file is deliberately specified in Raku Pod format
29
- #---
30
-
31
- $r = $=pod[1];
32
- isa-ok $r, Pod::Block::Comment;
33
- is $r.contents.elems, 1, 'one-line comment: number of elements';;
34
- is norm_crlf($r.contents[0]),
35
- "This file is deliberately specified in Raku Pod format\n",
36
- 'one-line comment: contents';
37
-
38
- # this happens to break hilighting in some editors,
39
- # so I put it at the end
40
- #---
41
- =begin comment
42
- foo foo
43
- =begin invalid pod
44
- =as many invalid pod as we want
45
- ===yay!
46
- =end comment
47
- #---
48
-
49
- $r = $=pod[2];
50
- isa-ok $r, Pod::Block;
51
- is $r.contents.elems, 1;
52
- is norm_crlf($r.contents[0]), "foo foo\n=begin invalid pod\n"
53
- ~ "=as many invalid pod as we want\n===yay!\n";
@@ -1,113 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 39;
4
- my $r;
5
-
6
- #---
7
- =begin pod
8
- The seven suspects are:
9
-
10
- =item Happy
11
- =item Dopey
12
- =item Sleepy
13
- =item Bashful
14
- =item Sneezy
15
- =item Grumpy
16
- =item Keyser Soze
17
- =end pod
18
- #---
19
-
20
- $r = $=pod[0];
21
- is $r.contents.elems, 8;
22
- for 1..7 {
23
- isa-ok $r.contents[$_], Pod::Item;
24
- }
25
-
26
- is $r.contents[1].contents[0].contents, 'Happy', 'contents is happy :)';
27
- is $r.contents[2].contents[0].contents, 'Dopey';
28
- is $r.contents[7].contents[0].contents, 'Keyser Soze';
29
- ok $r.contents[4].level.defined, '=item is an abbreviation of =item1';
30
-
31
- #---
32
- =begin pod
33
- =item1 Animal
34
- =item2 Vertebrate
35
- =item2 Invertebrate
36
-
37
- =item1 Phase
38
- =item2 Solid
39
- =item2 Liquid
40
- =item2 Gas
41
- =item2 Chocolate
42
- =end pod
43
- #---
44
-
45
- $r = $=pod[1];
46
- is $r.contents.elems, 8;
47
- for 0..7 {
48
- isa-ok $r.contents[$_], Pod::Item;
49
- }
50
-
51
- is $r.contents[0].contents[0].contents, 'Animal';
52
- is $r.contents[0].level, 1;
53
- is $r.contents[2].contents[0].contents, 'Invertebrate';
54
- is $r.contents[2].level, 2;
55
- is $r.contents[3].contents[0].contents, 'Phase';
56
- is $r.contents[3].level, 1;
57
- is $r.contents[4].contents[0].contents, 'Solid';
58
- is $r.contents[4].level, 2;
59
-
60
- #---
61
- =begin pod
62
- =comment CORRECT...
63
- =begin item1
64
- The choices are:
65
- =end item1
66
- =item2 Liberty
67
- =item2 Death
68
- =item2 Beer
69
- =end pod
70
- #---
71
-
72
- $r = $=pod[2];
73
- is $r.contents.elems, 5;
74
- for 1..4 {
75
- isa-ok $r.contents[$_], Pod::Item;
76
- }
77
-
78
- # XXX Those items are :numbered in S26, but we're waiting with block
79
- # configuration until we're inside Rakudo, otherwise we'll have to
80
- # pretty much implement Pair parsing in gsocmess only to get rid of
81
- # it later.
82
-
83
- #---
84
- =begin pod
85
- Let's consider two common proverbs:
86
-
87
- =begin item
88
- I<The rain in Spain falls mainly on the plain.>
89
-
90
- This is a common myth and an unconscionable slur on the Spanish
91
- people, the majority of whom are extremely attractive.
92
- =end item
93
-
94
- =begin item
95
- I<The early bird gets the worm.>
96
-
97
- In deciding whether to become an early riser, it is worth
98
- considering whether you would actually enjoy annelids
99
- for breakfast.
100
- =end item
101
-
102
- As you can see, folk wisdom is often of dubious value.
103
- =end pod
104
- #---
105
-
106
- $r = $=pod[3];
107
- is $r.contents.elems, 4;
108
- is $r.contents[0].contents, "Let's consider two common proverbs:";
109
- ok $r.contents[1].contents[1].contents
110
- ~~ /:s This is a common .+ are extremely attractive/;
111
- ok $r.contents[2].contents[1].contents
112
- ~~ /:s In deciding .+ annelids for breakfast/;
113
- is $r.contents[3].contents, "As you can see, folk wisdom is often of dubious value.";
@@ -1,153 +0,0 @@
1
- use v6;
2
- use Test;
3
- my $r;
4
- my $p = 0; # use as an index for the pod chunks
5
-
6
- plan 37;
7
-
8
- #---
9
- =begin table
10
- The Shoveller Eddie Stevens King Arthur's singing shovel
11
- Blue Raja Geoffrey Smith Master of cutlery
12
- Mr Furious Roy Orson Ticking time bomb of fury
13
- The Bowler Carol Pinnsler Haunted bowling ball
14
- =end table
15
- #---
16
-
17
- $r = $=pod[$p++];
18
- isa-ok $r, Pod::Block::Table;
19
- is $r.contents.elems, 4;
20
- is $r.contents[0].join('|'),
21
- "The Shoveller|Eddie Stevens|King Arthur's singing shovel";
22
- is $r.contents[1].join('|'),
23
- "Blue Raja|Geoffrey Smith|Master of cutlery";
24
- is $r.contents[2].join('|'),
25
- "Mr Furious|Roy Orson|Ticking time bomb of fury";
26
- is $r.contents[3].join('|'),
27
- "The Bowler|Carol Pinnsler|Haunted bowling ball";
28
-
29
- #---
30
- =table
31
- Constants 1
32
- Variables 10
33
- Subroutines 33
34
- Everything else 57
35
- #---
36
-
37
- $r = $=pod[$p++];
38
- is $r.contents.elems, 4;
39
- is $r.contents[0].join('|'), "Constants|1";
40
- is $r.contents[1].join('|'), "Variables|10";
41
- is $r.contents[2].join('|'), "Subroutines|33";
42
- is $r.contents[3].join('|'), "Everything else|57";
43
-
44
- #---
45
- =for table
46
- mouse | mice
47
- horse | horses
48
- elephant | elephants
49
- #---
50
-
51
- $r = $=pod[$p++];
52
- is $r.contents.elems, 3;
53
- is $r.contents[0].join('|'), "mouse|mice";
54
- is $r.contents[1].join('|'), "horse|horses";
55
- is $r.contents[2].join('|'), "elephant|elephants";
56
-
57
- #---
58
- =table
59
- Animal | Legs | Eats
60
- =======================
61
- Zebra + 4 + Cookies
62
- Human + 2 + Pizza
63
- Shark + 0 + Fish
64
- #---
65
-
66
- $r = $=pod[$p++];
67
- is $r.headers.join('|'), "Animal|Legs|Eats";
68
- is $r.contents.elems, 3;
69
- is $r.contents[0].join('|'), "Zebra|4|Cookies";
70
- is $r.contents[1].join('|'), "Human|2|Pizza";
71
- is $r.contents[2].join('|'), "Shark|0|Fish";
72
-
73
- #---
74
- =table
75
- Superhero | Secret |
76
- | Identity | Superpower
77
- ==============|=================|================================
78
- The Shoveller | Eddie Stevens | King Arthur's singing shovel
79
- #---
80
-
81
- $r = $=pod[$p++];
82
- is $r.headers.join('|'), "Superhero|Secret Identity|Superpower";
83
- is $r.contents.elems, 1;
84
- is $r.contents[0].join('|'),
85
- "The Shoveller|Eddie Stevens|King Arthur's singing shovel";
86
-
87
- #---
88
- =begin table
89
-
90
- Secret
91
- Superhero Identity Superpower
92
- ============= =============== ===================
93
- The Shoveller Eddie Stevens King Arthur's
94
- singing shovel
95
-
96
- Blue Raja Geoffrey Smith Master of cutlery
97
-
98
- Mr Furious Roy Orson Ticking time bomb
99
- of fury
100
-
101
- The Bowler Carol Pinnsler Haunted bowling ball
102
-
103
- =end table
104
- #---
105
-
106
- $r = $=pod[$p++];
107
- is $r.headers.join('|'), "Superhero|Secret Identity|Superpower";
108
- is $r.contents.elems, 4;
109
- is $r.contents[0].join('|'),
110
- "The Shoveller|Eddie Stevens|King Arthur's singing shovel";
111
- is $r.contents[1].join('|'),
112
- "Blue Raja|Geoffrey Smith|Master of cutlery";
113
- is $r.contents[2].join('|'),
114
- "Mr Furious|Roy Orson|Ticking time bomb of fury";
115
- is $r.contents[3].join('|'),
116
- "The Bowler|Carol Pinnsler|Haunted bowling ball";
117
-
118
- #---
119
- =table
120
- X | O |
121
- ---+---+---
122
- | X | O
123
- ---+---+---
124
- | | X
125
- #---
126
-
127
- $r = $=pod[$p++];
128
- is $r.contents.elems, 3;
129
- is $r.contents[0].join(','), 'X,O,';
130
- is $r.contents[1].join(','), ',X,O';
131
- is $r.contents[2].join(','), ',,X';
132
-
133
- # test for:
134
- # RT #126740 - Pod::Block::Table node caption property is not populated properly
135
- # Note that the caption property is just one of the table's %config key/value
136
- # pairs so any tests for other config keys in a single table are usually the same as testing
137
- # multiple tables, each for one caption test.
138
-
139
- #---
140
- =begin table :caption<foo> :bar(0)
141
- = :baz(2.3)
142
-
143
- foo
144
- bar
145
-
146
- =end table
147
- #---
148
-
149
- $r = $=pod[$p++];
150
- is $r.contents.elems, 2;
151
- is $r.caption, "foo";
152
- is $r.config<bar>, "0";
153
- is $r.config<baz>, "2.3";
@@ -1,104 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 43;
4
-
5
- my $r;
6
-
7
- #---
8
- =pod
9
- B<I am a formatting code>
10
- #---
11
-
12
- $r = $=pod[0].contents[0].contents[0];
13
- isa-ok $r, Pod::FormattingCode;
14
- is $r.type, 'B';
15
- is $r.contents[0], 'I am a formatting code', 'a single FC becomes a single FC';
16
-
17
- #---
18
- =pod
19
- The basic C<ln> command is: C<ln> B<R<source_file> R<target_file>>
20
- #---
21
-
22
- $r = $=pod[1].contents[0].contents;
23
- is $r[0], 'The basic ';
24
- isa-ok $r[1], Pod::FormattingCode;
25
- is $r[1].type, 'C';
26
- is $r[1].contents, 'ln';
27
- is $r[2], ' command is: ';
28
- isa-ok $r[3], Pod::FormattingCode;
29
- is $r[3].type, 'C';
30
- is $r[3].contents, 'ln';
31
- isa-ok $r[5], Pod::FormattingCode;
32
- is $r[4], " ";
33
- is $r[5].type, 'B';
34
- $r = $r[5].contents;
35
- isa-ok $r[0], Pod::FormattingCode;
36
- is $r[0].type, 'R';
37
- is $r[0].contents, 'source_file';
38
- is $r[1], ' ';
39
- isa-ok $r[2], Pod::FormattingCode;
40
- is $r[2].type, 'R';
41
- is $r[2].contents, 'target_file';
42
-
43
- #---
44
- =pod
45
- L<C<b>|a>
46
- L<C<b>|a>
47
- #---
48
-
49
- $r = $=pod[2].contents[0].contents;
50
- for $r[0], $r[2] -> $link {
51
- is $link.type, 'L';
52
- isa-ok $link.contents[0], Pod::FormattingCode;
53
- is $link.contents[0].contents, 'b';
54
- is $link.meta, 'a';
55
- }
56
-
57
- #---
58
- =begin pod
59
-
60
- =head1 A heading
61
-
62
- This is Pod too. Specifically, this is a simple C<para> block
63
-
64
- $this = pod('also'); # Specifically, a code block
65
-
66
- =end pod
67
- #---
68
-
69
- $r = $=pod[3];
70
- is $r.contents.elems, 3;
71
- isa-ok $r.contents[0], Pod::Block;
72
- is $r.contents[0].contents[0].contents, 'A heading';
73
- is $r.contents[1].contents[0],
74
- 'This is Pod too. Specifically, this is a simple ';
75
- isa-ok $r.contents[1].contents[1], Pod::FormattingCode;
76
- is $r.contents[1].contents[1].type, 'C';
77
- is $r.contents[1].contents[1].contents, 'para';
78
- is $r.contents[1].contents[2], ' block';
79
- isa-ok $r.contents[2], Pod::Block::Code;
80
- is $r.contents[2].contents,
81
- q[$this = pod('also'); # Specifically, a code block];
82
-
83
- #---
84
- =pod V<C<boo> B<bar> asd>
85
- #---
86
-
87
- $r = $=pod[4];
88
- is $r.contents[0].contents, 'C<boo> B<bar> asd';
89
-
90
- # RT #114510
91
- =pod C< infix:<+> >
92
- =pod C<< infix:<+> >>
93
-
94
- for @$=pod[5, 6] {
95
- is .contents[0].contents[0].contents[0], "infix:<+> ", "Can parse nested angles in formatting codes"
96
- }
97
-
98
- =pod B< < B<foo> > >
99
-
100
-
101
- $r = $=pod[7];
102
- is $r.contents[0].contents[0].contents[1].contents[0], 'foo','FC inside balanced <>';
103
-
104
- # vim: ft=perl6