From 5478e196d34122d5f9643689bb1992f25e26bf96 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Thu, 27 May 2010 14:36:36 +0000 Subject: [PATCH] more icu collation test --- t/rt_53235_icu_compatibility.t | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/t/rt_53235_icu_compatibility.t b/t/rt_53235_icu_compatibility.t index 3c13999..ccec7a6 100644 --- a/t/rt_53235_icu_compatibility.t +++ b/t/rt_53235_icu_compatibility.t @@ -12,7 +12,7 @@ BEGIN { require DBD::SQLite; if (DBD::SQLite->can('compile_options') && grep /ENABLE_ICU/, DBD::SQLite::compile_options()) { - plan( tests => 7 ); + plan( tests => 16 ); } else { 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]"; } } + +{ # 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]"; + } +}