Bugzilla – Attachment 140817 Details for
Bug 31590
Remove Text::CSV::Unicode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31590: Remove Text::CSV::Unicode
Bug-31590-Remove-TextCSVUnicode.patch (text/plain), 5.07 KB, created by
Marcel de Rooy
on 2022-09-21 12:59:39 UTC
(
hide
)
Description:
Bug 31590: Remove Text::CSV::Unicode
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-09-21 12:59:39 UTC
Size:
5.07 KB
patch
obsolete
>From e9f3d4de4105a16340a208c31b668de8f55006c5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 21 Sep 2022 12:46:45 +0000 >Subject: [PATCH] Bug 31590: Remove Text::CSV::Unicode >Content-Type: text/plain; charset=utf-8 > >This modules is really not needed. >The wide character test does not make much sense. Just use >encoding as you should. > >Test plan: >Run xt/author/Text_CSV_Various.t. >Check about page, perl modules. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > cpanfile | 1 - > tools/import_borrowers.pl | 4 --- > xt/author/Text_CSV_Various.t | 59 +++++++++++------------------------- > 3 files changed, 18 insertions(+), 46 deletions(-) > >diff --git a/cpanfile b/cpanfile >index 4d968838ba..d40bf7ff1c 100644 >--- a/cpanfile >+++ b/cpanfile >@@ -173,7 +173,6 @@ recommends 'Test::Strict', '0.14'; > recommends 'Test::WWW::Mechanize', '1.42'; > recommends 'Test::Warn', '0.21'; > recommends 'Test::YAML::Valid', '0.04'; >-recommends 'Text::CSV::Unicode', '0.40'; > recommends 'Text::Unidecode', '0.04'; > recommends 'Time::Fake', '0.11'; > recommends 'UNIVERSAL::require', '0.13'; >diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl >index 8e4fb5f40f..995801cb47 100755 >--- a/tools/import_borrowers.pl >+++ b/tools/import_borrowers.pl >@@ -52,10 +52,6 @@ my $Import = Koha::Patrons::Import->new(); > > use Text::CSV; > >-# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals: >-# Ä >-# Ä >- > use CGI qw ( -utf8 ); > > my $extended = C4::Context->preference('ExtendedPatronAttributes'); >diff --git a/xt/author/Text_CSV_Various.t b/xt/author/Text_CSV_Various.t >index 23b1f91db2..539234aefb 100755 >--- a/xt/author/Text_CSV_Various.t >+++ b/xt/author/Text_CSV_Various.t >@@ -21,25 +21,13 @@ > #necessary to test your Koha installation. > > use Modern::Perl; >+use open OUT=>':encoding(UTF-8)', ':std'; >+use utf8; > >-use Test::More; >-use Test::Warn; >- >+use Test::More tests => 21; > use Text::CSV; > use Text::CSV_XS; > >-use Module::Load::Conditional qw/check_install/; >- >-BEGIN { >- if ( check_install( module => 'Text::CSV::Unicode' ) ) { >- plan tests => 29; >- } else { >- plan skip_all => "Need Text::CSV::Unicode" >- } >-} >- >-use Text::CSV::Unicode; >- > sub pretty_line { > my $max = 54; > (@_) or return "#" x $max . "\n"; >@@ -50,7 +38,7 @@ sub pretty_line { > > my ($csv, $bin, %parsers); > >-foreach(qw(Text::CSV Text::CSV_XS Text::CSV::Unicode)) { >+foreach( qw( Text::CSV Text::CSV_XS )) { > ok($csv = $_->new(), $_ . '->new()'); > ok($bin = $_->new({binary=>1}), $_ . '->new({binary=>1})'); > $csv and $parsers{$_} = $csv; >@@ -61,47 +49,36 @@ my $lines = [ > {description=>"010D: LATIN SMALL LETTER C WITH CARON", character=>'Ä', line=>'field1,second field,field3,do_we_have_a_Ä_problem?, f!fth field ,lastfield'}, > {description=>"0117: LATIN SMALL LETTER E WITH DOT ABOVE", character=>'Ä', line=>'field1,second field,field3,do_we_have_a_Ä_problem?, f!fth field ,lastfield'}, > ]; >-# 010D: Ä LATIN SMALL LETTER C WITH CARON >-# 0117: Ä LATIN SMALL LETTER E WITH DOT ABOVE >+ > ok( scalar(keys %parsers)>0 && scalar(@$lines)>0, > sprintf "Testing %d lines with %d parsers.", > scalar(@$lines), scalar(keys %parsers) ); >+ > foreach my $key (sort keys %parsers) { > my $parser = $parsers{$key}; > print "Testing parser $key version " . ($parser->version||'?') . "\n"; > } >+ > my $i = 0; >-LINE: foreach (@$lines) { >+foreach my $line (@$lines) { > print pretty_line("Line " . ++$i); >- print pretty_line($_->{description} . ': ' . $_->{character}); >+ print pretty_line($line->{description} . ': ' . $line->{character}); > foreach my $key (sort keys %parsers) { > my $parser = $parsers{$key}; >- my ($status,$count,@fields); >- $status = $parser->parse($_->{line}); >- if ($status) { >+ my ($status, $count, @fields); >+ $status = $parser->parse( $line->{line} ); >+ if( $status ) { > ok($status, "parse ($key)"); > @fields = $parser->fields; >- ok(($count = scalar(@fields)) == 6, "Number of fields ($count of 6)"); >+ $count = scalar(@fields); >+ is( $count, 6, "Number of fields ($count of 6)"); > my $j = 0; > foreach my $f (@fields) { >- ++$j; >- if ($j==4) { >- if ($key ne 'Text::CSV::Unicode (binary)') { >- warning_like { >- print "\t field " . $j . ": $f\n" >- } [ qr/Wide character in print/ ], 'Expected wide print'; >- } else { >- print "\t field " . $j . ": $f\n" >- } >- } >- else { >- print "\t field " . $j . ": $f\n"; >- } >+ $j++; >+ print "\t field $j: $f\n"; > } >- } >- else { >- ok(! $status, "parse ($key) fails as expected"); >+ } else { >+ ok(! $status, "parse ($key) fails as expected"); #FIXME We never hit this line > } > } > } >-done_testing(); >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31590
:
140817
|
140830