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

Added/Updated tests\bugs\gh_7025_test.py: Added 'SQLSTATE' in substitutions: runtime error must not be suppressed. Added 'combine_output = True' in order to see SQLSTATE if any error occurs.

This commit is contained in:
pavel-zotov 2023-12-14 19:36:31 +03:00
parent e411bd8634
commit 2ce38a5ea0

View File

@ -3,11 +3,14 @@
"""
ID: issue-7025
ISSUE: 7025
TITLE: Results of negation must be the same for each datatype
(smallint / int /bigint / int128) when argument is least possible value for this type
DESCRIPTION:
Confirmed 'sqltype: 496 LONG' for -(-2147483648). Before fix was: '580 INT64'.
TITLE: Results of negation must be the same for each datatype (smallint / int /bigint / int128) when argument is least possible value for this type
DESCRIPTION: Confirmed 'sqltype: 496 LONG' for -(-2147483648). Before fix was: '580 INT64'.
FBTEST: bugs.gh_7025
NOTES:
[14.12.2023] pzotov
Added 'SQLSTATE' in substitutions: runtime error must not be filtered out by '?!(...)' pattern
("negative lookahead assertion", see https://docs.python.org/3/library/re.html#regular-expression-syntax).
Added 'combine_output = True' in order to see SQLSTATE if any error occurs.
"""
import pytest
@ -23,8 +26,7 @@ test_script = """
select -(-9223372036854775808) as neg_of_2p63 from rdb$database;
"""
act = isql_act('db', test_script, substitutions=[('^((?!sqltype:|NEG_OF_2P|SQLSTATE|overflow).)*$', ''),
('[ \t]+', ' ')])
act = isql_act('db', test_script, substitutions=[('^((?!sqltype:|NEG_OF_2P|SQLSTATE|overflow).)*$', ''), ('[ \t]+', ' ')])
expected_stdout = """
01: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
@ -35,14 +37,12 @@ expected_stdout = """
01: sqltype: 496 LONG scale: 0 subtype: 0 len: 4
: name: CONSTANT alias: NEG_OF_2P31
01: sqltype: 580 INT64 scale: 0 subtype: 0 len: 8
: name: CONSTANT alias: NEG_OF_2P63
"""
expected_stderr = """
Statement failed, SQLSTATE = 22003
Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.
01: sqltype: 580 INT64 scale: 0 subtype: 0 len: 8
: name: CONSTANT alias: NEG_OF_2P63
Statement failed, SQLSTATE = 22003
Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.
"""
@ -50,7 +50,5 @@ expected_stderr = """
@pytest.mark.version('>=5.0')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)
act.execute(combine_output = True)
assert act.clean_stdout == act.clean_expected_stdout