Skip to content

Commit

Permalink
save work
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrowder committed Oct 25, 2017
1 parent f90fe21 commit 72c9444
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 28 deletions.
24 changes: 12 additions & 12 deletions S26-documentation/07-tables.t
Expand Up @@ -109,11 +109,11 @@ is $r.contents[3].join('|'),
"The Bowler|Carol Pinnsler|Haunted bowling ball";

=table
X | O |
---+---+---
| X | O
---+---+---
| | X
X | O |
---+---+---
| X | O
---+---+---
| | X


$r = $=pod[6];
Expand All @@ -130,11 +130,11 @@ my $s3 := $r.contents[1].join(',');
is $r.contents[2].join(','), ',,X', "got '$s3'";

=table
X O
X O
===========
X O
X O
===========
X
X

$r = $=pod[7];
# tests 34-37:
Expand Down Expand Up @@ -162,17 +162,17 @@ is $r.contents.elems, 2;

# NOTE: This test may need to change after planned table pod fixes are
# made because this is a malformed table and the user should be warned
# of that fact.

# of that fact. But the table can also be fixed automatically which
# is the planned fix.
=begin table
a | b | c
l | m | n
x | y
=end table

$r = $=pod[9];
# test 39-42:
# tests 39-42:
is $r.contents.elems, 3;
is $r.contents[0].join(','), 'a,b,c';
is $r.contents[1].join(','), 'l,m,n';
is $r.contents[2].join(','), 'x,y';
is $r.contents[2].join(','), 'x,y'; # should change to "x,y," after a planned fix
29 changes: 13 additions & 16 deletions S26-documentation/07a-tables.t
@@ -1,12 +1,12 @@
use v6;
use Test;

#plan 13;
plan 3;
plan 8;

my $r;
my $t = 0;

# tests for 'RT #128221'
#{
# test for issue #128221 when it's closed
# This test, with a '-r0c0' entry in
# the single table row, column 0,
Expand All @@ -16,11 +16,10 @@ my $r;
=end table
$r = $=pod[0];
# 3 tests
is $r.contents.elems, 1;
is $r.contents[0][0], "-r0c0"; # <= note leading hyphen which caused the original issue
is $r.contents[0][1], "r0c1";
is $r.contents.elems, 1, "test {++$t}";
is $r.contents[0][0], "-r0c0", "test {++$t}"; # <= note leading hyphen which caused the original issue
is $r.contents[0][1], "r0c1", "test {++$t}";

=begin comment
# an expanded test (per Zoffix) for issue #128221
# when it's closed.
# This test is for other table parsing issues
Expand All @@ -31,10 +30,7 @@ my $r;
r0Col 1 | -r0Col 2 | _r0Col 3 | =r0Col 4
-------|--------|--------|-------
r1Col 1 | -r1Col 2 | _r1Col 3 | =r1Col 4
r2Col 1 | -r2Col 2 | _r2Col 3 | =r2Col 4
r3Col 1 | -r3Col 2 | _r3Col 3 | =r3Col 4
r4Col 1 | -r4Col 2 | _r4Col 3 | =r4Col 4
r5Col 1 | -r5Col 2 | _r5Col 3 | =r5Col 4
r1 | r1Col 2 | _r2Col 3 | =r2Col 4
-------|--------|--------|-------
r6Col 1 | r6Col 2 | r6Col 3 | r6Col 4
=end table
Expand All @@ -43,15 +39,16 @@ my $r;
my @rows = $r.contents>>.join(' ');

# 10 tests
is $r.headers.elems, 1;
is $r.contents.elems, 7;
is $hdrs, "-Col 1 -Col 2 _Col 3 =Col 4"; # <= note leading hyphen which caused the original issue
my $s = $r.headers.elems;
is $r.headers.elems, 4, "test {++$t}, got '$s'";
is $r.contents.elems, 3, "test{++$t}";
is $hdrs, "-Col 1 -Col 2 _Col 3 =Col 4", "got '$hdrs'"; # <= note leading hyphen which caused the original issue
is @rows[0], "r0Col 1 -r0Col 2 _r0Col 3 =r0Col 4";
=begin comment
is @rows[1], "r1Col 1 -r1Col 2 _r1Col 3 =r1Col 4";
is @rows[2], "r2Col 1 -r2Col 2 _r2Col 3 =r2Col 4";
is @rows[3], "r3Col 1 -r3Col 2 _r3Col 3 =r3Col 4";
is @rows[4], "r4Col 1 -r4Col 2 _r4Col 3 =r4Col 4";
is @rows[5], "r5Col 1 -r5Col 2 _r5Col 3 =r5Col 4";
is @rows[6], "r6Col 1 r6Col 2 r6Col 3 r6Col 4";
=end comment
#}
is @rows[2], "r6Col 1 r6Col 2 r6Col 3 r6Col 4";
83 changes: 83 additions & 0 deletions S26-documentation/07b-tables.t
@@ -0,0 +1,83 @@
use v6;
use Test;
my $r;

# more failing tables under original but patched code

# plan 42;

=begin table
The Shoveller Eddie Stevens King Arthur's singing shovel
Blue Raja Geoffrey Smith Master of cutlery
Mr Furious Roy Orson Ticking time bomb of fury
The Bowler Carol Pinnsler Haunted bowling ball
=end table

=table
Constants 1
Variables 10
Subroutines 33
Everything else 57

=for table
mouse | mice
horse | horses
elephant | elephants
=table
Animal | Legs | Eats
=======================
Zebra + 4 + Cookies
Human + 2 + Pizza
Shark + 0 + Fish

=table
Superhero | Secret |
| Identity | Superpower
==============|=================|================================
The Shoveller | Eddie Stevens | King Arthur's singing shovel

=begin table
Secret
Superhero Identity Superpower
============= =============== ===================
The Shoveller Eddie Stevens King Arthur's
singing shovel
Blue Raja Geoffrey Smith Master of cutlery
Mr Furious Roy Orson Ticking time bomb
of fury
The Bowler Carol Pinnsler Haunted bowling ball
=end table

=table
X | O |
---+---+---
| X | O
---+---+---
| | X

=table
X O
===========
X O
===========
X

=begin table
foo
bar
=end table

=begin table
a | b | c
l | m | n
x | y
=end table

0 comments on commit 72c9444

Please sign in to comment.