Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new tests for POD tables rakudo/rakudo/#1282
Add new tests for fix to rakudo/rakudo#1282
- Loading branch information
Showing
2 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use v6; | ||
|
||
use MONKEY-SEE-NO-EVAL; | ||
use Test; | ||
|
||
my $f = './.tmp-test-file'; | ||
|
||
my $code = gen-test($f); | ||
|
||
EVAL $code; | ||
|
||
##### subroutines ##### | ||
sub gen-test($f) { | ||
my $fh = open $f, :w; | ||
|
||
$fh.print: q:to/HERE/; | ||
use v6; | ||
use Test; | ||
plan 8; | ||
my $r; | ||
# table with no ending ws | ||
=table | ||
HERE | ||
|
||
$fh.say: " X | O |"; | ||
|
||
$fh.print: q:to/HERE/; | ||
---+---+--- | ||
| X | O | ||
---+---+--- | ||
| | X | ||
# table with ending ws | ||
=table | ||
HERE | ||
|
||
$fh.say: " X | O | "; | ||
|
||
$fh.print: q:to/HERE/; | ||
---+---+--- | ||
| X | O | ||
---+---+--- | ||
| | X | ||
$r = $=pod[0]; | ||
is $r.contents.elems, 3; | ||
is $r.contents[0].join(','), 'X,O,'; | ||
is $r.contents[1].join(','), ',X,O'; | ||
is $r.contents[2].join(','), ',,X'; | ||
$r = $=pod[1]; | ||
is $r.contents.elems, 3; | ||
is $r.contents[0].join(','), 'X,O,'; | ||
is $r.contents[1].join(','), ',X,O'; | ||
is $r.contents[2].join(','), ',,X'; | ||
HERE | ||
|
||
$fh.close; | ||
|
||
return slurp $f; | ||
} | ||
|
||
END { unlink $f } |