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

137 lines
2.3 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4450
ISSUE: 4450
TITLE: Metadata export with isql (option -ex) does not export functions properly
DESCRIPTION:
JIRA: CORE-4122
FBTEST: bugs.core_4122
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
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
2022-01-23 20:41:55 +01:00
db = db_factory(init=init_script)
2021-11-18 20:15:37 +01:00
2022-01-23 20:41:55 +01:00
act = python_act('db', substitutions=[('/* CREATE DATABASE .*', '')])
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
2021-11-18 20:15:37 +01:00
SET SQL DIALECT 3;
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
/* CREATE DATABASE 'localhost/3330:test.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')
2022-01-23 20:41:55 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.isql(switches=['-x'])
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00