6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_1384_test.py

59 lines
1.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-20 17:32:14 +01:00
"""
ID: issue-1802
ISSUE: 1802
TITLE: LIKE doesn't work correctly with collations using SPECIALS-FIRST=1
DESCRIPTION:
JIRA: CORE-1384
FBTEST: bugs.core_1384
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create collation coll_es for iso8859_1 from external ('ES_ES_CI_AI') 'SPECIALS-FIRST=1';
create collation coll_fr for iso8859_1 from external ('FR_FR') CASE INSENSITIVE accent insensitive 'SPECIALS-FIRST=1';
commit;
2021-11-11 18:01:08 +01:00
2021-04-26 20:07:00 +02:00
create or alter view v_test as
2021-11-11 18:01:08 +01:00
select
iif( _iso8859_1 'Ja ' collate coll_es like _iso8859_1 '% a%' collate coll_es, 1, 0) result_for_es_ci_ai
2021-04-26 20:07:00 +02:00
,iif( _iso8859_1 'ka ' collate coll_fr like _iso8859_1 '% a%' collate coll_fr, 1, 0) result_for_fr_ci_ai
from rdb$database
UNION ALL -- added comparison to pattern with diactiric mark:
2021-11-11 18:01:08 +01:00
select
iif( _iso8859_1 '' collate coll_es like _iso8859_1 '% à %' collate coll_es, 1, 0) result_for_es_ci_ai
2021-04-26 20:07:00 +02:00
,iif( _iso8859_1 '' collate coll_fr like _iso8859_1 '% à %' collate coll_fr, 1, 0) result_for_fr_ci_ai
from rdb$database
;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
db = db_factory(charset='UTF8', init=init_script)
2021-11-11 18:01:08 +01:00
2022-01-20 17:32:14 +01:00
test_script = """
2021-11-11 18:01:08 +01:00
set list on;
show collation;
select * from v_test;
"""
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
COLL_ES, CHARACTER SET ISO8859_1, FROM EXTERNAL ('ES_ES_CI_AI'), 'SPECIALS-FIRST=1'
COLL_FR, CHARACTER SET ISO8859_1, FROM EXTERNAL ('FR_FR'), CASE INSENSITIVE, ACCENT INSENSITIVE, 'SPECIALS-FIRST=1'
RESULT_FOR_ES_CI_AI 0
RESULT_FOR_FR_CI_AI 0
RESULT_FOR_ES_CI_AI 0
RESULT_FOR_FR_CI_AI 0
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute(charset='ISO8859_1')
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00