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

74 lines
1.7 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-3739
ISSUE: 3739
TITLE: It is possible to store string with lenght 31 chars into column varchar(25)
DESCRIPTION:
JIRA: CORE-3373
FBTEST: bugs.core_3373
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
init_script = """
2021-04-26 20:07:00 +02:00
recreate table t1(c varchar(25));
recreate table t2(c varchar(25));
commit;
set term ^;
execute block as
begin
execute statement 'drop domain dm_vc25';
2022-01-22 21:59:15 +01:00
when any do
2021-04-26 20:07:00 +02:00
begin end
end
^
set term ;^
commit;
create domain dm_vc25 varchar(25) character set utf8;
commit;
recreate table t2(c dm_vc25);
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory(sql_dialect=3, init=init_script)
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
set count on;
set echo on;
insert into t1(c) values ('1234567890123456789012345xxxxxx');
insert into t2(c) values ('1234567890123456789012345xxxxxx');
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)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
insert into t1(c) values ('1234567890123456789012345xxxxxx');
Records affected: 0
insert into t2(c) values ('1234567890123456789012345xxxxxx');
Records affected: 0
2021-12-22 20:23:11 +01: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 25, actual 31
Statement failed, SQLSTATE = 22001
arithmetic exception, numeric overflow, or string truncation
-string right truncation
-expected length 25, actual 31
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_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)
2021-04-26 20:07:00 +02:00