Bugzilla – Attachment 33503 Details for
Bug 13075
Use of uninitialized value while proving db_dependent/Holds.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 13075: Silence warnings and improve Charset testing.
SIGNED-OFF-Bug-13075-Silence-warnings-and-improve-.patch (text/plain), 2.61 KB, created by
Tomás Cohen Arazi (tcohen)
on 2014-11-12 23:43:13 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 13075: Silence warnings and improve Charset testing.
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2014-11-12 23:43:13 UTC
Size:
2.61 KB
patch
obsolete
>From 9d52c35ae4963ae4f2dbcc2515606b0a6140daf0 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Sat, 11 Oct 2014 20:02:35 -0400 >Subject: [PATCH] [SIGNED-OFF] Bug 13075: Silence warnings and improve Charset > testing. > >Calls to C4/Charset.pm's NormalizeString function with an >undefined string were triggering warnings when running: > prove -v t/db_dependent/Holds.t > >Sadly, t/Charset.t was also lacking calls to NormalizeString. > >TEST PLAN >--------- >1) prove -v t/db_dependent/Holds.t > -- This should generate the uninitialized string warnings. > Make sure CPL and MPL are in your branches to save > yourself from headaches due to expected data. >2) cat t/Charset.t > -- note there are no function calls to NormalizeString. > You can see other shortfalls in the tests beyond > NormalizeString with: grep ^sub C4/Charset.pm >3) prove -v t/Charset.t >4) Apply patch >5) prove -v t/Charset.t > -- Run as before with more tests. >6) cat t/Charset.t > -- note there are now function calls to NormalizeString. >7) prove -v t/db_dependent/Holds.t > -- Nice and clean run! :) >8) koha-qa.pl -v 2 -c 1 > -- all should be Ok. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > C4/Charset.pm | 1 + > t/Charset.t | 11 ++++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > >diff --git a/C4/Charset.pm b/C4/Charset.pm >index e43404b..4521262 100644 >--- a/C4/Charset.pm >+++ b/C4/Charset.pm >@@ -179,6 +179,7 @@ Sample code : > > sub NormalizeString{ > my ($string,$nfd,$transform)=@_; >+ return $string unless defined($string); # force scalar context return. > utf8::decode($string) unless (utf8::is_utf8($string)); > if ($nfd){ > $string= NFD($string); >diff --git a/t/Charset.t b/t/Charset.t >index cd0dc1e..6afc1e8 100755 >--- a/t/Charset.t >+++ b/t/Charset.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 11; >+use Test::More tests => 16; > use MARC::Record; > > use utf8; >@@ -27,6 +27,15 @@ BEGIN { > use_ok('C4::Charset'); > } > >+my $string; >+ok(!defined(NormalizeString($string,undef,1)),'Uninitialized string case 1 normalizes to uninitialized string.'); >+ >+$string = 'Sample'; >+ok(defined(NormalizeString($string,undef,0)), 'Initialized string case 1 normalizes to some string.'); >+ok(defined(NormalizeString($string,undef,1)), 'Initialized string case 2 normalizes to some string.'); >+ok(defined(NormalizeString($string,1,0)), 'Initialized string case 3 normalizes to some string.'); >+ok(defined(NormalizeString($string,1,1)), 'Initialized string case 4 normalizes to some string.'); >+ > my $octets = "abc"; > ok(IsStringUTF8ish($octets), "verify octets are valid UTF-8 (ASCII)"); > >-- >1.9.1
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 13075
:
32282
|
32326
|
32635
|
33503
|
33504
|
33505
|
33532
|
33533