Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44e73a4

Browse files
committed
Fix regression tests of unaccent to work without UTF8 support
The tests of unaccent rely on UTF8 characters, and unlike any other testsuite in the tree (fuzzystrmatch, citext, hstore, etc.), they would failif run on a database that does not support UTF8 encoding.This commit fixes the tests of unaccent so as these are skipped when runon a database without UTF8 support, using the same method as the othertest suits based on \if, getdatabaseencoding() and an alternate outputfile.This has been broken for a long time, but nobody has complained aboutthat either, so no backpatch is done. This can be reproduced withsomething like REGRESS_OPTS="--no-locale --encoding=sql_ascii", forinstance. To defend against that, this module's Makefile andmeson.build enforced a UTF8 encoding without locales, but it did notoffer protection for options given by REGRESS_OPTS. This switch makesthis regression test suite more consistent with all the others, aswell.Reviewed-by: Peter EisentrautDiscussion:https://postgr.es/m/ZIq1HUnIV2ksW85x@paquier.xyz
1 parent72df1d3 commit44e73a4

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

‎contrib/unaccent/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ PGFILEDESC = "unaccent - text search dictionary that removes accents"
1212

1313
REGRESS = unaccent
1414

15-
# We need a UTF8 database
16-
ENCODING = UTF8
17-
NO_LOCALE = 1
18-
1915
ifdefUSE_PGXS
2016
PG_CONFIG = pg_config
2117
PGXS :=$(shell$(PG_CONFIG) --pgxs)

‎contrib/unaccent/expected/unaccent.out

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
/*
2+
* This test must be run in a database with UTF-8 encoding,
3+
* because other encodings don't support all the characters used.
4+
*/
5+
SELECT getdatabaseencoding() <> 'UTF8'
6+
AS skip_test \gset
7+
\if :skip_test
8+
\quit
9+
\endif
110
CREATE EXTENSION unaccent;
2-
-- must have a UTF8 database
3-
SELECT getdatabaseencoding();
4-
getdatabaseencoding
5-
---------------------
6-
UTF8
7-
(1 row)
8-
911
SET client_encoding TO 'UTF8';
1012
SELECT unaccent('foobar');
1113
unaccent
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* This test must be run in a database with UTF-8 encoding,
3+
* because other encodings don't support all the characters used.
4+
*/
5+
SELECT getdatabaseencoding() <> 'UTF8'
6+
AS skip_test \gset
7+
\if :skip_test
8+
\quit

‎contrib/unaccent/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ tests += {
3737
'sql': [
3838
'unaccent',
3939
],
40-
'regress_args': ['--no-locale','--encoding=UTF8'],
4140
},
4241
}

‎contrib/unaccent/sql/unaccent.sql

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
CREATE EXTENSION unaccent;
1+
/*
2+
* This test must be run in a database with UTF-8 encoding,
3+
* because other encodings don't support all the characters used.
4+
*/
5+
6+
SELECT getdatabaseencoding()<>'UTF8'
7+
AS skip_test \gset
8+
\if :skip_test
9+
\quit
10+
\endif
211

3-
-- must have a UTF8 database
4-
SELECT getdatabaseencoding();
12+
CREATE EXTENSION unaccent;
513

614
SET client_encoding TO'UTF8';
715

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp