Skip Menu |

This queue is for tickets about the Text-CSV CPAN distribution.

Report information
The Basics
Id: 93518
Status: resolved
Priority: 0/
Queue: Text-CSV

People
Owner: Nobody in particular
Requestors: SHLOMIF [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Failing test case with Text::CSV_PP - works fine in Text::CSV_XS
The Attached test file works fine with Text::CSV_XS And does not with Text::CSV_PP - the correct behaviour is Text::CSV_XS's: « shlomif@telaviv1:~/progs/perl/forums/irc/freenode/blue_sky-Text-CSV--problem$ USE_TEXT_CSV_XS=1 runprove Text-CSV_PP-failing-test.t Text-CSV_PP-failing-test .. ok All tests successful. Files=1, Tests=4, 0 wallclock secs ( 0.03 cusr + 0.01 csys = 0.04 CPU) shlomif@telaviv1:~/progs/perl/forums/irc/freenode/blue_sky-Text-CSV--problem$ USE_TEXT_CSV_XS=0 runprove Text-CSV_PP-failing-test.t Text-CSV_PP-failing-test .. NOK 4 # Failed test 'First line POST CODE' # at Text-CSV_PP-failing-test.t line 56. # got: 'Simplex, ", ", 99 999' # expected: 'Simplex' # Failed test 'First line GRID REF' # at Text-CSV_PP-failing-test.t line 66. # got: '0.00' # expected: '' # Failed test 'First line TELEPHONE' # at Text-CSV_PP-failing-test.t line 71. # got: undef # expected: '099 999' # Looks like you failed 3 tests of 4. Text-CSV_PP-failing-test .. dubious Test returned status 3 (wstat 768, 0x300) DIED. FAILED tests 1, 3-4 Failed 3/4 tests, 25.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- Text-CSV_PP-failing-test.t 3 768 4 3 75.00% 1 3-4 Failed 1/1 test scripts, 0.00% okay. 3/4 subtests failed, 25.00% okay. » Thanks to blue_sky from the Freenode IRC network for bringing this issue to our attention. I did some work on the input. Please look into fixing it. Regards, -- Shlomi Fish
Subject: Text-CSV_PP-failing-test.t
#!/usr/bin/perl =head1 DESCRIPTION This is a test program that succeeds with Text::CSV_PP and fails with Text::CSV_XS. The Text::CSV_XS behaviour is the correct one. =head1 CREDITS AND LICENSE The sample data (now anonymised) and a test program were contributed by blue_sky on Freenode’s #perl channel as part of a problem report with Text::CSV_PP based on the Text::CSV documentation. License is open source and compatible with the license of Text::CSV. Converted into a test program by Shlomi Fish ( L<http://www.shlomifish.org/> ) , while disclaiming all explicit or implicit copyright ownership on the modifications. =cut use warnings; use strict; use Test::More tests => 4; my $USE_XS = $ENV{'USE_TEXT_CSV_XS'}; use Text::CSV_PP; use Data::Dumper qw(Dumper); if ($USE_XS) { require Text::CSV_XS; } { my $csv_text = <<'EOF'; "DIVISION CODE", "DIVISION DESCRIPTION", "CUSTOMER CODE", "CUSTOMER NAME", "SHORT NAME", "ADDRESS LINE 1", "ADDRESS LINE 2", "ADDRESS LINE 3", "TOWN", "COUNTY", "POST CODE", "COUNTRY", "GRID REF", "TELEPHONE", "AGENT CODE", "YEAR TO DATE SALES" "1", "UK", "Lambda", "Gambda Noo", "Foo", "Quad", "Rectum", "", "Eingoon", "Land", "Simplex", "", "", "099 999", "", 0.00 EOF open my $IF, "<", \$csv_text; my $csv = ($USE_XS ? "Text::CSV_XS" : "Text::CSV_PP")->new({ allow_whitespace => 1, allow_loose_escapes => 1, }) or die "Cannot use CSV: ".Text::CSV->error_diag(); $csv->column_names( $csv->getline($IF) ); { my $first_line = $csv->getline_hr($IF); # TEST is ($first_line->{'POST CODE'}, 'Simplex', "First line POST CODE" ); # TEST is ($first_line->{'COUNTRY'}, '', "First line COUNTRY", ); # TEST is ($first_line->{'GRID REF'}, '', "First line GRID REF", ); # TEST is ($first_line->{'TELEPHONE'}, '099 999', "First line TELEPHONE", ); } close($IF); }
looks like this was patched in 1.33. Should this issue be closed?
On Sat May 30 12:42:04 2015, GARU wrote: Show quoted text
> looks like this was patched in 1.33. Should this issue be closed?
Yes, and I see the test program was added there as well in t/fields_containing_0.t . RESOLVE-ing this issue. Regards, -- Shlomi Fish