Skip to content

Commit

Permalink
CSV whitespace character tests and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
nics committed Dec 4, 2018
1 parent e22fd90 commit bc43178
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -2,6 +2,8 @@ Revision history for Catmandu

{{$NEXT}}
- new cp,mv and rm shortcuts for copy_field, move_field and remove_field
- CSV exporter accepts escaped whitespace literals as sep_char just like the
TSV exporter

1.10_02 2018-11-09 09:09:02 CET
- bump required version of List::MoreUtils
Expand Down
3 changes: 1 addition & 2 deletions lib/Catmandu/Exporter/TSV.pm
Expand Up @@ -8,8 +8,7 @@ use Catmandu::Exporter::CSV;
use Moo;
use namespace::clean;


has sep_char => (is => 'ro', default => sub {"\t"},);
has sep_char => (is => 'ro', default => sub {"\t"},);
has csv => (is => 'lazy', handles => [qw(add)]);

with 'Catmandu::TabularExporter';
Expand Down
8 changes: 6 additions & 2 deletions t/Catmandu-Exporter-CSV.t
Expand Up @@ -85,10 +85,14 @@ $exporter = $pkg->new(file => \$out);
$exporter->commit;
is $out, "";
$out = "";
$exporter = $pkg->new(file => \$out, fields => 'a,b');

$exporter = $pkg->new(file => \$out, fields => 'a,b', sep_char => "\t");
$exporter->add({a => 'Hello', b => 'World'});
$exporter->commit;
$csv = <<EOF;
a,b
a\tb
Hello\tWorld
EOF
is $out, $csv, "Escaped whitespace literal as sep_char";

done_testing;

0 comments on commit bc43178

Please sign in to comment.