@podlite/to-jsx 0.0.18 → 0.0.20

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,184 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 40;
4
- my $r;
5
-
6
- #---
7
- =begin foo
8
- =end foo
9
- #---
10
-
11
- $r = $=pod[0];
12
- isa-ok $r, Pod::Block, 'returns a Pod Block';
13
- isa-ok $r, Pod::Block::Named, 'returns a named Block';
14
- is $r.name, 'foo', 'name is ok';
15
- is $r.contents, [], 'no contents, all right';
16
-
17
- #---
18
- =begin foo
19
- some text
20
- =end foo
21
- #---
22
-
23
- $r = $=pod[1];
24
- isa-ok $r.contents[0], Pod::Block::Para;
25
- is $r.contents[0].contents, "some text", 'the contents are all right';
26
- is $r.name, 'foo', 'name is ok';
27
-
28
- #---
29
- =begin foo
30
- some
31
- spaced text
32
- =end foo
33
- #---
34
-
35
- $r = $=pod[2];
36
- is $r.name, 'foo', 'name is ok';
37
- is $r.contents[0].contents,
38
- "some spaced text", 'additional whitespace removed from the contents';
39
-
40
- #---
41
- =begin foo
42
- paragraph one
43
-
44
- paragraph
45
- two
46
- =end foo
47
- #---
48
- $r = $=pod[3];
49
- is $r.name, 'foo', 'name is ok';
50
- isa-ok $r.contents[0], Pod::Block::Para;
51
- isa-ok $r.contents[1], Pod::Block::Para;
52
- is $r.contents[0].contents, "paragraph one", 'paragraphs ok, 1/2';
53
- is $r.contents[1].contents, "paragraph two", 'paragraphs ok, 2/2';
54
-
55
- #---
56
- =begin something
57
- =begin somethingelse
58
- toot tooot!
59
- =end somethingelse
60
- =end something
61
- #---
62
-
63
- $r = $=pod[4];
64
- is $r.name, 'something', 'parent name ok';
65
- isa-ok $r.contents[0], Pod::Block, "nested blocks work";
66
- isa-ok $r.contents[0].contents[0], Pod::Block::Para, "nested blocks work";
67
- is $r.contents[0].contents[0].contents, "toot tooot!", "and their contents";
68
- is $r.contents[0].name, 'somethingelse', 'child name ok';
69
-
70
- # Albi
71
- #---
72
- =begin foo
73
- and so, all of the villages chased
74
- Albi, The Racist Dragon, into the
75
- very cold and very scary cave
76
-
77
- and it was so cold and so scary in
78
- there, that Albi began to cry
79
-
80
- =begin bar
81
- Dragon Tears!
82
-
83
- =end bar
84
-
85
- Which, as we all know...
86
-
87
- =begin bar
88
- Turn into Jelly Beans!
89
- =end bar
90
- =end foo
91
- #---
92
-
93
- $r = $=pod[5];
94
- isa-ok $r, Pod::Block;
95
- is $r.contents.elems, 5, '5 sub-nodes in foo';
96
- is $r.contents[0].contents,
97
- 'and so, all of the villages chased Albi, The Racist Dragon, ' ~
98
- 'into the very cold and very scary cave',
99
- '...in the marmelade forest';
100
- is $r.contents[1].contents,
101
- 'and it was so cold and so scary in there, that Albi began to cry',
102
- '...between the make-believe trees';
103
- is $r.contents[2].contents[0].contents, "Dragon Tears!",
104
- '...in a cottage cheese cottage';
105
- is $r.contents[3].contents, "Which, as we all know...",
106
- '...lives Albi! Albi!';
107
- is $r.contents[4].contents[0].contents, "Turn into Jelly Beans!",
108
- '...Albi, the Racist Dragon';
109
-
110
- #---
111
- =begin pod
112
-
113
- someone accidentally left a space
114
-
115
- between these two paragraphs
116
-
117
- =end pod
118
- #---
119
-
120
- $r = $=pod[6];
121
- isa-ok $r, Pod::Block;
122
- is $r.contents[0].contents, 'someone accidentally left a space',
123
- 'accidental space, 1/2';
124
- is $r.contents[1].contents, 'between these two paragraphs',
125
- 'accidental space, 2/2';
126
-
127
- # various things which caused the spectest to fail at some point
128
- #---
129
- =begin kwid
130
-
131
- = DESCRIPTION
132
- bla bla
133
-
134
- foo
135
- =end kwid
136
- #---
137
-
138
- $r = $=pod[7];
139
- is $r.contents[0].contents, '= DESCRIPTION bla bla';
140
- isa-ok $r.contents[1], Pod::Block::Para;
141
- is $r.contents[1].contents, 'foo';
142
-
143
- #---
144
- =begin more-discussion-needed
145
-
146
- XXX: chop(@array) should return an array of chopped strings?
147
- XXX: chop(%has) should return a hash of chopped strings?
148
-
149
- =end more-discussion-needed
150
- #---
151
-
152
- $r = $=pod[8];
153
- isa-ok $r, Pod::Block;
154
-
155
- #---
156
- =begin pod
157
- =head1 This is a heading block
158
-
159
- This is an ordinary paragraph.
160
- Its text will be squeezed and
161
- short lines filled. It is terminated by
162
- the first blank line.
163
-
164
- This is another ordinary paragraph.
165
- Its text will also be squeezed and
166
- short lines filled. It is terminated by
167
- the trailing directive on the next line.
168
- =head2 This is another heading block
169
-
170
- This is yet another ordinary paragraph,
171
- at the first virtual column set by the
172
- previous directive
173
- =end pod
174
- #---
175
-
176
- $r = $=pod[9];
177
- isa-ok $r.contents[0], Pod::Heading;
178
- isa-ok $r.contents[1], Pod::Block::Para;
179
- isa-ok $r.contents[2], Pod::Block::Para;
180
- isa-ok $r.contents[3], Pod::Heading;
181
- isa-ok $r.contents[4], Pod::Block::Para;
182
- is $r.contents.elems, 5;
183
-
184
- eval-lives-ok "=begin pod\nSome documentation\n=end pod", "Pod files don't have to end in a newline";
@@ -1,137 +0,0 @@
1
- use v6;
2
- use Test;
3
- use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
4
- use Test::Util;
5
- plan 28;
6
- my $r;
7
-
8
- #---
9
- =for Foo
10
- #---
11
-
12
- $r = $=pod[0];
13
- isa-ok $r, Pod::Block, 'returns a Pod6 Block';
14
- isa-ok $r, Pod::Block::Named, 'returns a named Block';
15
- is $r.name, 'Foo', 'name is ok';
16
- is $r.contents, [], 'no contents, all right';
17
-
18
- #---
19
- =for Foo
20
- some text
21
- #---
22
-
23
- $r = $=pod[1];
24
- isa-ok $r.contents[0], Pod::Block::Para;
25
- is $r.contents[0].contents, "some text", 'the contents are all right';
26
-
27
- #---
28
- =for Foo
29
- some
30
- spaced text
31
- #---
32
-
33
- $r = $=pod[2];
34
- is $r.contents[0].contents,
35
- "some spaced text", 'additional whitespace removed from the contents';
36
- #---
37
- =begin pod
38
-
39
- =for Got
40
- Inside Got
41
-
42
- =for Bidden
43
- Inside Bidden
44
-
45
- Outside blocks
46
- =end pod
47
- #---
48
-
49
- $r = $=pod[3];
50
- isa-ok $r.contents[0], Pod::Block;
51
- is $r.contents[0].contents[0].contents, "Inside Got",
52
- 'paragraph block contents ok, 1/2';
53
- isa-ok $r.contents[1], Pod::Block;
54
- is $r.contents[1].contents[0].contents, "Inside Bidden",
55
- 'paragraph block contents ok, 1/2';
56
- isa-ok $r.contents[2], Pod::Block::Para;
57
- is $r.contents[2].contents, "Outside blocks",
58
- 'contents outside blocks is all right';
59
-
60
- # mixed blocks
61
- #---
62
- =begin pod
63
- =begin One
64
- One, delimited block
65
- =end One
66
- =for Two
67
- Two, paragraph block
68
- =for Three
69
- Three, still a parablock
70
-
71
- =begin Four
72
- Four, another delimited one
73
- =end Four
74
- =end pod
75
- #---
76
-
77
- $r = $=pod[4];
78
- is $r.contents[0].contents[0].contents,
79
- "One, delimited block", "mixed blocks, 1";
80
- is $r.contents[1].contents[0].contents,
81
- "Two, paragraph block", "mixed blocks, 2";
82
- is $r.contents[2].contents[0].contents,
83
- "Three, still a parablock", "mixed blocks, 3";
84
- is $r.contents[3].contents[0].contents,
85
- "Four, another delimited one", "mixed blocks, 4";
86
-
87
- # tests without Albi would still be tests, but definitely very, very sad
88
- # also, Albi without paragraph blocks wouldn't be the happiest dragon
89
- # either
90
- #---
91
- =begin Foo
92
- and so, all of the villages chased
93
- Albi, The Racist Dragon, into the
94
- very cold and very scary cave
95
-
96
- and it was so cold and so scary in
97
- there, that Albi began to cry
98
-
99
- =for Bar
100
- Dragon Tears!
101
-
102
- Which, as we all know...
103
-
104
- =for Bar
105
- Turn into Jelly Beans!
106
- =end Foo
107
- #---
108
-
109
- $r = $=pod[5];
110
- isa-ok $r, Pod::Block;
111
- is $r.contents.elems, 5, '5 sub-nodes in foo';
112
- is $r.name, 'Foo';
113
- is $r.contents[0].contents,
114
- 'and so, all of the villages chased Albi, The Racist Dragon, ' ~
115
- 'into the very cold and very scary cave',
116
- '...in the marmelade forest';
117
- is $r.contents[1].contents,
118
- 'and it was so cold and so scary in there, that Albi began to cry',
119
- '...between the make-believe trees';
120
- is $r.contents[2].name, 'Bar';
121
- is $r.contents[2].contents[0].contents, "Dragon Tears!",
122
- '...in a cottage cheese cottage';
123
- is $r.contents[3].contents, "Which, as we all know...",
124
- '...lives Albi! Albi!';
125
- is $r.contents[4].name, 'Bar';
126
- is $r.contents[4].contents[0].contents, "Turn into Jelly Beans!",
127
- '...Albi, the Racist Dragon';
128
-
129
-
130
- # RT#131400
131
- is_run Q:to/♥♥♥/, :compiler-args['--doc=Text'],
132
- =for pod
133
- =for nested
134
- =for para :nested(1)
135
- E<a;b>E<a;b;c>
136
- ♥♥♥
137
- {:err(''), :out("ababc\n"), :0status}, 'nested paras do not crash/warn';
@@ -1,145 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 30;
4
- my $r;
5
-
6
- #---
7
- =foo
8
- #---
9
-
10
- $r = $=pod[0];
11
- isa-ok $r, Pod::Block, 'returns a Pod6 Block';
12
- isa-ok $r, Pod::Block::Named, 'returns a named Block';
13
- is $r.contents, [], 'no contents, all right';
14
-
15
- #---
16
- =foo some text
17
- #---
18
-
19
- $r = $=pod[1];
20
- is $r.contents[0].contents, "some text", 'the contents are all right';
21
-
22
- #---
23
- =foo some text
24
- and some more
25
- #---
26
-
27
- $r = $=pod[2];
28
- is $r.contents[0].contents, "some text and some more", 'the contents are all right';
29
-
30
- #---
31
- =begin pod
32
-
33
- =got Inside
34
- got
35
-
36
- =bidden Inside
37
- bidden
38
-
39
- Outside blocks
40
- =end pod
41
- #---
42
-
43
- $r = $=pod[3];
44
- isa-ok $r.contents[0], Pod::Block;
45
- is $r.contents[0].contents[0].contents, "Inside got",
46
- 'paragraph block contents ok, 1/2';
47
- isa-ok $r.contents[1], Pod::Block;
48
- is $r.contents[1].contents[0].contents, "Inside bidden",
49
- 'paragraph block contents ok, 1/2';
50
- isa-ok $r.contents[2], Pod::Block::Para;
51
- is $r.contents[2].contents, "Outside blocks",
52
- 'contents outside blocks is all right';
53
-
54
- # mixed blocks
55
- #---
56
- =begin pod
57
- =begin one
58
- one, delimited block
59
- =end one
60
- =two two,
61
- paragraph block
62
- =for three
63
- three, still a parablock
64
-
65
- =begin four
66
- four, another delimited one
67
- =end four
68
- =head1 And just for the sake of having a working =head1 :)
69
- =end pod
70
- #---
71
-
72
- $r = $=pod[4];
73
- is $r.contents[0].contents[0].contents,
74
- "one, delimited block", "mixed blocks, 1";
75
- is $r.contents[1].contents[0].contents,
76
- "two, paragraph block", "mixed blocks, 2";
77
- is $r.contents[2].contents[0].contents,
78
- "three, still a parablock", "mixed blocks, 3";
79
- is $r.contents[3].contents[0].contents,
80
- "four, another delimited one", "mixed blocks, 4";
81
- is $r.contents[4].contents[0].contents,
82
- "And just for the sake of having a working =head1 :)", 'mixed blocks, 5';
83
-
84
- #---
85
- =begin foo
86
- and so, all of the villages chased
87
- Albi, The Racist Dragon, into the
88
- very cold and very scary cave
89
-
90
- and it was so cold and so scary in
91
- there, that Albi began to cry
92
-
93
- =bold Dragon Tears!
94
-
95
- Which, as we all know...
96
-
97
- =bold Turn
98
- into
99
- Jelly
100
- Beans!
101
- =end foo
102
- #---
103
-
104
- $r = $=pod[5];
105
- isa-ok $r, Pod::Block;
106
- is $r.contents.elems, 5, '5 sub-nodes in foo';
107
- is $r.contents[0].contents,
108
- 'and so, all of the villages chased Albi, The Racist Dragon, ' ~
109
- 'into the very cold and very scary cave',
110
- '...in the marmelade forest';
111
- is $r.contents[1].contents,
112
- 'and it was so cold and so scary in there, that Albi began to cry',
113
- '...between the make-believe trees';
114
- is $r.contents[2].contents[0].contents, "Dragon Tears!",
115
- '...in a cottage cheese cottage';
116
- is $r.contents[3].contents, "Which, as we all know...",
117
- '...lives Albi! Albi!';
118
- is $r.contents[4].contents[0].contents, "Turn into Jelly Beans!",
119
- '...Albi, the Racist Dragon';
120
-
121
- # from S26
122
- #---
123
- Z<>=table_not
124
- Constants 1
125
- Variables 10
126
- Subroutines 33
127
- Everything else 57
128
- #---
129
-
130
- $r = $=pod[6];
131
- isa-ok $r, Pod::Block;
132
- is $r.contents.elems, 1;
133
- is $r.contents[0].contents,
134
- 'Constants 1 Variables 10 Subroutines 33 Everything else 57';
135
-
136
- #---
137
- =head3
138
- Heading level 3
139
- #---
140
-
141
- $r = $=pod[7];
142
- isa-ok $r, Pod::Block;
143
- isa-ok $r, Pod::Heading;
144
- is $r.level, '3';
145
- is $r.contents[0].contents, 'Heading level 3';
@@ -1,178 +0,0 @@
1
- use v6;
2
- use Test;
3
- plan 50;
4
- my $r;
5
-
6
- #---
7
- =begin pod
8
- This ordinary paragraph introduces a code block:
9
-
10
- $this = 1 * code('block');
11
- $which.is_specified(:by<indenting>);
12
-
13
-
14
- $which.spans(:newlines);
15
-
16
- =end pod
17
- #---
18
-
19
- $r = $=pod[0];
20
- is $r.contents[0].contents, 'This ordinary paragraph introduces a code block:';
21
- isa-ok $r.contents[1], Pod::Block::Code;
22
- is $r.contents[1].contents.Str.subst("\r\n", "\n", :g), q[$this = 1 * code('block');
23
- $which.is_specified(:by<indenting>);
24
-
25
- $which.spans(:newlines);].subst("\r\n", "\n", :g);
26
-
27
- # more fancy code blocks
28
- #---
29
- =begin pod
30
- This is an ordinary paragraph
31
-
32
- While this is not
33
- This is a code block
34
-
35
- =head1 Mumble mumble
36
-
37
- Suprisingly, this is not a code block
38
- (with fancy indentation too)
39
-
40
- But this is just a text. Again
41
-
42
- =end pod
43
- #---
44
-
45
- $r = $=pod[1];
46
- is $r.contents.elems, 5;
47
- is $r.contents[0].contents, 'This is an ordinary paragraph';
48
- isa-ok $r.contents[1], Pod::Block::Code;
49
- is $r.contents[1].contents, "While this is not\nThis is a code block";
50
- isa-ok $r.contents[2], Pod::Block;
51
- is $r.contents[2].contents[0].contents, 'Mumble mumble';
52
- isa-ok $r.contents[3], Pod::Block::Para;
53
- is $r.contents[3].contents, "Suprisingly, this is not a code block"
54
- ~ " (with fancy indentation too)";
55
- is $r.contents[4].contents, "But this is just a text. Again";
56
-
57
- #---
58
- =begin pod
59
-
60
- Tests for the feed operators
61
-
62
- ==> and <==
63
-
64
- =end pod
65
- #---
66
-
67
- $r = $=pod[2];
68
- is $r.contents[0].contents, 'Tests for the feed operators';
69
- isa-ok $r.contents[1], Pod::Block::Code;
70
- is $r.contents[1].contents, "==> and <==";
71
-
72
- #---
73
- =begin pod
74
- Fun comes
75
-
76
- This is code
77
- Ha, what now?
78
-
79
- one more block of code
80
- just to make sure it works
81
- or better: maybe it'll break!
82
- =end pod
83
- #---
84
-
85
- $r = $=pod[3];
86
- is $r.contents.elems, 4;
87
- is $r.contents[0].contents, 'Fun comes';
88
- isa-ok $r.contents[1], Pod::Block::Code;
89
- is $r.contents[1].contents, 'This is code';
90
- isa-ok $r.contents[2], Pod::Block::Code;
91
- is $r.contents[2].contents, 'Ha, what now?';
92
- isa-ok $r.contents[3], Pod::Block::Code;
93
- is $r.contents[3].contents, "one more block of code\n"
94
- ~ "just to make sure it works\n"
95
- ~ " or better: maybe it'll break!";
96
-
97
- #---
98
- =begin pod
99
-
100
- =head1 A heading
101
-
102
- This is Pod too. Specifically, this is a simple C<para> block
103
-
104
- $this = pod('also'); # Specifically, a code block
105
-
106
- =end pod
107
- #---
108
-
109
- $r = $=pod[4];
110
- is $r.contents.elems, 3;
111
- isa-ok $r.contents[0], Pod::Block;
112
- is $r.contents[0].contents[0].contents, 'A heading';
113
- is $r.contents[1].contents[0],
114
- 'This is Pod too. Specifically, this is a simple ';
115
- isa-ok $r.contents[1].contents[1], Pod::FormattingCode;
116
- is $r.contents[1].contents[1].type, 'C';
117
- is $r.contents[1].contents[1].contents, 'para';
118
- is $r.contents[1].contents[2], ' block';
119
- isa-ok $r.contents[2], Pod::Block::Code;
120
- is $r.contents[2].contents,
121
- q[$this = pod('also'); # Specifically, a code block];
122
-
123
- #---
124
- =begin pod
125
- this is code
126
-
127
- =for Podcast
128
- this is not
129
-
130
- this is not code either
131
-
132
- =begin Itemization
133
- this is not
134
- =end Itemization
135
-
136
- =begin Quitem
137
- and this is not
138
- =end Quitem
139
-
140
- =begin item
141
- and this is!
142
- =end item
143
- =end pod
144
- #---
145
-
146
- $r = $=pod[5];
147
- is $r.contents.elems, 6;
148
- isa-ok $r.contents[0], Pod::Block::Code;
149
- is $r.contents[0].contents, 'this is code';
150
-
151
- isa-ok $r.contents[1], Pod::Block::Named;
152
- is $r.contents[1].name, 'Podcast';
153
- is $r.contents[1].contents[0].contents, 'this is not';
154
-
155
- isa-ok $r.contents[2], Pod::Block::Para;
156
- is $r.contents[2].contents, 'this is not code either';
157
-
158
- isa-ok $r.contents[3], Pod::Block::Named;
159
- is $r.contents[3].name, 'Itemization';
160
- is $r.contents[3].contents[0].contents, 'this is not';
161
-
162
- isa-ok $r.contents[4], Pod::Block::Named;
163
- is $r.contents[4].name, 'Quitem';
164
- is $r.contents[4].contents[0].contents, 'and this is not';
165
-
166
- isa-ok $r.contents[5].contents[0], Pod::Block::Code;
167
- is $r.contents[5].contents[0].contents, 'and this is!';
168
-
169
- #---
170
- =begin code
171
- foo foo
172
- =begin code
173
- =end code
174
- =end code
175
- #---
176
-
177
- $r = $=pod[6];
178
- isa-ok $r, Pod::Block::Code;
@@ -1,78 +0,0 @@
1
-
2
- # test =input =output
3
- #---
4
- =begin pod
5
- =begin output
6
- Name: Baracus, B.A.
7
- Age: 49
8
- Print? B<K<n>>
9
- =end output
10
- =begin output
11
- Name: Baracus, B.A.
12
- Age: 49
13
- Print? B<K<n>>
14
- =end output
15
- =end pod
16
- #---
17
-
18
-
19
- use v6;
20
- use Test;
21
- use lib $?FILE.IO.parent(2).add("packages/Test-Helpers");
22
- use Test::Util;
23
-
24
- plan 6;
25
-
26
- my $r;
27
-
28
- # Tests expected to fail:
29
-
30
- my $p1 = Q:to<--END-->;
31
- =begin code
32
- say 1;
33
- say 2;
34
- =end
35
- --END--
36
-
37
- my $p2 = Q:to<--END-->;
38
- =begin input
39
- say 1;
40
- say 2;
41
- =end
42
- --END--
43
-
44
- my $p3 = Q:to<--END-->;
45
- =begin output
46
- say 1;
47
- say 2;
48
- =end
49
- --END--
50
-
51
- my $p4 = Q:to<--END-->;
52
- =begin code
53
- say 1;
54
- say 2;
55
- =end input
56
- --END--
57
-
58
- my $p5 = Q:to<--END-->;
59
- =begin input
60
- say 1;
61
- say 2;
62
- =end output
63
- --END--
64
-
65
- my $p6 = Q:to<--END-->;
66
- =begin output
67
- say 1;
68
- say 2;
69
- =end code
70
- --END--
71
-
72
- for $p1, $p2, $p3, $p4, $p5, $p6 -> $POD {
73
- is_run :compiler-args['--doc'], $POD, {
74
- # the %wanted hash
75
- status => 1,
76
- }, 'expected fail of basic --doc check';
77
- }
78
-