r54578 - in /branches/upstream/libtext-csv-perl/current: Changes META.yml lib/Text/CSV.pm lib/Text/CSV_PP.pm t/12_acc.t t/41_null.t t/70_rt.t t/80_diag.t

franck at users.alioth.debian.org franck at users.alioth.debian.org
Fri Mar 19 18:02:58 UTC 2010


Author: franck
Date: Fri Mar 19 18:02:11 2010
New Revision: 54578

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54578
Log:
[svn-upgrade] Integrating new upstream version, libtext-csv-perl (1.17)

Modified:
    branches/upstream/libtext-csv-perl/current/Changes
    branches/upstream/libtext-csv-perl/current/META.yml
    branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm
    branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm
    branches/upstream/libtext-csv-perl/current/t/12_acc.t
    branches/upstream/libtext-csv-perl/current/t/41_null.t
    branches/upstream/libtext-csv-perl/current/t/70_rt.t
    branches/upstream/libtext-csv-perl/current/t/80_diag.t

Modified: branches/upstream/libtext-csv-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/Changes?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/Changes (original)
+++ branches/upstream/libtext-csv-perl/current/Changes Fri Mar 19 18:02:11 2010
@@ -1,4 +1,11 @@
 Revision history for Perl extension Text::CSV.
+
+1.17  Tue Mar 16 15:20:34 2010
+	- fixed parse working when setting quote_char undef.
+	- made Text::CSV_XS compat 0.71
+	    * Text::CSV->error_diag() in void context warns instead of doing nothing
+	    * auto_diag also used for new () itself
+	- added quote_null (introduced in Text::CSV_XS 0.72)
 
 1.16  Tue Dec  8 19:02:58 2009
 	- updated the compatibility for Text::CSV_XS version 0.70

Modified: branches/upstream/libtext-csv-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/META.yml?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/META.yml (original)
+++ branches/upstream/libtext-csv-perl/current/META.yml Fri Mar 19 18:02:11 2010
@@ -1,12 +1,14 @@
 --- #YAML:1.0
 name:               Text-CSV
-version:            1.16
+version:            1.17
 abstract:           comma-separated values manipulator (using XS or PurePerl)
 author:
     - Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
 license:            perl
 distribution_type:  module
 configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
     ExtUtils::MakeMaker:  0
 requires:
     IO::Handle:     0
@@ -16,7 +18,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
+generated_by:       ExtUtils::MakeMaker version 6.54
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm (original)
+++ branches/upstream/libtext-csv-perl/current/lib/Text/CSV.pm Fri Mar 19 18:02:11 2010
@@ -3,16 +3,17 @@
 
 use strict;
 use Carp ();
+use vars qw( $VERSION $DEBUG );
 
 BEGIN {
-    $Text::CSV::VERSION = '1.16';
-    $Text::CSV::DEBUG   = 0;
+    $VERSION = '1.17';
+    $DEBUG   = 0;
 }
 
 # if use CSV_XS, requires version
 my $Module_XS  = 'Text::CSV_XS';
 my $Module_PP  = 'Text::CSV_PP';
-my $XS_Version = '0.70';
+my $XS_Version = '0.72';
 
 my $Is_Dynamic = 0;
 
@@ -25,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
+    getline_hr column_names bind_columns auto_diag quote_space quote_null
     PV IV NV
 /;
 #
@@ -286,9 +287,9 @@
 
 =head1 VERSION
 
-    1.16
-
-This module is compatible with Text::CSV_XS B<0.70> and later.
+    1.17
+
+This module is compatible with Text::CSV_XS B<0.72> and later.
 
 =head2 Embedded newlines
 
@@ -528,7 +529,7 @@
 If a string is marked UTF8, binary will be turned on automatically when
 binary characters other than CR or NL are encountered. Note that a simple
 string like C<"\x{00a0}"> might still be binary, but not marked UTF8, so
-setting C<{ binary => 1 }> is still a wise option.
+setting C<{ binary =E<gt> 1 }> is still a wise option.
 
 =item types
 
@@ -550,6 +551,13 @@
 exists this to be forced in CSV, nor any for the opposite, the default
 is true for safety. You can exclude the space from this trigger by
 setting this option to 0.
+
+=item quote_null
+
+By default, a NULL byte in a field would be escaped. This attribute
+enables you to treat the NULL byte as a simple binary character in
+binary mode (the C<{ binary =E<gt> 1 }> is set). The default is true.
+You can prevent NULL escapes by setting this attribute to 0.
 
 =item keep_meta_info
 
@@ -619,6 +627,7 @@
      eol                 => $\,
      always_quote        => 0,
      quote_space         => 1,
+     quote_null          => 1,
      binary              => 0,
      keep_meta_info      => 0,
      allow_loose_quotes  => 0,
@@ -1081,12 +1090,12 @@
 
 Text::CSV_PP:
 
-Copyright (C) 2005-2009 Makamaka Hannyaharamitu.
+Copyright (C) 2005-2010 Makamaka Hannyaharamitu.
 
 
 Text:CSV_XS:
 
-Copyright (C) 2007-2009 H.Merijn Brand for PROCURA B.V.
+Copyright (C) 2007-2010 H.Merijn Brand for PROCURA B.V.
 Copyright (C) 1998-2001 Jochen Wiedmann. All rights reserved.
 Portions Copyright (C) 1997 Alan Citterman. All rights reserved.
 

Modified: branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm (original)
+++ branches/upstream/libtext-csv-perl/current/lib/Text/CSV_PP.pm Fri Mar 19 18:02:11 2010
@@ -11,7 +11,7 @@
 use vars qw($VERSION);
 use Carp ();
 
-$VERSION = '1.24';
+$VERSION = '1.25';
 
 sub PV  { 0 }
 sub IV  { 1 }
@@ -86,6 +86,7 @@
     empty_is_undef      => 0,
     auto_diag           => 0,
     quote_space         => 1,
+    quote_null          => 1,
 
     _EOF                => 0,
     _STATUS             => undef,
@@ -176,6 +177,7 @@
     for my $prop (keys %$attr) { # if invalid attr, return undef
         unless ($prop =~ /^[a-z]/ && exists $def_attr{$prop}) {
             $last_new_error = "INI - Unknown attribute '$prop'";
+            error_diag() if $attr->{ auto_diag };
             return;
         }
         $self->{$prop} = $attr->{$prop};
@@ -190,21 +192,6 @@
         #$class->SetDiag ($ec);
     }
 
-
-=pod
-
-    if ( $self->{allow_whitespace} and
-           ( defined $self->{quote_char}  && $self->{quote_char}  =~ m/^[ \t]$/ ) 
-           ||
-           ( defined $self->{escape_char} && $self->{escape_char} =~ m/^[ \t]$/ )
-    ) {
-       $last_new_error = "INI - allow_whitespace with escape_char or quote_char SP or TAB";
-       $last_new_err_num = 1002;
-       return;
-    }
-
-=cut
-
     $last_new_error = '';
 
     defined $\ and $self->{eol} = $\;
@@ -249,7 +236,8 @@
     unless (defined $context) { # Void context
         if ( $diag[0] ) {
             my $msg = "# CSV_PP ERROR: " . $diag[0] . " - $diag[1]\n";
-            $self->{auto_diag} > 1 ? die $msg : warn $msg;
+            ref $self ? ( $self->{auto_diag} > 1 ? die $msg : warn $msg )
+                      : warn $msg;
         }
         return;
     }
@@ -285,15 +273,14 @@
     $self->{_STRING}      = '';
     $self->{_STATUS}      = 0;
 
-    my ($always_quote, $binary, $quot, $sep, $esc, $empty_is_undef, $quote_space)
-            = @{$self}{qw/always_quote binary quote_char sep_char escape_char empty_is_undef quote_space/};
+    my ($always_quote, $binary, $quot, $sep, $esc, $empty_is_undef, $quote_space, $quote_null)
+            = @{$self}{qw/always_quote binary quote_char sep_char escape_char empty_is_undef quote_space quote_null/};
 
     if(!defined $quot){ $quot = ''; }
 
     return $self->_set_error_diag(1001) if ($sep eq $esc or $sep eq $quot);
 
     my $re_esc = $self->{_re_comb_escape}->{$quot}->{$esc} ||= qr/(\Q$quot\E|\Q$esc\E)/;
-#    my $re_sp  = $self->{_re_comb_sp}->{$sep}              ||= qr/[\s\Q$sep\E]/;
     my $re_sp  = $self->{_re_comb_sp}->{$sep}->{$quote_space} ||= ( $quote_space ? qr/[\s\Q$sep\E]/ : qr/[\Q$sep\E]/ );
 
     my $must_be_quoted;
@@ -323,14 +310,11 @@
             $must_be_quoted++ if $quote_space;
         }
 
-        if($binary){
+        if( $binary and $quote_null ){
             use bytes;
             $must_be_quoted++ if ( $column =~ s/\0/${esc}0/g || $column =~ /[\x00-\x1f\x7f-\xa0]/ );
         }
 
-        #if ( $empty_is_undef and defined $column and not length $column ) {
-        #}
-        #elsif($always_quote or $must_be_quoted){
         if($always_quote or $must_be_quoted){
             $column = $quot . $column . $quot;
         }
@@ -361,9 +345,11 @@
             qw/binary quote_char sep_char escape_char types keep_meta_info allow_whitespace eol blank_is_undef empty_is_undef/
            };
 
-    $sep  = "\0" unless (defined $sep);
+    $sep  = ',' unless (defined $sep);
     $esc  = "\0" unless (defined $esc);
-    $quot = ''   unless (defined $quot);
+    $quot = "\0" unless (defined $quot);
+
+    my $quot_is_null = $quot eq "\0"; # in this case, any fields are not interpreted as quoted data.
 
     return $self->_set_error_diag(1001) if (($sep eq $esc or $sep eq $quot) and $sep ne "\0");
 
@@ -418,7 +404,7 @@
         $pos += length $col;
 
         if ( ( !$binary and !$utf8 ) and $col =~ /[^\x09\x20-\x7E]/) { # Binary character, binary off
-            if ( $col =~ $re_quoted ) {
+            if ( not $quot_is_null and $col =~ $re_quoted ) {
                 $self->_set_error_diag(
                       $col =~ /\n([^\n]*)/ ? (2021, $pos - 1 - length $1)
                     : $col =~ /\r([^\r]*)/ ? (2022, $pos - 1 - length $1)
@@ -444,16 +430,17 @@
             last;
         }
 
-        if ($col =~ $re_quoted) {
+        if ( not $quot_is_null and $col =~ $re_quoted ) {
             $flag |= IS_QUOTED if ($keep_meta_info);
             $col = $1;
 
-            my $flga_in_quot_esp;
+            my $flag_in_quot_esp;
             while ( $col =~ /$re_in_quot_esp1/g ) {
                 my $str = $1;
-                $flga_in_quot_esp = 1;
+                $flag_in_quot_esp = 1;
 
                 if ($str !~ $re_in_quot_esp2) {
+
                     unless ($self->{allow_loose_escapes}) {
                         $self->_set_error_diag( 2025, $pos - 2 ); # Needless ESC in quoted field
                         $palatable = 0;
@@ -468,7 +455,7 @@
 
             last unless ( $palatable );
 
-            unless ( $flga_in_quot_esp ) {
+            unless ( $flag_in_quot_esp ) {
                 if ($col =~ /(?<!\Q$esc\E)\Q$esc\E/) {
                     $self->_set_error_diag( 4002, $pos - 1 ); # No escaped ESC in quoted field
                     $palatable = 0;
@@ -490,7 +477,7 @@
 
         # quoted but invalid
 
-        elsif ($col =~ $re_invalid_quot) {
+        elsif ( not $quot_is_null and $col =~ $re_invalid_quot ) {
 
             unless ($self->{allow_loose_quotes} and $col =~ /$re_quot_char/) {
                 $self->_set_error_diag(
@@ -633,7 +620,7 @@
 
     my $quot = $self->{quote_char};
     my $sep  = $self->{sep_char};
-    my $re   = qr/(?:\Q$quot\E)/;
+    my $re   = defined $quot ? qr/(?:\Q$quot\E)/ : '';
 
     local $/ = "\r" if $self->{_AUTO_DETECT_CR};
 
@@ -847,7 +834,7 @@
 
 BEGIN {
     for my $method ( qw/always_quote binary keep_meta_info allow_loose_quotes allow_loose_escapes
-                            verbatim blank_is_undef empty_is_undef auto_diag quote_space/ ) {
+                            verbatim blank_is_undef empty_is_undef auto_diag quote_space quote_null/ ) {
         eval qq|
             sub $method {
                 \$_[0]->{$method} = defined \$_[1] ? \$_[1] : 0 if (\@_ > 1);
@@ -1186,7 +1173,7 @@
 If a string is marked UTF8, binary will be turned on automatically when
 binary characters other than CR or NL are encountered. Note that a simple
 string like C<"\x{00a0}"> might still be binary, but not marked UTF8, so
-setting C<{ binary => 1 }> is still a wise option.
+setting C<{ binary =E<gt> 1 }> is still a wise option.
 
 =item types
 
@@ -1208,6 +1195,13 @@
 exists this to be forced in CSV, nor any for the opposite, the default
 is true for safety. You can exclude the space from this trigger by
 setting this option to 0.
+
+=item quote_null
+
+By default, a NULL byte in a field would be escaped. This attribute
+enables you to treat the NULL byte as a simple binary character in
+binary mode (the C<{ binary =E<gt> 1 }> is set). The default is true.
+You can prevent NULL escapes by setting this attribute to 0.
 
 =item keep_meta_info
 
@@ -1277,6 +1271,7 @@
      eol                 => $\,
      always_quote        => 0,
      quote_space         => 1,
+     quote_null          => 1,
      binary              => 0,
      keep_meta_info      => 0,
      allow_loose_quotes  => 0,
@@ -1677,7 +1672,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2005-2009 by Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+Copyright 2005-2010 by Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 

Modified: branches/upstream/libtext-csv-perl/current/t/12_acc.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/t/12_acc.t?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/t/12_acc.t (original)
+++ branches/upstream/libtext-csv-perl/current/t/12_acc.t Fri Mar 19 18:02:11 2010
@@ -3,13 +3,13 @@
 use strict;
 $^W = 1;	# use warnings core since 5.6
 
-use Test::More tests => 107;
+use Test::More tests => 113;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
     use_ok "Text::CSV";
     plan skip_all => "Cannot load Text::CSV" if $@;
-}
+    }
 
 my $csv;
 ok ($csv = Text::CSV->new,				"new ()");
@@ -28,6 +28,8 @@
 is ($csv->empty_is_undef,		0,		"empty_is_undef");
 is ($csv->auto_diag,			0,		"auto_diag");
 is ($csv->verbatim,			0,		"verbatim");
+is ($csv->quote_space,			1,		"quote_space");
+is ($csv->quote_null,			1,		"quote_null");
 
 is ($csv->binary (1),			1,		"binary (1)");
 my @fld = ( 'txt =, "Hi!"', "Yes", "", 2, undef, "1.09", "\r", undef );
@@ -50,10 +52,15 @@
 is ($csv->empty_is_undef (1),		1,		"empty_is_undef (1)");
 is ($csv->auto_diag (1),		1,		"auto_diag (1)");
 is ($csv->verbatim (1),			1,		"verbatim (1)");
+is ($csv->quote_space (1),		1,		"quote_space (1)");
+is ($csv->quote_null (1),		1,		"quote_null (1)");
 is ($csv->escape_char ("\\"),		"\\",		"escape_char (\\)");
 ok ($csv->combine (@fld),				"combine");
 is ($csv->string,
     qq{=txt \\=, "Hi!"=;=Yes=;==;=2=;;=1.09=;=\r=;\r},	"string");
+
+is ($csv->quote_space (0),		0,		"quote_space (1)");
+is ($csv->quote_null (0),		0,		"quote_null (1)");
 
 # Funny settings, all three translate to \0 internally
 ok ($csv = Text::CSV->new ({
@@ -94,7 +101,7 @@
     allow_whitespace => 1,
     }) };
 like ((Text::CSV::error_diag)[1], qr{^INI - allow_whitespace}, "Wrong combo - error message");
-is   ( (Text::CSV::error_diag)[0], 1002, "Wrong combo - numeric error");
+is   ((Text::CSV::error_diag)[0], 1002, "Wrong combo - numeric error");
 
 # Test 1003 in constructor
 foreach my $x ("\r", "\n", "\r\n", "x\n", "\rx") {
@@ -110,9 +117,7 @@
     is (($csv->error_diag)[0], 1003, "not allowed");
     }
 
-
 # And test erroneous calls
-
 is (Text::CSV::new (0),		   undef,	"new () as function");
 is (Text::CSV::error_diag () . '', "usage: my \$csv = Text::CSV_PP->new ([{ option => value, ... }]);",
 							"Generic usage () message");
@@ -124,7 +129,6 @@
 foreach my $arg (undef, 0, "", " ", 1, [], [ 0 ], *STDOUT) {
     is  (Text::CSV->new ($arg),         undef,	"Illegal type for first arg");
     is ((Text::CSV::error_diag)[0], 1000, "Should be a hashref - numeric error");
-}
-
+    }
 
 1;

Modified: branches/upstream/libtext-csv-perl/current/t/41_null.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/t/41_null.t?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/t/41_null.t (original)
+++ branches/upstream/libtext-csv-perl/current/t/41_null.t Fri Mar 19 18:02:11 2010
@@ -3,15 +3,14 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 62;
+use Test::More tests => 128;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
-}
+    plan skip_all => "Cannot load Text::CSV" if $@;
+    }
 
 use Text::CSV;
-
-plan skip_all => "Cannot load Text::CSV" if Text::CSV->backend ne 'Text::CSV_PP';
 
 my @pat = (
     "00", 
@@ -45,6 +44,7 @@
     $x =~ s/\n/\\n/g;
     ($_ => $x);
     } @pat;
+my $line = ["", undef, "0\n", "", "\0\0\n0"];
 
 my $csv = Text::CSV->new ({
     eol			=> "\n",
@@ -52,6 +52,9 @@
     auto_diag		=> 1,
     blank_is_undef	=> 1,
     });
+
+ok ($csv->combine (@$line), "combine [ ... ]");
+is ($csv->string, qq{,,"0\n",,""0"0\n0"\n}, "string");
 
 open FH, ">__test.csv" or die $!;
 binmode FH;
@@ -62,7 +65,6 @@
 
 $csv->always_quote (1);
 
-my $line = ["", undef, "0\n", "", "\0\n0"];
 ok ($csv->print (*FH, $line), "print [ ... ]");
 
 close FH;
@@ -75,10 +77,46 @@
     is ($row->[0], $pat, "data $exp{$pat}");
     }
 
-my $row = $csv->getline (*FH);
-
-is_deeply ($row, $line, "read [ ... ]");
+is_deeply ($csv->getline (*FH), $line, "read [ ... ]");
 
 close FH;
 
 unlink "__test.csv";
+
+$csv = Text::CSV->new ({
+    eol			=> "\n",
+    binary		=> 1,
+    auto_diag		=> 1,
+    blank_is_undef	=> 1,
+    quote_null		=> 0,
+    });
+
+ok ($csv->combine (@$line), "combine [ ... ]");
+is ($csv->string, qq{,,"0\n",,"\0\0\n0"\n}, "string");
+
+open FH, ">__test.csv" or die $!;
+binmode FH;
+
+for (@pat) {
+    ok ($csv->print (*FH, [ $_ ]), "print $exp{$_}");
+    }
+
+$csv->always_quote (1);
+
+ok ($csv->print (*FH, $line), "print [ ... ]");
+
+close FH;
+
+open FH, "<__test.csv" or die $!;
+binmode FH;
+
+foreach my $pat (@pat) {
+    ok (my $row = $csv->getline (*FH), "getline $exp{$pat}");
+    is ($row->[0], $pat, "data $exp{$pat}");
+    }
+
+is_deeply ($csv->getline (*FH), $line, "read [ ... ]");
+
+close FH;
+
+unlink "__test.csv";

Modified: branches/upstream/libtext-csv-perl/current/t/70_rt.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/t/70_rt.t?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/t/70_rt.t (original)
+++ branches/upstream/libtext-csv-perl/current/t/70_rt.t Fri Mar 19 18:02:11 2010
@@ -3,13 +3,11 @@
 use strict;
 $^W = 1;
 
-BEGIN { $ENV{PERL_TEXT_CSV} = 0; }
-
-
 #use Test::More "no_plan";
- use Test::More tests => 367;
+ use Test::More tests => 380;
 
 BEGIN {
+    $ENV{PERL_TEXT_CSV} = 0;
     use_ok "Text::CSV", ();
     plan skip_all => "Cannot load Text::CSV" if $@;
     }
@@ -19,7 +17,7 @@
 
 my ($rt, %input, %desc);
 while (<DATA>) {
-    if (s/^«(\d+)»\s*-?\s*//) {
+    if (s/^«(x?[0-9]+)»\s*-?\s*//) {
 	chomp;
 	$rt = $1;
 	$desc{$rt} = $_;
@@ -158,8 +156,8 @@
     my @diag = $csv->error_diag;
 #    is ($diag[0], 2023,			"Error 2023");
 #    is ($diag[2],   23,			"Position 23");
-    is ($diag[0], 2025,			"Error 2025 but 2023 in XS");
-    is ($diag[2],   24,			"Position 24 but 23 in XS");
+    is ($diag[0], 2025,                        "Error 2025 but 2023 in XS");
+    is ($diag[2],   24,                        "Position 24 but 23 in XS");
     $csv->allow_loose_escapes (1);
     ok ($csv->parse ($str),		"parse () badly escaped NULL");
     }
@@ -254,6 +252,35 @@
 
 	ok ($csv->parse ("  \t  \t  "), "parse ()");
 	is_deeply ([$csv->fields],["","",""],"3 empty fields");
+	}
+    }
+
+{   # Detlev reported an inconsistent difference between _XS and _PP
+    $rt = "x1000";
+    SKIP: {
+	open  FH, ">$csv_file";
+	print FH @{$input{$rt}};
+	close FH;
+	my ($c1, $c2);
+	ok (my $csv = Text::CSV->new ({
+	    binary      => 1, 
+	    eol         => "\n", 
+	    sep_char    => "\t",
+	    escape_char => undef,
+	    quote_char  => undef,
+	    binary => 1 }), "RT-$rt: $desc{$rt}");
+	open  FH, "<$csv_file";
+	for (1 .. 4) {
+	    ok (my $row = $csv->getline (*FH), "getline ()");
+	    is (scalar @$row, 27, "Line $_: 27 columns");
+	    }
+	for (5 .. 6) {
+	    ok (my $row = $csv->getline (*FH), "getline ()");
+	    is (scalar @$row,  1, "Line $_:  1 column");
+	    }
+	$csv->error_diag ();
+	close FH;
+	unlink $csv_file;
 	}
     }
 
@@ -292,3 +319,10 @@
 «43927» - Is bind_columns broken or am I using it wrong?
 1,2
 «44402» - Unexpected results parsing tab-separated spaces
+«x1000» - Detlev reported inconsisten behavior between XS and PP
+B:033_02_	-drop, +drop	animal legs	@p 02-033.bmp	@p 02-033.bmp				\x{A}		1	:c/b01:!1	!	13	!6.!6			:b/b01:0						B:033_02_	R#012a	2	
+B:034_02c	diagonal, trac	-bound up	@p 02-034c.bmp	@p 02-034c.bmp			Found through e_sect2.pdf as U+F824 ( ,) and U+2E88 (⺈,) but won't display	\x{A}		1	:c/b01:!1	!	11	!10			:b/b01:0				2E88		B:034_02c	R#018b	2	
+B:035_02_	+drop, -drop	fission	丷				Aufgrund folgender Fälle definiere ich einen neuen Baustein, der simp. mit "horns&" identisch ist.\x{A}隊队 (jap.: pinnacle, horns&sow)\x{A}曾曾å
Ό
‘\x{A}über "golden calf":\x{A}送送			1	:c/b01:!1	!	11	!10			:b/b01:0				4E37		B:035_02_		2	
+B:035_03_	fission, one	horns	@p 03-035.bmp	@p 03-035.bmp			obsolete Heising explanation for form without the horizontal line: Variante von "horns", die erscheint, wenn darunter keine horizontale Linie steht\x{A}\x{A}Found through e_sect2.pdf as U+F7EA (??,) but won't display	\x{A}		1	:c/b01:!1	!	11	!10			:b/b01:0						B:035_03_		3	
+
+--------------090302050909040309030109--

Modified: branches/upstream/libtext-csv-perl/current/t/80_diag.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-perl/current/t/80_diag.t?rev=54578&op=diff
==============================================================================
--- branches/upstream/libtext-csv-perl/current/t/80_diag.t (original)
+++ branches/upstream/libtext-csv-perl/current/t/80_diag.t Fri Mar 19 18:02:11 2010
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;
 
- use Test::More tests => 90;
+ use Test::More tests => 99;
 #use Test::More "no_plan";
 
 my %err;
@@ -69,6 +69,33 @@
 
 is (Text::CSV->new ({ ecs_char => ":" }), undef, "Unsupported option");
 
+{   my @warn;
+    local $SIG{__WARN__} = sub { push @warn, @_ };
+    Text::CSV::error_diag ();
+    ok (@warn == 1, "Error_diag in void context ::");
+    like ($warn[0], qr{^# CSV_PP ERROR: 1000 - INI}, "error content");
+    }
+{   my @warn;
+    local $SIG{__WARN__} = sub { push @warn, @_ };
+    Text::CSV->error_diag ();
+    ok (@warn == 1, "Error_diag in void context ->");
+    like ($warn[0], qr{^# CSV_PP ERROR: 1000 - INI}, "error content");
+    }
+
+{   my @warn;
+    local $SIG{__WARN__} = sub { push @warn, @_ };
+    is (Text::CSV->new ({ auto_diag => 0, ecs_char => ":" }), undef,
+       "Unsupported option");
+    ok (@warn == 0, "Error_diag in from new ({ auto_diag => 0})");
+    }
+{   my @warn;
+    local $SIG{__WARN__} = sub { push @warn, @_ };
+    is (Text::CSV->new ({ auto_diag => 1, ecs_char => ":" }), undef,
+       "Unsupported option");
+    ok (@warn == 1, "Error_diag in from new ({ auto_diag => 1})");
+    like ($warn[0], qr{^# CSV_PP ERROR: 1000 - INI}, "error content");
+    }
+
 is (Text::CSV::error_diag() . '', "INI - Unknown attribute 'ecs_char'",
 					"Last failure for new () - FAIL");
 is (Text::CSV->error_diag() . '', "INI - Unknown attribute 'ecs_char'",




More information about the Pkg-perl-cvs-commits mailing list