r66556 - in /trunk/libtext-csv-perl: Changes MANIFEST META.yml README debian/changelog debian/control files/macosx.csv lib/Text/CSV.pm lib/Text/CSV_PP.pm t/45_eol.t t/51_utf8.t t/70_rt.t t/77_getall.t t/80_diag.t
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Tue Dec 28 13:52:25 UTC 2010
Author: carnil
Date: Tue Dec 28 13:52:10 2010
New Revision: 66556
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66556
Log:
* New upstream release
* Bump versioned Recommends on libtext-csv-xs-perl to (>= 0.80).
Added:
trunk/libtext-csv-perl/files/macosx.csv
- copied unchanged from r66553, branches/upstream/libtext-csv-perl/current/files/macosx.csv
trunk/libtext-csv-perl/t/51_utf8.t
- copied unchanged from r66553, branches/upstream/libtext-csv-perl/current/t/51_utf8.t
trunk/libtext-csv-perl/t/77_getall.t
- copied unchanged from r66553, branches/upstream/libtext-csv-perl/current/t/77_getall.t
Modified:
trunk/libtext-csv-perl/Changes
trunk/libtext-csv-perl/MANIFEST
trunk/libtext-csv-perl/META.yml
trunk/libtext-csv-perl/README
trunk/libtext-csv-perl/debian/changelog
trunk/libtext-csv-perl/debian/control
trunk/libtext-csv-perl/lib/Text/CSV.pm
trunk/libtext-csv-perl/lib/Text/CSV_PP.pm
trunk/libtext-csv-perl/t/45_eol.t
trunk/libtext-csv-perl/t/70_rt.t
trunk/libtext-csv-perl/t/80_diag.t
Modified: trunk/libtext-csv-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/Changes?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/Changes (original)
+++ trunk/libtext-csv-perl/Changes Tue Dec 28 13:52:10 2010
@@ -1,4 +1,9 @@
Revision history for Perl extension Text::CSV.
+
+1.21 Mon Dec 27 12:35:35 2010
+ - updated the compatibility for Text::CSV_XS version 0.80
+ * added getline_all() and getaline_hr_all()
+ * added missing test file
1.20 Wed Oct 20 13:53:59 2010
- couldn't parse the csv containing the column starting with '0'. (hiratara)
Modified: trunk/libtext-csv-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/MANIFEST?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/MANIFEST (original)
+++ trunk/libtext-csv-perl/MANIFEST Tue Dec 28 13:52:10 2010
@@ -20,6 +20,7 @@
t/45_eol.t Embedded EOL
t/46_eol_si.t Embedded EOL using scalar io (perlio)
t/50_utf8.t Unicode stress tests
+t/51_utf8.t Unicode IO encoding tests
t/55_combi.t Different CSV character combinations
t/60_samples.t Miscellaneous problems from the modules history.
t/65_allow.t Allow bad formats
@@ -27,9 +28,11 @@
t/71_pp.t Tests for bug report fixes or patches (for Text::CSV_PP)
t/75_hashref.t getline_hr related tests
t/76_magic.t array_ref from magig (useless for Text::CSV_PP)
+t/77_getall.t gat all rows at once
t/80_diag.t Error diagnostics
t/81_subclass.t Subclassed
+files/macosx.csv A CSV files exported on MacOSX
files/utf8.csv A UTF-8 encode test file
t/util.pl Extra test utilities
Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/META.yml?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Tue Dec 28 13:52:10 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Text-CSV
-version: 1.20
+version: 1.21
abstract: comma-separated values manipulator (using XS or PurePerl)
author:
- Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
Modified: trunk/libtext-csv-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/README?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/README (original)
+++ trunk/libtext-csv-perl/README Tue Dec 28 13:52:10 2010
@@ -1,4 +1,4 @@
-Text::CSV version 1.20
+Text::CSV version 1.21
========================
comma-separated values manipulator
Modified: trunk/libtext-csv-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/changelog?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Tue Dec 28 13:52:10 2010
@@ -1,8 +1,13 @@
-libtext-csv-perl (1.20-2) UNRELEASED; urgency=low
+libtext-csv-perl (1.21-1) UNRELEASED; urgency=low
+ [ Ansgar Burchardt ]
* Update my email address.
- -- Ansgar Burchardt <ansgar at debian.org> Mon, 01 Nov 2010 11:17:30 +0100
+ [ Salvatore Bonaccorso ]
+ * New upstream release
+ * Bump versioned Recommends on libtext-csv-xs-perl to (>= 0.80).
+
+ -- Salvatore Bonaccorso <carnil at debian.org> Tue, 28 Dec 2010 14:51:59 +0100
libtext-csv-perl (1.20-1) unstable; urgency=low
Modified: trunk/libtext-csv-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/control?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/control (original)
+++ trunk/libtext-csv-perl/debian/control Tue Dec 28 13:52:10 2010
@@ -17,7 +17,7 @@
Package: libtext-csv-perl
Architecture: all
Depends: ${misc:Depends}, ${perl:Depends}
-Recommends: libtext-csv-xs-perl (>= 0.74)
+Recommends: libtext-csv-xs-perl (>= 0.80)
Description: comma-separated values manipulator (using XS or PurePerl)
Text::CSV provides facilities for the composition and decomposition of files
containing comma-separated value records. An instance of the Text::CSV class
Modified: trunk/libtext-csv-perl/lib/Text/CSV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/lib/Text/CSV.pm?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV.pm Tue Dec 28 13:52:10 2010
@@ -6,14 +6,14 @@
use vars qw( $VERSION $DEBUG );
BEGIN {
- $VERSION = '1.20';
+ $VERSION = '1.21';
$DEBUG = 0;
}
# if use CSV_XS, requires version
my $Module_XS = 'Text::CSV_XS';
my $Module_PP = 'Text::CSV_PP';
-my $XS_Version = '0.74';
+my $XS_Version = '0.80';
my $Is_Dynamic = 0;
@@ -26,7 +26,7 @@
version types quote_char escape_char sep_char eol always_quote binary allow_whitespace
keep_meta_info allow_loose_quotes allow_loose_escapes verbatim meta_info is_quoted is_binary eof
getline print parse combine fields string error_diag error_input status blank_is_undef empty_is_undef
- getline_hr column_names bind_columns auto_diag quote_space quote_null
+ getline_hr column_names bind_columns auto_diag quote_space quote_null getline_all getline_hr_all
PV IV NV
/;
#
@@ -287,9 +287,9 @@
=head1 VERSION
- 1.20
-
-This module is compatible with Text::CSV_XS B<0.74> and later.
+ 1.21
+
+This module is compatible with Text::CSV_XS B<0.80> and later.
=head2 Embedded newlines
@@ -727,6 +727,30 @@
The I<$csv-E<gt>string ()>, I<$csv-E<gt>fields ()> and I<$csv-E<gt>status ()>
methods are meaningless, again.
+=head2 getline_all
+
+ $arrayref = $csv->getline_all ($io);
+ $arrayref = $csv->getline_all ($io, $offset);
+ $arrayref = $csv->getline_all ($io, $offset, $length);
+
+This will return a reference to a list of C<getline ($io)> results.
+In this call, C<keep_meta_info> is disabled. If C<$offset> is negative,
+as with C<splice ()>, only the last C<abs ($offset)> records of C<$io>
+are taken into consideration.
+
+Given a CSV file with 10 lines:
+
+ lines call
+ ----- ---------------------------------------------------------
+ 0..9 $csv->getline_all ($io) # all
+ 0..9 $csv->getline_all ($io, 0) # all
+ 8..9 $csv->getline_all ($io, 8) # start at 8
+ - $csv->getline_all ($io, 0, 0) # start at 0 first 0 rows
+ 0..4 $csv->getline_all ($io, 0, 5) # start at 0 first 5 rows
+ 4..5 $csv->getline_all ($io, 4, 2) # start at 4 first 2 rows
+ 8..9 $csv->getline_all ($io, -2) # last 2 rows
+ 6..7 $csv->getline_all ($io, -4, 2) # first 2 of last 4 rows
+
=head2 parse
$status = $csv->parse ($line);
@@ -753,6 +777,15 @@
C<getline_hr ()> will croak if called before C<column_names ()>.
+=head2 getline_hr_all
+
+ $arrayref = $csv->getline_hr_all ($io);
+ $arrayref = $csv->getline_hr_all ($io, $offset);
+ $arrayref = $csv->getline_hr_all ($io, $offset, $length);
+
+This will return a reference to a list of C<getline_hr ($io)> results.
+In this call, C<keep_meta_info> is disabled.
+
=head2 column_names
Set the keys that will be used in the C<getline_hr ()> calls. If no keys
Modified: trunk/libtext-csv-perl/lib/Text/CSV_PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/lib/Text/CSV_PP.pm?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/lib/Text/CSV_PP.pm (original)
+++ trunk/libtext-csv-perl/lib/Text/CSV_PP.pm Tue Dec 28 13:52:10 2010
@@ -11,7 +11,7 @@
use vars qw($VERSION);
use Carp ();
-$VERSION = '1.28';
+$VERSION = '1.29';
sub PV { 0 }
sub IV { 1 }
@@ -705,7 +705,38 @@
return [];
}
-
+################################################################################
+# getline_all
+################################################################################
+sub getline_all {
+ my ( $self, $io, $offset, $len ) = @_;
+ my @list;
+ my $tail;
+ my $n = 0;
+
+ $offset ||= 0;
+
+ if ( $offset < 0 ) {
+ $tail = -$offset;
+ $offset = 0;
+ }
+
+ while ( my $row = $self->getline($io) ) {
+ next if $offset && $offset-- > 0; # skip
+ last if defined $len && !$tail && $n >= $len; # exceedes limit size
+ push @list, $row;
+ ++$n;
+ if ( $tail && $n > $tail ) {
+ shift @list;
+ }
+ }
+
+ if ( $tail && defined $len && $n > $len ) {
+ @list = splice( @list, 0, $len);
+ }
+
+ return \@list;
+}
################################################################################
# getline_hr
################################################################################
@@ -722,6 +753,21 @@
@hr{ @{ $self->{_COLUMN_NAMES} } } = @$fr;
\%hr;
+}
+################################################################################
+# getline_hr_all
+################################################################################
+sub getline_hr_all {
+ my ( $self, $io, @args ) = @_;
+ my %hr;
+
+ unless ( $self->{_COLUMN_NAMES} ) {
+ $self->SetDiag( 3002 );
+ }
+
+ my @cn = @{$self->{_COLUMN_NAMES}};
+
+ return [ map { my %h; @h{ @cn } = @$_; \%h } @{ $self->getline_all( $io, @args ) } ];
}
################################################################################
# column_names
@@ -996,9 +1042,9 @@
=head1 VERSION
- 1.28
-
-This module is compatible with Text::CSV_XS B<0.74> and later.
+ 1.29
+
+This module is compatible with Text::CSV_XS B<0.80> and later.
=head2 Unicode (UTF8)
@@ -1377,6 +1423,30 @@
The I<$csv-E<gt>string ()>, I<$csv-E<gt>fields ()> and I<$csv-E<gt>status ()>
methods are meaningless, again.
+=head2 getline_all
+
+ $arrayref = $csv->getline_all ($io);
+ $arrayref = $csv->getline_all ($io, $offset);
+ $arrayref = $csv->getline_all ($io, $offset, $length);
+
+This will return a reference to a list of C<getline ($io)> results.
+In this call, C<keep_meta_info> is disabled. If C<$offset> is negative,
+as with C<splice ()>, only the last C<abs ($offset)> records of C<$io>
+are taken into consideration.
+
+Given a CSV file with 10 lines:
+
+ lines call
+ ----- ---------------------------------------------------------
+ 0..9 $csv->getline_all ($io) # all
+ 0..9 $csv->getline_all ($io, 0) # all
+ 8..9 $csv->getline_all ($io, 8) # start at 8
+ - $csv->getline_all ($io, 0, 0) # start at 0 first 0 rows
+ 0..4 $csv->getline_all ($io, 0, 5) # start at 0 first 5 rows
+ 4..5 $csv->getline_all ($io, 4, 2) # start at 4 first 2 rows
+ 8..9 $csv->getline_all ($io, -2) # last 2 rows
+ 6..7 $csv->getline_all ($io, -4, 2) # first 2 of last 4 rows
+
=head2 parse
$status = $csv->parse ($line);
@@ -1403,6 +1473,13 @@
C<getline_hr ()> will croak if called before C<column_names ()>.
+=head2 getline_hr_all
+
+ $arrayref = $csv->getline_hr_all ($io);
+
+This will return a reference to a list of C<getline_hr ($io)> results.
+In this call, C<keep_meta_info> is disabled.
+
=head2 column_names
Set the keys that will be used in the C<getline_hr ()> calls. If no keys
Modified: trunk/libtext-csv-perl/t/45_eol.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/45_eol.t?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/45_eol.t (original)
+++ trunk/libtext-csv-perl/t/45_eol.t Tue Dec 28 13:52:10 2010
@@ -3,7 +3,7 @@
use strict;
$^W = 1;
-use Test::More tests => 546;
+use Test::More tests => 1065;
BEGIN {
$ENV{PERL_TEXT_CSV} = 0;
@@ -43,7 +43,7 @@
"\"$eol\"", " \" $eol \"\n ", "EOL");
if ($pass == 0) {
- ok ($csv->combine (@f), "combine |$s_eol|");
+ ok ($csv->combine (@f), "combine |$s_eol|");
ok (my $str = $csv->string, "string |$s_eol|");
my $state = $csv->parse ($str);
ok ($state, "parse |$s_eol|");
@@ -112,7 +112,6 @@
}
$/ = $def_rs;
-
ok (1, "Auto-detecting \\r");
{ my @row = qw( a b c ); local $" = ",";
for (["\n", "\\n"], ["\r\n", "\\r\\n"], ["\r", "\\r"]) {
@@ -121,7 +120,6 @@
print FH qq{@row$eol at row$eol at row$eol\x91};
close FH;
open FH, "<_eol.csv";
-
my $c = Text::CSV->new ({ binary => 1, auto_diag => 1 });
is ($c->eol (), "", "default EOL");
is_deeply ($c->getline (*FH), [ @row ], "EOL 1 $s_eol");
@@ -156,7 +154,7 @@
ok (1, "EOL undef");
{ $/ = "\r";
- ok (my $csv = Text::CSV->new ({eol => undef }), "new csv with eol => undef");
+ ok (my $csv = Text::CSV->new ({ eol => undef }), "new csv with eol => undef");
open FH, ">_eol.csv";
ok ($csv->print (*FH, [1, 2, 3]), "print");
ok ($csv->print (*FH, [4, 5, 6]), "print");
@@ -171,8 +169,12 @@
}
$/ = $def_rs;
-foreach my $eol ("!", "!!", "!\n", "!\n!") {
+foreach my $eol ("!", "!!", "!\n", "!\n!", "!!!!!!!!", "!!!!!!!!!!",
+ "\n!!!!!\n!!!!!", "!!!!!\n!!!!!\n", "%^+_\n\0!X**",
+ "\r\n", "\r") {
(my $s_eol = $eol) =~ s/\n/\\n/g;
+ $s_eol =~ s/\r/\\r/g;
+ $s_eol =~ s/\0/\\0/g;
ok (1, "EOL $s_eol");
ok (my $csv = Text::CSV->new ({ eol => $eol }), "new csv with eol => $s_eol");
open FH, ">_eol.csv";
@@ -186,10 +188,10 @@
ok (1, "with RS $s_rs");
open FH, "<_eol.csv";
ok (my $row = $csv->getline (*FH), "getline 1");
- is (scalar @$row, 3, "# fields");
+ is (scalar @$row, 3, "field count");
is_deeply ($row, [ 1, 2, 3], "fields 1");
ok ( $row = $csv->getline (*FH), "getline 2");
- is (scalar @$row, 3, "# fields");
+ is (scalar @$row, 3, "field count");
is_deeply ($row, [ 4, 5, 6], "fields 2");
close FH;
}
@@ -197,4 +199,58 @@
}
$/ = $def_rs;
+{ open FH, "<files/macosx.csv" or die "Ouch $!";
+ ok (1, "MacOSX exported file");
+ ok (my $csv = Text::CSV->new ({ auto_diag => 1, binary => 1 }), "new csv");
+ diag ();
+ ok (my $row = $csv->getline (*FH), "getline 1");
+ is (scalar @$row, 15, "field count");
+ is ($row->[7], "", "field 8");
+ ok ( $row = $csv->getline (*FH), "getline 2");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Category", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 3");
+ is (scalar @$row, 15, "field count");
+ is ($row->[5], "Notes", "field 6");
+ ok ( $row = $csv->getline (*FH), "getline 4");
+ is (scalar @$row, 15, "field count");
+ is ($row->[7], "Points", "field 8");
+ ok ( $row = $csv->getline (*FH), "getline 5");
+ is (scalar @$row, 15, "field count");
+ is ($row->[7], 11, "field 8");
+ ok ( $row = $csv->getline (*FH), "getline 6");
+ is (scalar @$row, 15, "field count");
+ is ($row->[8], 34, "field 9");
+ ok ( $row = $csv->getline (*FH), "getline 7");
+ is (scalar @$row, 15, "field count");
+ is ($row->[7], 12, "field 8");
+ ok ( $row = $csv->getline (*FH), "getline 8");
+ is (scalar @$row, 15, "field count");
+ is ($row->[8], 2, "field 9");
+ ok ( $row = $csv->getline (*FH), "getline 9");
+ is (scalar @$row, 15, "field count");
+ is ($row->[3], "devs", "field 4");
+ ok ( $row = $csv->getline (*FH), "getline 10");
+ is (scalar @$row, 15, "field count");
+ is ($row->[3], "", "field 4");
+ ok ( $row = $csv->getline (*FH), "getline 11");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Mean", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 12");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Median", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 13");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Mode", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 14");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Min", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 15");
+ is (scalar @$row, 15, "field count");
+ is ($row->[6], "Max", "field 7");
+ ok ( $row = $csv->getline (*FH), "getline 16");
+ is (scalar @$row, 15, "field count");
+ is ($row->[0], "", "field 1");
+ }
+
1;
Modified: trunk/libtext-csv-perl/t/70_rt.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/70_rt.t?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/70_rt.t (original)
+++ trunk/libtext-csv-perl/t/70_rt.t Tue Dec 28 13:52:10 2010
@@ -4,12 +4,13 @@
$^W = 1;
#use Test::More "no_plan";
- use Test::More tests => 397;
+ use Test::More tests => 438;
BEGIN {
$ENV{PERL_TEXT_CSV} = 0;
use_ok "Text::CSV", ();
plan skip_all => "Cannot load Text::CSV" if $@;
+ require "t/util.pl";
}
my $csv_file = "_70test.csv";
@@ -280,6 +281,24 @@
unlink $csv_file;
}
+{ # Ruslan reported a case where only Text::CSV_PP misbehaved (regression test)
+ $rt = "x1001";
+ open FH, ">$csv_file";
+ print FH @{$input{$rt}};
+ close FH;
+ my ($c1, $c2);
+ ok (my $csv = Text::CSV->new (), "RT-$rt: $desc{$rt}");
+ open FH, "<$csv_file";
+ for (1 .. 4) {
+ ok (my $row = $csv->getline (*FH), "getline ($_)");
+ is (scalar @$row, 2, "Line $_: 2 columns");
+ my @exp = $_ <= 2 ? ("0", "A") : ("A", "0");
+ is_deeply ($row, \@exp, "@exp");
+ }
+ close FH;
+ unlink $csv_file;
+ }
+
{ # http://rt.cpan.org/Ticket/Display.html?id=58356
# 58356 - Incorrect CSV generated if "quote_space => 0"
$rt = "58356";
@@ -293,7 +312,10 @@
{ # http://rt.cpan.org/Ticket/Display.html?id=61525
$rt = "61525";
- foreach my $eol ("\n", "!") {
+ # First try with eol in constructor
+ foreach my $eol ("\n", "\r", "!") {
+ $/ = "\n";
+ my $s_eol = _readable ($eol);
ok (my $csv = Text::CSV->new ({
binary => 1,
sep_char => ":",
@@ -301,12 +323,39 @@
escape_char => '"',
eol => $eol,
auto_diag => 1,
- }), "RT-$rt: $desc{$rt}");
+ }), "RT-$rt: $desc{$rt} - eol = $s_eol (1)");
open FH, ">$csv_file";
print FH join $eol => qw( "a":"b" "c":"d" "e":"x!y" "!!":"z" );
close FH;
+ open FH, "<$csv_file";
+ is_deeply ($csv->getline (*FH), [ "a", "b" ], "Pair 1");
+ is_deeply ($csv->getline (*FH), [ "c", "d" ], "Pair 2");
+ is_deeply ($csv->getline (*FH), [ "e", "x!y" ], "Pair 3");
+ is_deeply ($csv->getline (*FH), [ "!!", "z" ], "Pair 4");
+ is ($csv->getline (*FH), undef, "no more pairs");
+ ok ($csv->eof, "EOF");
+ close FH;
+ unlink $csv_file;
+ }
+
+ # And secondly with eol as method only if not one of the defaults
+ foreach my $eol ("\n", "\r", "!") {
+ $/ = "\n";
+ my $s_eol = _readable ($eol);
+ ok (my $csv = Text::CSV->new ({
+ binary => 1,
+ sep_char => ":",
+ quote_char => '"',
+ escape_char => '"',
+ auto_diag => 1,
+ }), "RT-$rt: $desc{$rt} - eol = $s_eol (2)");
+ $eol eq "!" and $csv->eol ($eol);
+
+ open FH, ">$csv_file";
+ print FH join $eol => qw( "a":"b" "c":"d" "e":"x!y" "!!":"z" );
+ close FH;
open FH, "<$csv_file";
is_deeply ($csv->getline (*FH), [ "a", "b" ], "Pair 1");
is_deeply ($csv->getline (*FH), [ "c", "d" ], "Pair 2");
@@ -363,3 +412,8 @@
--------------090302050909040309030109--
«58356» - Incorrect CSV generated if "quote_space => 0"
«61525» - eol not working for values other than "\n"?
+«x1001» - Lines starting with "0" (Ruslan Dautkhanov)
+"0","A"
+"0","A"
+"A","0"
+"A","0"
Modified: trunk/libtext-csv-perl/t/80_diag.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/t/80_diag.t?rev=66556&op=diff
==============================================================================
--- trunk/libtext-csv-perl/t/80_diag.t (original)
+++ trunk/libtext-csv-perl/t/80_diag.t Tue Dec 28 13:52:10 2010
@@ -3,7 +3,7 @@
use strict;
$^W = 1;
- use Test::More tests => 99;
+ use Test::More tests => 124;
#use Test::More "no_plan";
my %err;
@@ -119,4 +119,29 @@
like ($@, qr '^# CSV_PP ERROR: 2027 -', "2 - error message");
}
+SKIP: {
+ skip "incompatible between PP and XS", 25;
+{ my @warn;
+ local $SIG{__WARN__} = sub { push @warn, @_ };
+ Text::CSV->new ()->_cache_diag ();
+ ok (@warn == 1, "Got warn");
+ is ($warn[0], "CACHE: invalid\n", "Uninitialized cache");
+ }
+
+my $diag_file = "_$$.out";
+open EH, ">&STDERR";
+open STDERR, ">$diag_file";
+ok ($csv->_cache_diag, "Cache debugging output");
+close STDERR;
+open STDERR, ">&EH";
+open EH, "<$diag_file";
+is (scalar <EH>, "CACHE:\n", "Title");
+while (<EH>) {
+ like ($_, qr{^ \w+\s+[0-9a-f]+:(?:".*"|\s*[0-9]+)$}, "Content");
+ }
+close EH;
+unlink $diag_file;
+
+}
+
1;
More information about the Pkg-perl-cvs-commits
mailing list