Skip to content

Commit c46a29e

Browse files
committed
Added/Updated tests\bugs\gh_8078_test.py: Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da
1 parent 295895d commit c46a29e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

tests/bugs/gh_8078_test.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-8078
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/8078
6+
TITLE: SIMILAR TO with constant pattern using '|', '*', '?' or '{0,N}' doesn't work as expected
7+
DESCRIPTION:
8+
NOTES:
9+
[12.04.2024] pzotov
10+
Confirmed bug on 6.0.0.273, 5.0.1.1340.
11+
Checked on 6.0.0.312-ff9f094, 5.0.1.1378-fbd31da -- all OK.
12+
"""
13+
14+
import pytest
15+
from firebird.qa import *
16+
17+
db = db_factory()
18+
19+
test_script = """
20+
recreate table test (
21+
id int generated by default as identity constraint pk_test primary key
22+
,s varchar(20)
23+
);
24+
insert into test(s) values('72644');
25+
insert into test(s) values('72649');
26+
set list on;
27+
set count on;
28+
select 'chk-01' as msg, t.* from test t where t.s similar to '72649|72644';
29+
select 'chk-02' as msg, t.* from test t where t.s similar to '5*72644';
30+
select 'chk-03' as msg, t.* from test t where t.s similar to '5?72644';
31+
select 'chk-04' as msg, t.* from test t where t.s similar to '5{0,99}72644';
32+
"""
33+
34+
act = isql_act('db', test_script, substitutions=[ ('[ \\t]+', ' ') ])
35+
36+
@pytest.mark.version('>=3.0.0')
37+
def test_1(act: Action):
38+
39+
expected_stdout = f"""
40+
MSG chk-01
41+
ID 1
42+
S 72644
43+
MSG chk-01
44+
ID 2
45+
S 72649
46+
Records affected: 2
47+
48+
MSG chk-02
49+
ID 1
50+
S 72644
51+
Records affected: 1
52+
53+
MSG chk-03
54+
ID 1
55+
S 72644
56+
Records affected: 1
57+
58+
MSG chk-04
59+
ID 1
60+
S 72644
61+
Records affected: 1
62+
63+
"""
64+
act.expected_stdout = expected_stdout
65+
act.execute(combine_output = True)
66+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)