6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_6466_test.py

145 lines
3.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_6466
# title: Comments before the first line of code are removed (when extract metadata)
# decription:
2021-04-26 20:07:00 +02:00
# Lot of comments (multi-line blocks) are inserted before each clause/token of created SP
# (in its declaration of name, input and output parameters, sections of variables and after
# final 'end').
# Comments before 'AS' clause will be removed after SP commit (i.e. they must not be shown
# when metadata is axtracted - at least for current versions of FB).
# First comment _after_ 'AS' clause (and before 1st 'declare variable' statement) *must*
# be preserved.
# Comment after final 'end' of procedure must also be preserved.
#
2021-04-26 20:07:00 +02:00
# Confirmed bug on:
# * 4.0.0.2353 - final comment ('950' in this script) was not stored;
# * 3.0.8.33401 - comments before first declaration of variable ('900') and after final
# 'end' ('950') were not stored.
# Checked on 4.0.0.2365, 3.0.8.33415 -- all fine.
#
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-6466
# min_versions: ['3.0.8']
# versions: 3.0.8
# qmid: None
import pytest
from firebird.qa import db_factory, python_act, Action
2021-04-26 20:07:00 +02:00
# version: 3.0.8
# resources: None
substitutions_1 = [('^((?!comment-[\\d]+).)*$', ''), ('[ \t]+', ' ')]
init_script_1 = """
set term ^;
create or alter procedure sp_test1
/*
comment-100
*/
(
2021-04-26 20:07:00 +02:00
/*
comment-150
*/
int_a int
/*
comment-200
*/
,
/*
comment-230
*/
int_b int
/*
comment-250
*/
)
/*
comment-300
*/
returns
2021-04-26 20:07:00 +02:00
/*
comment-400
*/
(
2021-04-26 20:07:00 +02:00
/*
comment-500
*/
out_a
/*
comment-600
*/
int
/*
comment-700
*/
,out_b int
/*
comment-750
*/
)
/*
comment-800
*/
as
/*
comment-900
*/
declare
/*
comment-910
*/
int_c
/*
comment-920
*/
int = 2
/*
comment-930
*/
;
/*
comment-940
*/
begin
/* code */
int_b=int_a+int_c+2;
suspend;
end
/*
comment-950
*/
^
commit
^
set term ;^
"""
2021-04-26 20:07:00 +02:00
db_1 = db_factory(sql_dialect=3, init=init_script_1)
# test_script_1
#---
#
2021-04-26 20:07:00 +02:00
# runProgram('isql', [dsn, '-x', '-user', user_name, '-pas', user_password], )
#
2021-04-26 20:07:00 +02:00
#---
act_1 = python_act('db_1', substitutions=substitutions_1)
2021-04-26 20:07:00 +02:00
expected_stdout_1 = """
comment-900
comment-910
comment-920
comment-930
comment-940
comment-950
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.8')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.extract_meta()
assert act_1.clean_stdout == act_1.clean_expected_stdout
2021-04-26 20:07:00 +02:00