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_3594_test.py

75 lines
2.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3948
ISSUE: 3948
TITLE: Include expected and actual string lenght into error message for sqlcode -802
DESCRIPTION:
JIRA: CORE-3594
FBTEST: bugs.core_3594
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
create or alter procedure sp_overflowed_1 as begin end;
set term ^;
create or alter procedure sp_detailed_info returns(msg varchar(60)) as
begin
msg = '....:....1....:....2....:....3....:....4....:....5....:....6';
suspend;
end
^
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
create or alter procedure sp_overflowed_1 returns(msg varchar(50)) as
begin
execute procedure sp_detailed_info returning_values msg;
suspend;
end
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
^
create or alter procedure sp_overflowed_2 returns(msg varchar(59)) as
begin
msg = '....:....1....:....2....:....3....:....4....:....5....:....6';
suspend;
end
^
set term ;^
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set heading off;
select * from sp_overflowed_1;
select * from sp_overflowed_2;
-- On 2.5.x info about expected and actual length is absent:
-- Statement failed, SQLSTATE = 22001
-- arithmetic exception, numeric overflow, or string truncation
-- -string right truncation
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script, substitutions=[('line: .*', 'line'), ('col: .*', 'col')])
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 50, actual 60
-At procedure 'SP_OVERFLOWED_1' line: 3, col: 5
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 59, actual 60
-At procedure 'SP_OVERFLOWED_2' line: 3, col: 5
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
act.expected_stderr = expected_stderr
act.execute()
assert act.clean_stderr == act.clean_expected_stderr
2021-04-26 20:07:00 +02:00