Closed jjatria closed 4 years ago
Hm, actually, let me add some tests for this.
I've added some extremely non-DRY tests for this. Maybe tomorrow I can be more clever about how to avoid repeating myself repeating myself.
To make the tests simpler and shorter, why not .join
the grids, so you can just compare each against a single nine-character string? Then you could even make a little helper:
sub border-check($expected, $style) {
given A.new(x => 0, y => 0, h => 3, w => 3) {
.draw-box(0, 0, 2, 2, ($style if $style));
is .grid.grid.join, $expected, $style || $default;
}
}
... and similarly for border-check-with-color
or so.
I've updated the tests, so they're more DRY now
Merged, thanks!
Rakudo does not seem to allow constraints that use hashes in role methods (see https://github.com/rakudo/rakudo/issues/3172), but the issue disappears if the hashes are declared as constants rather.
At least until the issue is resolved upstream, this allows classes to consume the BoxDrawing role without needing to disable precompilation.
Fixes #74.