Skip to content

Commit 8420637

Browse files
committed
save working files
1 parent 26aa7da commit 8420637

File tree

2 files changed

+84
-13
lines changed

2 files changed

+84
-13
lines changed

S26-documentation/07-tables.t

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ plan 42;
1212
=end table
1313

1414
$r = $=pod[0];
15+
# tests 1-6:
1516
isa-ok $r, Pod::Block::Table;
1617
is $r.contents.elems, 4;
1718
is $r.contents[0].join('|'),
@@ -30,6 +31,7 @@ is $r.contents[3].join('|'),
3031
Everything else 57
3132

3233
$r = $=pod[1];
34+
# tests 7-11:
3335
is $r.contents.elems, 4;
3436
is $r.contents[0].join('|'), "Constants|1";
3537
is $r.contents[1].join('|'), "Variables|10";
@@ -42,6 +44,7 @@ is $r.contents[3].join('|'), "Everything else|57";
4244
elephant | elephants
4345
4446
$r = $=pod[2];
47+
# tests 12-15:
4548
is $r.contents.elems, 3;
4649
is $r.contents[0].join('|'), "mouse|mice";
4750
is $r.contents[1].join('|'), "horse|horses";
@@ -55,6 +58,7 @@ is $r.contents[2].join('|'), "elephant|elephants";
5558
Shark + 0 + Fish
5659

5760
$r = $=pod[3];
61+
# tests 16-20:
5862
is $r.headers.join('|'), "Animal|Legs|Eats";
5963
is $r.contents.elems, 3;
6064
is $r.contents[0].join('|'), "Zebra|4|Cookies";
@@ -68,6 +72,7 @@ is $r.contents[2].join('|'), "Shark|0|Fish";
6872
The Shoveller | Eddie Stevens | King Arthur's singing shovel
6973

7074
$r = $=pod[4];
75+
# tests 21-23:
7176
is $r.headers.join('|'), "Superhero|Secret Identity|Superpower";
7277
is $r.contents.elems, 1;
7378
is $r.contents[0].join('|'),
@@ -91,6 +96,7 @@ is $r.contents[0].join('|'),
9196
=end table
9297

9398
$r = $=pod[5];
99+
# tests 24-29:
94100
is $r.headers.join('|'), "Superhero|Secret Identity|Superpower";
95101
is $r.contents.elems, 4;
96102
is $r.contents[0].join('|'),
@@ -103,29 +109,35 @@ is $r.contents[3].join('|'),
103109
"The Bowler|Carol Pinnsler|Haunted bowling ball";
104110

105111
=table
106-
X | O |
107-
---+---+---
108-
| X | O
109-
---+---+---
110-
| | X
112+
X | O |
113+
---+---+---
114+
| X | O
115+
---+---+---
116+
| | X
117+
111118

112119
$r = $=pod[6];
120+
# tests 30-33:
113121
is $r.contents.elems, 3;
122+
my $s1 := $r.contents[0].join(',');
114123
is $r.contents[0].join(','), 'X,O,',
115-
'ensure trailing whitespace counts as a cell (WARNING: this test will'
116-
~ ' fail if you modified this file and your editor auto-stripped'
117-
~ ' trailing whitespace)';
118-
is $r.contents[1].join(','), ',X,O';
119-
is $r.contents[2].join(','), ',,X';
124+
"got '$s1'; ensure trailing whitespace counts as a cell (WARNING: this test will"
125+
~ " fail if you modified this file and your editor auto-stripped"
126+
~ " trailing whitespace)";
127+
my $s2 := $r.contents[1].join(',');
128+
is $r.contents[1].join(','), ',X,O', "got '$s2'";
129+
my $s3 := $r.contents[1].join(',');
130+
is $r.contents[2].join(','), ',,X', "got '$s3'";
120131

121132
=table
122-
X O
133+
X O
123134
===========
124-
X O
135+
X O
125136
===========
126-
X
137+
X
127138

128139
$r = $=pod[7];
140+
# tests 34-37:
129141
is $r.contents.elems, 3;
130142
is $r.contents[0].join(','), 'X,O,',
131143
'ensure trailing whitespace counts as a cell (WARNING: this test will'
@@ -142,6 +154,7 @@ bar
142154
=end table
143155

144156
$r = $=pod[8];
157+
# test 38:
145158
is $r.contents.elems, 2;
146159

147160
# test for issue #129862
@@ -158,6 +171,7 @@ x | y
158171
=end table
159172

160173
$r = $=pod[9];
174+
# test 39-42:
161175
is $r.contents.elems, 3;
162176
is $r.contents[0].join(','), 'a,b,c';
163177
is $r.contents[1].join(','), 'l,m,n';

S26-documentation/07a-tables.t

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
use v6;
2+
use Test;
3+
4+
#plan 13;
5+
plan 3;
6+
7+
my $r;
8+
# tests for 'RT #128221'
9+
#{
10+
# test for issue #128221 when it's closed
11+
# This test, with a '-r0c0' entry in
12+
# the single table row, column 0,
13+
# caused an exception.
14+
=begin table
15+
-r0c0 r0c1
16+
=end table
17+
$r = $=pod[0];
18+
# 3 tests
19+
is $r.contents.elems, 1;
20+
is $r.contents[0][0], "-r0c0"; # <= note leading hyphen which caused the original issue
21+
is $r.contents[0][1], "r0c1";
22+
23+
=begin comment
24+
# an expanded test (per Zoffix) for issue #128221
25+
# when it's closed.
26+
# This test is for other table parsing issues
27+
# discovered in Zoffix's work on the problem.
28+
=begin table
29+
-Col 1 | -Col 2 | _Col 3 | =Col 4
30+
=======+========+========+=======
31+
r0Col 1 | -r0Col 2 | _r0Col 3 | =r0Col 4
32+
-------|--------|--------|-------
33+
r1Col 1 | -r1Col 2 | _r1Col 3 | =r1Col 4
34+
r2Col 1 | -r2Col 2 | _r2Col 3 | =r2Col 4
35+
r3Col 1 | -r3Col 2 | _r3Col 3 | =r3Col 4
36+
r4Col 1 | -r4Col 2 | _r4Col 3 | =r4Col 4
37+
r5Col 1 | -r5Col 2 | _r5Col 3 | =r5Col 4
38+
-------|--------|--------|-------
39+
r6Col 1 | r6Col 2 | r6Col 3 | r6Col 4
40+
=end table
41+
$r = $=pod[1];
42+
my $hdrs = $r.headers.join(' ');
43+
my @rows = $r.contents>>.join(' ');
44+
45+
# 10 tests
46+
is $r.headers.elems, 1;
47+
is $r.contents.elems, 7;
48+
is $hdrs, "-Col 1 -Col 2 _Col 3 =Col 4"; # <= note leading hyphen which caused the original issue
49+
is @rows[0], "r0Col 1 -r0Col 2 _r0Col 3 =r0Col 4";
50+
is @rows[1], "r1Col 1 -r1Col 2 _r1Col 3 =r1Col 4";
51+
is @rows[2], "r2Col 1 -r2Col 2 _r2Col 3 =r2Col 4";
52+
is @rows[3], "r3Col 1 -r3Col 2 _r3Col 3 =r3Col 4";
53+
is @rows[4], "r4Col 1 -r4Col 2 _r4Col 3 =r4Col 4";
54+
is @rows[5], "r5Col 1 -r5Col 2 _r5Col 3 =r5Col 4";
55+
is @rows[6], "r6Col 1 r6Col 2 r6Col 3 r6Col 4";
56+
=end comment
57+
#}

0 commit comments

Comments
 (0)