From 4eb16ac704d966755e2c0e6f33ebb3e8acc9ca76 Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Wed, 29 Nov 2023 10:13:23 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_7886_test.py: Checked on 6.0.0.157 (intermediate snapshot) --- tests/bugs/gh_7886_test.py | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/bugs/gh_7886_test.py diff --git a/tests/bugs/gh_7886_test.py b/tests/bugs/gh_7886_test.py new file mode 100644 index 00000000..9a43ec2b --- /dev/null +++ b/tests/bugs/gh_7886_test.py @@ -0,0 +1,50 @@ +#coding:utf-8 + +""" +ID: issue-7886 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/7886 +TITLE: ISQL sets return code to 1 for script that is called via IN command even if this script completes OK. Problem caused by presence of tail comments in the callee +DESCRIPTION: +NOTES: + Confirmed bug on 6.0.0.154 + Checked on 6.0.0.157 (intermediate snapshot), 5.0.0.1280, 4.0.1.2519 +""" + +from pathlib import Path +import locale +import pytest +from firebird.qa import * + +db = db_factory() +act = python_act('db') + +tmp_worker = temp_file('tmp.core_4578.worker.sql') +tmp_caller = temp_file('tmp.core_4578.caller.sql') + +@pytest.mark.version('>=3.0') +def test_1(act: Action, tmp_worker: Path, tmp_caller: Path): + + worker_sql = """ + set term ^; + execute block as + begin + -- nop -- + end ^ + set term ;^ + -- this is final comment + """ + + caller_sql = f""" + set list on; + commit; + in "{str(tmp_worker)}"; + """ + tmp_worker.write_text(worker_sql) + tmp_caller.write_text(caller_sql) + + expected_stdout = """ + """ + + act.isql(switches=['-q'], input_file = str(tmp_caller), io_enc = locale.getpreferredencoding(), combine_output = True) + assert act.return_code == 0, f'### BUG ### act.return_code = {act.return_code}' +