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

83 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5245
ISSUE: 5245
TITLE: The package procedure with value by default isn't called if this parameter isn't specified
DESCRIPTION:
JIRA: CORE-4954
FBTEST: bugs.core_4954
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set term ^;
create or alter package pkg_test
as
begin
procedure p1(a int, b int = 1) returns(x int);
function f1(a int, b int = 1) returns int;
procedure sp_test returns(x int);
end
^
recreate package body pkg_test
as
begin
procedure p1(a int, b int) returns(x int) as
begin
x = a + b;
suspend;
end
function f1(a int, b int) returns int as
begin
return a + b;
end
procedure sp_test returns(x int) as
begin
execute procedure p1( 12 ) returning_values :x; suspend;
execute procedure p1( 12, 13 ) returning_values :x; suspend;
select x from p1( 12 ) into x; suspend;
select x from p1( 12, 13 ) into x; suspend;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
x = f1( 21 ); suspend;
x = f1( 22, 23 ); suspend;
2022-01-24 20:27:02 +01:00
2021-04-26 20:07:00 +02:00
end
end
2022-01-24 20:27:02 +01:00
^
2021-04-26 20:07:00 +02:00
set term ;^
commit;
set list on;
select * from pkg_test.sp_test;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
X 13
X 25
X 13
X 25
X 22
X 45
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-24 20:27:02 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00