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_4122_test.py

149 lines
2.8 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_4122
# title: Metadata export with isql (option -ex) does not export functions properly
2021-11-18 20:15:37 +01:00
# decription:
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-4122
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
2021-11-18 20:15:37 +01:00
from firebird.qa import db_factory, python_act, Action
2021-04-26 20:07:00 +02:00
# version: 3.0
# resources: None
2021-11-18 20:15:37 +01:00
substitutions_1 = [("CREATE DATABASE '.*' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE",
"CREATE DATABASE '' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE")]
2021-04-26 20:07:00 +02:00
init_script_1 = """
set term ^ ;
create or alter package PKG_TEST
as
begin
function F_TEST_INSIDE_PKG
returns smallint;
end^
set term ; ^
2021-11-18 20:15:37 +01:00
2021-04-26 20:07:00 +02:00
set term ^ ;
recreate package body PKG_TEST
as
begin
function F_TEST_INSIDE_PKG
returns smallint
as
begin
return 1;
end
end^
set term ; ^
2021-11-18 20:15:37 +01:00
2021-04-26 20:07:00 +02:00
set term ^ ;
create or alter function F_TEST_OUTSIDE_PKG
returns smallint
as
begin
return -1;
end^
2021-11-18 20:15:37 +01:00
2021-04-26 20:07:00 +02:00
set term ; ^
commit;
2021-11-18 20:15:37 +01:00
"""
2021-04-26 20:07:00 +02:00
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
# test_script_1
#---
# #
# runProgram('isql',['-x',dsn,'-user',user_name,'-pass',user_password])
2021-11-18 20:15:37 +01:00
#
2021-04-26 20:07:00 +02:00
#---
2021-11-18 20:15:37 +01:00
act_1 = python_act('db_1', substitutions=substitutions_1)
2021-04-26 20:07:00 +02:00
expected_stdout_1 = """
2021-11-18 20:15:37 +01:00
SET SQL DIALECT 3;
2021-04-26 20:07:00 +02:00
2021-11-18 20:15:37 +01:00
/* CREATE DATABASE 'localhost/3330:C:\\FBTESTING\\qa\\fbt-repo\\tmp\\core4122.fdb' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE; */
2021-04-26 20:07:00 +02:00
COMMIT WORK;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;
/* Stored functions headers */
CREATE OR ALTER FUNCTION F_TEST_OUTSIDE_PKG RETURNS SMALLINT
2021-11-18 20:15:37 +01:00
AS
2021-04-26 20:07:00 +02:00
BEGIN END ^
SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;
/* Package headers */
/* Package header: PKG_TEST, Owner: SYSDBA */
CREATE PACKAGE PKG_TEST AS
begin
function F_TEST_INSIDE_PKG
returns smallint;
end^
SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;
/* Stored functions bodies */
ALTER FUNCTION F_TEST_OUTSIDE_PKG RETURNS SMALLINT
2021-11-18 20:15:37 +01:00
AS
2021-04-26 20:07:00 +02:00
begin
return -1;
end ^
SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
COMMIT WORK;
SET AUTODDL OFF;
SET TERM ^ ;
/* Package bodies */
/* Package body: PKG_TEST, Owner: SYSDBA */
CREATE PACKAGE BODY PKG_TEST AS
begin
function F_TEST_INSIDE_PKG
returns smallint
as
begin
return 1;
end
end^
SET TERM ; ^
COMMIT WORK;
SET AUTODDL ON;
2021-11-18 20:15:37 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2021-11-18 20:15:37 +01:00
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.isql(switches=['-x'])
assert act_1.clean_stdout == act_1.clean_expected_stdout
2021-04-26 20:07:00 +02:00