Hi all, While doing some tests with the tree, I have noticed that we don't do in the tests of unaccent the business that we have elsewhere (test_regex, fuzzystrmatch, now hstore, collation tests, etc.) to make the tests portable when these tests include UTF-8 characters but the regression database cannot support that.
It took some time to notice that, which makes me wonder how relevant this stuff is these days.. Anyway, I would like to do like the others and fix it, so I am proposing the attached. Thoughts? -- Michael
From 4dd02315941db6c114950601cc9a0e6837e5d6e0 Mon Sep 17 00:00:00 2001 From: Michael Paquier <mich...@paquier.xyz> Date: Thu, 15 Jun 2023 15:50:43 +0900 Subject: [PATCH] Fix regression tests of unaccent to be portable across more setups --- contrib/unaccent/expected/unaccent.out | 16 +++++++++------- contrib/unaccent/expected/unaccent_1.out | 8 ++++++++ contrib/unaccent/sql/unaccent.sql | 14 +++++++++++--- 3 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 contrib/unaccent/expected/unaccent_1.out diff --git a/contrib/unaccent/expected/unaccent.out b/contrib/unaccent/expected/unaccent.out index ee0ac71a1c..f080707c4a 100644 --- a/contrib/unaccent/expected/unaccent.out +++ b/contrib/unaccent/expected/unaccent.out @@ -1,11 +1,13 @@ +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit +\endif CREATE EXTENSION unaccent; --- must have a UTF8 database -SELECT getdatabaseencoding(); - getdatabaseencoding ---------------------- - UTF8 -(1 row) - SET client_encoding TO 'UTF8'; SELECT unaccent('foobar'); unaccent diff --git a/contrib/unaccent/expected/unaccent_1.out b/contrib/unaccent/expected/unaccent_1.out new file mode 100644 index 0000000000..37aead89c0 --- /dev/null +++ b/contrib/unaccent/expected/unaccent_1.out @@ -0,0 +1,8 @@ +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit diff --git a/contrib/unaccent/sql/unaccent.sql b/contrib/unaccent/sql/unaccent.sql index 3fc0c706be..663646c1ac 100644 --- a/contrib/unaccent/sql/unaccent.sql +++ b/contrib/unaccent/sql/unaccent.sql @@ -1,7 +1,15 @@ -CREATE EXTENSION unaccent; +/* + * This test must be run in a database with UTF-8 encoding, + * because other encodings don't support all the characters used. + */ --- must have a UTF8 database -SELECT getdatabaseencoding(); +SELECT getdatabaseencoding() <> 'UTF8' + AS skip_test \gset +\if :skip_test +\quit +\endif + +CREATE EXTENSION unaccent; SET client_encoding TO 'UTF8'; -- 2.40.1
signature.asc
Description: PGP signature