mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
more icu collation test
This commit is contained in:
parent
ce431524f1
commit
5478e196d3
1 changed files with 31 additions and 1 deletions
|
@ -12,7 +12,7 @@ BEGIN {
|
||||||
require DBD::SQLite;
|
require DBD::SQLite;
|
||||||
if (DBD::SQLite->can('compile_options')
|
if (DBD::SQLite->can('compile_options')
|
||||||
&& grep /ENABLE_ICU/, DBD::SQLite::compile_options()) {
|
&& grep /ENABLE_ICU/, DBD::SQLite::compile_options()) {
|
||||||
plan( tests => 7 );
|
plan( tests => 16 );
|
||||||
} else {
|
} else {
|
||||||
plan( skip_all => 'requires SQLite ICU plugin to be enabled' );
|
plan( skip_all => 'requires SQLite ICU plugin to be enabled' );
|
||||||
}
|
}
|
||||||
|
@ -64,3 +64,33 @@ utf8::encode($koenig);
|
||||||
is $got[$i] => $expected[$i], "got: $got[$i]";
|
is $got[$i] => $expected[$i], "got: $got[$i]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ # more ICU
|
||||||
|
my @expected = qw(
|
||||||
|
flusse
|
||||||
|
Flusse
|
||||||
|
fluße
|
||||||
|
Fluße
|
||||||
|
flüsse
|
||||||
|
flüße
|
||||||
|
Fuße
|
||||||
|
);
|
||||||
|
|
||||||
|
my $dbh = connect_ok();
|
||||||
|
eval { $dbh->do('select icu_load_collation("de_DE", "german")') };
|
||||||
|
ok !$@, "installed icu collation";
|
||||||
|
# XXX: as of this writing, a warning is known to be printed.
|
||||||
|
$dbh->do('create table foo (bar text collate german)');
|
||||||
|
foreach my $str (reverse @expected) {
|
||||||
|
$dbh->do('insert into foo values(?)', undef, $str);
|
||||||
|
}
|
||||||
|
my $sth = $dbh->prepare('select bar from foo order by bar');
|
||||||
|
$sth->execute;
|
||||||
|
my @got;
|
||||||
|
while(my ($value) = $sth->fetchrow_array) {
|
||||||
|
push @got, $value;
|
||||||
|
}
|
||||||
|
for (my $i = 0; $i < @expected; $i++) {
|
||||||
|
is $got[$i] => $expected[$i], "got: $got[$i]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue