6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated tests\bugs\core_0857_test.py: Re-implemented. See notes. Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609

This commit is contained in:
pavel-zotov 2024-10-31 01:04:04 +03:00
parent ba89f2888e
commit 86b78aa07e

View File

@ -8,19 +8,26 @@ DESCRIPTION:
JIRA: CORE-857
FBTEST: bugs.core_0857
NOTES:
[06.10.2022] pzotov
Could not complete adjusting for LINUX in new-qa.
DEFERRED.
[31.10.2024] pzotov
Bug was fixed for too old FB (2.0 RC4 / 2.1 ALpha 1), firebird-driver and/or QA-plugin
will not able to run on this version in order to reproduce problem.
Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609
"""
from pathlib import Path
import platform
import pytest
from firebird.qa import *
init_script = """
set echo on;
set bail on;
db = db_factory(charset='WIN1252')
act = isql_act('db', substitutions=[('[ \\t]+', ' ')])
tmp_sql = temp_file('tmp_core_0857.sql')
@pytest.mark.version('>=3.0.0')
def test_1(act: Action, tmp_sql: Path):
test_script = """
set bail on;
create collation test_coll_ci_ai for win1252 from WIN_PTBR
case insensitive
accent insensitive
@ -37,20 +44,8 @@ set bail on;
commit;
create view v_test as
select octet_length(t.f01) - octet_length(replace(t.f01, 'ß', '')) as "octet_length diff:" from test t;
"""
commit;
db = db_factory(charset='WIN1252', init=init_script)
expected_stdout = """
CONNECTION_CSET WIN1252
test_1 result: <null>
test_2 result: 1
ci_ai result: 1
between result: 1
octet_length diff: 1
"""
test_script = """
set list on;
select c.rdb$character_set_name as connection_cset
from mon$attachments a
@ -62,15 +57,21 @@ test_script = """
select t.id as "ci_ai result:" from rdb$database r left join test t on lower(t.f02) = upper(t.f02);
select t.id as "between result:" from rdb$database r left join test t on lower(t.f01) between lower(t.f02) and upper(t.f02);
select * from v_test;
"""
"""
act = isql_act('db', test_script)
# ::: NB :::
# For proper output of test, input script must be encoded in cp1252 rather than in UTF-8.
#
tmp_sql.write_text(test_script, encoding = 'cp1252')
@pytest.mark.skipif(platform.system() != 'Windows', reason='FIXME: see notes')
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
act.expected_stdout = """
CONNECTION_CSET WIN1252
test_1 result: <null>
test_2 result: 1
ci_ai result: 1
between result: 1
octet_length diff: 1
"""
act.isql(switches = ['-q'], input_file = tmp_sql, charset = 'win1252', combine_output = True)
assert act.clean_stdout == act.clean_expected_stdout