Bugzilla – Attachment 64091 Details for
Bug 18746
Text_CSV_Various.t parse failure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18746: Text_CSV_Various parse failures
Bug-18746-TextCSVVarious-parse-failures.patch (text/plain), 3.30 KB, created by
Mark Tompsett
on 2017-06-07 22:21:48 UTC
(
hide
)
Description:
Bug 18746: Text_CSV_Various parse failures
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-06-07 22:21:48 UTC
Size:
3.30 KB
patch
obsolete
>From 377b105afecda02cdca49c402a6e4fa140677f0a Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 7 Jun 2017 18:07:13 -0400 >Subject: [PATCH] Bug 18746: Text_CSV_Various parse failures > >While it might be an idea to just delete it, >this patch attempts to catch everything and make it >clear that Text::CSV::Unicode (binary) is the parser >that should be used. >--- > xt/author/Text_CSV_Various.t | 43 +++++++++++++++++++++++++++++++------------ > 1 file changed, 31 insertions(+), 12 deletions(-) > >diff --git a/xt/author/Text_CSV_Various.t b/xt/author/Text_CSV_Various.t >index a01f158..2ec49e0 100755 >--- a/xt/author/Text_CSV_Various.t >+++ b/xt/author/Text_CSV_Various.t >@@ -3,15 +3,16 @@ > use strict; > use warnings; > >-use Test::More tests => 25; >+use Test::More tests => 32; >+use Test::Warn; > BEGIN { >- diag " >-This test demonstrates why Koha uses the CSV parser and configration it does. >-Specifically, the test is for Unicode compliance in text parsing and data. >-This test requires other modules that Koha doesn't actually use, in order to compare. >-Therefore, running this test is not necessary to test your Koha installation. >- >-"; >+ diag q{ >+This test demonstrates why Koha uses the CSV parser and configration >+it does. Specifically, the test is for Unicode compliance in text >+parsing and data. This test requires other modules that Koha doesn't >+actually use, in order to compare. Therefore, running this test is not >+necessary to test your Koha installation. >+}; > use FindBin; > use lib $FindBin::Bin; > use_ok('Text::CSV'); >@@ -42,7 +43,9 @@ my $lines = [ > ]; > # 010D: Ä LATIN SMALL LETTER C WITH CARON > # 0117: Ä LATIN SMALL LETTER E WITH DOT ABOVE >-diag sprintf "Testing %d lines with %d parsers.", scalar(@$lines), scalar(keys %parsers); >+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"; >@@ -54,15 +57,31 @@ LINE: foreach (@$lines) { > foreach my $key (sort keys %parsers) { > my $parser = $parsers{$key}; > my ($status,$count,@fields); >- ok($status = $parser->parse($_->{line}), "parse ($key)"); >+ $status = $parser->parse($_->{line}); > if ($status) { >+ ok($status, "parse ($key)"); > @fields = $parser->fields; > ok(($count = scalar(@fields)) == 6, "Number of fields ($count of 6)"); > my $j = 0; > foreach my $f (@fields) { >- print "\t field " . ++$j . ": $f\n"; >+ ++$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"; >+ } > } > } >+ else { >+ ok(! $status, "parse ($key) fails as expected"); >+ } > } > } >-diag "done.\n"; >+done_testing(); >-- >2.1.4
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 18746
:
64091
|
64110
|
64130
|
64131