6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/functional/gtcs/test_invalid_stream_when_use_trim.py

40 lines
1.2 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-02-04 19:05:19 +01:00
"""
ID: gtcs.invalid-stream-when-use-trim
TITLE: Statement with TRIM raises "bad BLR -- invalid stream"
DESCRIPTION:
::: NB :::
### Name of original test has no any relation with actual task of this test: ###
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/CF_ISQL_32.script
Source description (Rudo Mihal, message of 2004-05-06 11:32:10; FB 1.5.1.4443):
https://sourceforge.net/p/firebird/mailman/message/17016190/
Example for reproducing (by N. Samofatov, with UDF usage):
https://sourceforge.net/p/firebird/mailman/message/17017012/
FBTEST: functional.gtcs.invalid_stream_when_use_trim
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set list on;
select trim(TRAILING FROM (select max(rdb$relation_id) from rdb$database)) trim_result from rdb$database;
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
act = isql_act('db', test_script, substitutions=[('[ \t]+', ' '), ('TRIM_RESULT.*', 'TRIM_RESULT')])
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
TRIM_RESULT 128
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout