mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
fix RT#99747 - skip tests if Unicode::UCD is not installed
This commit is contained in:
parent
e18172fb91
commit
704c2d2d3c
1 changed files with 15 additions and 6 deletions
|
@ -10,13 +10,22 @@ BEGIN {
|
|||
|
||||
use t::lib::Test qw/connect_ok/;
|
||||
use Test::More;
|
||||
use Test::NoWarnings;
|
||||
|
||||
use Unicode::UCD 'charinfo';
|
||||
BEGIN {
|
||||
# check for old Perls which did not have Unicode::UCD in core
|
||||
if (eval "use Unicode::UCD 'charinfo'; 1") {
|
||||
plan tests => 10;
|
||||
}
|
||||
else {
|
||||
plan skip_all => "Unicode::UCD does not seem to be installed";
|
||||
}
|
||||
}
|
||||
|
||||
use Test::NoWarnings;
|
||||
|
||||
our $chars = [map {charinfo($_)} 0x300..0x400];
|
||||
|
||||
plan tests => 10;
|
||||
my $sigma_block = charinfo(0x3A3)->{block};
|
||||
|
||||
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 1 );
|
||||
|
||||
|
@ -31,14 +40,14 @@ ok $dbh->do(<<""), "create table";
|
|||
my $sql = "SELECT * FROM charinfo WHERE script='Greek' AND name LIKE '%SIGMA%'";
|
||||
my $res = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
ok scalar(@$res), "found sigma letters";
|
||||
is $res->[0]{block}, "Greek and Coptic", "letter in proper block";
|
||||
is $res->[0]{block}, $sigma_block, "letter in proper block";
|
||||
|
||||
# The former example used SQLite's LIKE operator; now do the same with MATCH
|
||||
# which gets translated to a Perl regex
|
||||
$sql = "SELECT * FROM charinfo WHERE script='Greek' AND name MATCH 'SIGMA'";
|
||||
$res = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
ok scalar(@$res), "found sigma letters";
|
||||
is $res->[0]{block}, "Greek and Coptic", "letter in proper block";
|
||||
is $res->[0]{block}, $sigma_block, "letter in proper block";
|
||||
|
||||
# the following does not work because \b gets escaped as a literal
|
||||
#$sql = "SELECT * FROM charinfo WHERE script='Greek' AND name MATCH '\\bSIGMA\\b'";
|
||||
|
@ -49,4 +58,4 @@ is $res->[0]{block}, "Greek and Coptic", "letter in proper block";
|
|||
$sql = "SELECT * FROM charinfo WHERE script='Greek' AND name REGEXP '\\bSIGMA\\b'";
|
||||
$res = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
ok scalar(@$res), "found sigma letters";
|
||||
is $res->[0]{block}, "Greek and Coptic", "letter in proper block";
|
||||
is $res->[0]{block}, $sigma_block, "letter in proper block";
|
||||
|
|
Loading…
Add table
Reference in a new issue