[libdbd-sqlite3-perl] 17/43: compare perl_match and db_match

Salvatore Bonaccorso carnil at debian.org
Tue Nov 15 15:27:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

carnil pushed a commit to branch master
in repository libdbd-sqlite3-perl.

commit c716e6b56a6409e0ac77d8f999615760485c54f0
Author: Kenichi Ishigaki <ishigaki at cpan.org>
Date:   Sat Feb 20 10:43:33 2016 +0900

    compare perl_match and db_match
---
 t/62_regexp_multibyte_char_class.t | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/t/62_regexp_multibyte_char_class.t b/t/62_regexp_multibyte_char_class.t
index 8c4b685..103d88e 100644
--- a/t/62_regexp_multibyte_char_class.t
+++ b/t/62_regexp_multibyte_char_class.t
@@ -12,9 +12,6 @@ BEGIN {
 	if ($] < 5.008005) {
 		plan skip_all => 'Unicode is not supported before 5.8.5';
 	}
-    if (!eval "require Encode; 1") {
-		plan skip_all => 'requires Encode for this test';
-    }
 }
 use Test::NoWarnings;
 
@@ -37,9 +34,10 @@ foreach my $call_func (@CALL_FUNCS) {
     my @vals = @words;
     my $re = $regex;
     if ($use_unicode) {
-      @vals = map {Encode::decode_utf8($_)} @vals;
-      $re = Encode::decode_utf8($re);
+      utf8::decode($_) foreach @vals;
+      utf8::decode($re);
     }
+    my @perl_match = grep {$_ =~ /$re/} @vals;
 
     $dbh->do( 'CREATE TEMP TABLE regexp_test ( txt )' );
     $dbh->do( "INSERT INTO regexp_test VALUES ( '$_' )" ) foreach @vals;
@@ -47,13 +45,9 @@ foreach my $call_func (@CALL_FUNCS) {
     my $sql = "SELECT txt from regexp_test WHERE txt REGEXP '$re' ";
     my $db_match = $dbh->selectcol_arrayref($sql);
 
-    if ($use_unicode) {
-      is @$db_match => 2;
-      note explain $db_match;
-    } else {
-      is @$db_match => 0;
-      note explain $db_match;
-    }
+    is_deeply \@perl_match => $db_match;
+    note explain \@perl_match;
+    note explain $db_match;
   }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-sqlite3-perl.git



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