2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
2022-01-25 22:55:48 +01:00
|
|
|
|
|
|
|
"""
|
|
|
|
ID: issue-5601
|
|
|
|
ISSUE: 5601
|
|
|
|
TITLE: Malformed string error when using cyrilic symbols and x'0d0a' in exception
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-5325
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_5325
|
2022-01-25 22:55:48 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
import pytest
|
2021-12-06 19:23:35 +01:00
|
|
|
from pathlib import Path
|
2022-01-25 22:55:48 +01:00
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
substitutions = [('exception [\\d]+', 'exception'),
|
|
|
|
('-At block line(:)?\\s+[\\d]+.*', ''),
|
|
|
|
('After line(:)?\\s+[\\d]+.*', '')]
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
act = python_act('db', substitutions=substitutions)
|
2021-12-06 19:23:35 +01:00
|
|
|
|
2022-01-25 22:55:48 +01:00
|
|
|
test_script = """
|
2021-12-06 19:23:35 +01:00
|
|
|
create exception error_test 'йцукенг';
|
|
|
|
commit;
|
|
|
|
set term ^;
|
|
|
|
execute block as
|
|
|
|
begin
|
|
|
|
exception error_test 'йцу' || _win1251 x'0d0a' || 'кенг';
|
|
|
|
end^
|
|
|
|
set term ;^
|
|
|
|
"""
|
|
|
|
|
|
|
|
script_file = temp_file('test-script.sql')
|
|
|
|
|
|
|
|
expected_stderr_1 = """
|
2021-04-26 20:07:00 +02:00
|
|
|
Statement failed, SQLSTATE = HY000
|
|
|
|
exception 1
|
|
|
|
-ERROR_TEST
|
|
|
|
-йцу
|
|
|
|
|
|
|
|
кенг
|
2021-12-06 19:23:35 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-25 22:55:48 +01:00
|
|
|
def test_1(act: Action, script_file: Path):
|
|
|
|
script_file.write_text(test_script, encoding='cp1251')
|
|
|
|
act.expected_stderr = expected_stderr_1
|
|
|
|
act.isql(switches=['-q'], input_file=script_file, charset='WIN1251')
|
|
|
|
assert act.clean_stderr == act.clean_expected_stderr
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
|