From c46a29e8144e22db4f933d708ba83ebf99cddb12 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Fri, 12 Apr 2024 11:41:18 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_8078_test.py: Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da --- tests/bugs/gh_8078_test.py | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/bugs/gh_8078_test.py diff --git a/tests/bugs/gh_8078_test.py b/tests/bugs/gh_8078_test.py new file mode 100644 index 00000000..36994d21 --- /dev/null +++ b/tests/bugs/gh_8078_test.py @@ -0,0 +1,66 @@ +#coding:utf-8 + +""" +ID: issue-8078 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/8078 +TITLE: SIMILAR TO with constant pattern using '|', '*', '?' or '{0,N}' doesn't work as expected +DESCRIPTION: +NOTES: + [12.04.2024] pzotov + Confirmed bug on 6.0.0.273, 5.0.1.1340. + Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da -- all OK. +""" + +import pytest +from firebird.qa import * + +db = db_factory() + +test_script = """ + recreate table test ( + id int generated by default as identity constraint pk_test primary key + ,s varchar(20) + ); + insert into test(s) values('72644'); + insert into test(s) values('72649'); + set list on; + set count on; + select 'chk-01' as msg, t.* from test t where t.s similar to '72649|72644'; + select 'chk-02' as msg, t.* from test t where t.s similar to '5*72644'; + select 'chk-03' as msg, t.* from test t where t.s similar to '5?72644'; + select 'chk-04' as msg, t.* from test t where t.s similar to '5{0,99}72644'; +""" + +act = isql_act('db', test_script, substitutions=[ ('[ \\t]+', ' ') ]) + +@pytest.mark.version('>=3.0.0') +def test_1(act: Action): + + expected_stdout = f""" + MSG chk-01 + ID 1 + S 72644 + MSG chk-01 + ID 2 + S 72649 + Records affected: 2 + + MSG chk-02 + ID 1 + S 72644 + Records affected: 1 + + MSG chk-03 + ID 1 + S 72644 + Records affected: 1 + + MSG chk-04 + ID 1 + S 72644 + Records affected: 1 + + """ + act.expected_stdout = expected_stdout + act.execute(combine_output = True) + assert act.clean_stdout == act.clean_expected_stdout