Skip to content

Commit

Permalink
Fix problem found in dlc@4b9bd10#commitcomment-1540416.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlc committed Jul 5, 2012
1 parent ab496e7 commit 6b6875f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -24,5 +24,6 @@ t/13.t
t/14.t
t/15.t
t/16.t
t/17.t
TabularDisplay.pm
META.yml Module meta-data (added by MakeMaker)
2 changes: 1 addition & 1 deletion README
Expand Up @@ -235,5 +235,5 @@ CREDITS
Patrick Kuijvenhoven

VERSION
This documentation describes "Text::TabularDisplay" version 1.32.
This documentation describes "Text::TabularDisplay" version 1.33.

6 changes: 3 additions & 3 deletions TabularDisplay.pm
Expand Up @@ -23,7 +23,7 @@ use strict;
use integer;
use vars qw($VERSION);

$VERSION = "1.32";
$VERSION = "1.33";

# ---======================= Public Methods ======================---

Expand Down Expand Up @@ -251,7 +251,7 @@ sub _format_line {
my $height = 0;
my @col_lines;
for (@$columns) {
my @lines = split "\n", (defined $_ ? $_ : '');
my @lines = split "\n", ((defined $_ && length $_) ? $_ : ' ');
$height = scalar @lines
if $height < @lines;
push @col_lines, \@lines;
Expand Down Expand Up @@ -556,5 +556,5 @@ feedback, or good karma:
=head1 VERSION
This documentation describes C<Text::TabularDisplay> version 1.32.
This documentation describes C<Text::TabularDisplay> version 1.33.
34 changes: 34 additions & 0 deletions t/17.t
@@ -0,0 +1,34 @@
#!/usr/bin/perl
# vim: set ft=perl:
# Test suggested by Patrick Kuijvenhoven <https://github.com/petski>
# in https://github.com/dlc/text--tabulardisplay/commit/4b9bd105d9ebaf8ac838e8e993216e4b56d85683#commitcomment-1540416

use strict;
use Text::TabularDisplay;
use Test;

BEGIN {
plan tests => 1;
}

my @data = (
["a", "b"],
["", ""],
[undef, ""],
["", undef],
[undef, undef],
[0, 0],
);

my $t = Text::TabularDisplay->new("a", "b");
$t->populate([ @data ]);
ok($t->render, "+---+---+
| a | b |
+---+---+
| a | b |
| | |
| | |
| | |
| | |
| 0 | 0 |
+---+---+");

0 comments on commit 6b6875f

Please sign in to comment.