Skip to content

Commit

Permalink
Working correctly with empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
bessarabov committed Sep 9, 2023
1 parent 16cc776 commit 3d5cbe0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/data/empty/cmd_and_expected_output
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$ cat $TEST_DIR/empty.tsv | $TSV2TABLE
a | b | c
| |
A | B | C
3 changes: 3 additions & 0 deletions tests/data/empty/empty.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a b c

A B C
2 changes: 1 addition & 1 deletion tsv2table
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ sub main {
while (<>) {
chomp;
s/\r\z//;
my @row = split $options->{separator}, $_;
my @row = split $options->{separator}, $_, -1;

for (my $i = 0; $i < scalar @row; $i++) {
if (length($row[$i]) > ($max_column_length[$i] // 0)) {
Expand Down

0 comments on commit 3d5cbe0

Please sign in to comment.