1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Improve regression test coverage for src/backend/tsearch/spell.c.

In passing, throw an error if the AF count is too small, rather than
just silently discarding extra affix entries.

Note that the new regression test cases require installing the
updated src/backend/tsearch/dicts files.

Arthur Zakirov

Discussion: https://postgr.es/m/20180413113447.GA32474@zakirov.localdomain
This commit is contained in:
Tom Lane
2018-04-13 13:49:52 -04:00
parent d25c2ee9c0
commit 8bf358c18e
7 changed files with 77 additions and 6 deletions

View File

@ -263,6 +263,12 @@ SELECT ts_lexize('hunspell_long', 'unbook');
{book}
(1 row)
SELECT ts_lexize('hunspell_long', 'booked');
ts_lexize
-----------
{book}
(1 row)
SELECT ts_lexize('hunspell_long', 'footklubber');
ts_lexize
----------------
@ -281,12 +287,24 @@ SELECT ts_lexize('hunspell_long', 'ballyklubber');
{ball,klubber}
(1 row)
SELECT ts_lexize('hunspell_long', 'ballsklubber');
ts_lexize
----------------
{ball,klubber}
(1 row)
SELECT ts_lexize('hunspell_long', 'footballyklubber');
ts_lexize
---------------------
{foot,ball,klubber}
(1 row)
SELECT ts_lexize('hunspell_long', 'ex-machina');
ts_lexize
---------------
{ex-,machina}
(1 row)
-- Test ISpell dictionary with hunspell affix file with FLAG num parameter
CREATE TEXT SEARCH DICTIONARY hunspell_num (
Template=ispell,
@ -299,6 +317,12 @@ SELECT ts_lexize('hunspell_num', 'skies');
{sky}
(1 row)
SELECT ts_lexize('hunspell_num', 'sk');
ts_lexize
-----------
{sky}
(1 row)
SELECT ts_lexize('hunspell_num', 'bookings');
ts_lexize
----------------
@ -359,6 +383,12 @@ SELECT ts_lexize('hunspell_num', 'unbook');
{book}
(1 row)
SELECT ts_lexize('hunspell_num', 'booked');
ts_lexize
-----------
{book}
(1 row)
SELECT ts_lexize('hunspell_num', 'footklubber');
ts_lexize
----------------

View File

@ -66,11 +66,14 @@ SELECT ts_lexize('hunspell_long', 'rebook');
SELECT ts_lexize('hunspell_long', 'unbookings');
SELECT ts_lexize('hunspell_long', 'unbooking');
SELECT ts_lexize('hunspell_long', 'unbook');
SELECT ts_lexize('hunspell_long', 'booked');
SELECT ts_lexize('hunspell_long', 'footklubber');
SELECT ts_lexize('hunspell_long', 'footballklubber');
SELECT ts_lexize('hunspell_long', 'ballyklubber');
SELECT ts_lexize('hunspell_long', 'ballsklubber');
SELECT ts_lexize('hunspell_long', 'footballyklubber');
SELECT ts_lexize('hunspell_long', 'ex-machina');
-- Test ISpell dictionary with hunspell affix file with FLAG num parameter
CREATE TEXT SEARCH DICTIONARY hunspell_num (
@ -80,6 +83,7 @@ CREATE TEXT SEARCH DICTIONARY hunspell_num (
);
SELECT ts_lexize('hunspell_num', 'skies');
SELECT ts_lexize('hunspell_num', 'sk');
SELECT ts_lexize('hunspell_num', 'bookings');
SELECT ts_lexize('hunspell_num', 'booking');
SELECT ts_lexize('hunspell_num', 'foot');
@ -90,6 +94,7 @@ SELECT ts_lexize('hunspell_num', 'rebook');
SELECT ts_lexize('hunspell_num', 'unbookings');
SELECT ts_lexize('hunspell_num', 'unbooking');
SELECT ts_lexize('hunspell_num', 'unbook');
SELECT ts_lexize('hunspell_num', 'booked');
SELECT ts_lexize('hunspell_num', 'footklubber');
SELECT ts_lexize('hunspell_num', 'footballklubber');