test: cover between/hostvar/gcov-merge, class conditions, schema drop-tables, gixsql fixes

This commit is contained in:
hangshuo652
2026-08-09 17:43:16 +08:00
parent 273a3f8211
commit ff51bda962
22 changed files with 2559 additions and 0 deletions
@@ -0,0 +1,37 @@
"""Scenario `drop_tables` 配置解析测试。
用于覆盖「表缺失导致 OPEN CURSOR 失败」的错误分支(如 SHA02MNC #5 T
EMP-OPEN SQLCODE≠0)。机制通用:任一程序可在场景里声明要 DROP 的表,
运行时 OPEN 该表即失败 → SQL 错误分支可达。
"""
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
from config.program_schema import ProgramSchema
_YAML = """
program_id: SHA02MNC
db_type: SQLite
db_name: INSURANCEDB.db
db_tables:
- name: EMP_MASTER
columns:
- name: EMP_ID
type: CHAR(8)
primary_key: true
runs:
- id: normal
- id: emp_open_fail
drop_tables: [EMP_MASTER]
inject_duplicate_pk: false
"""
def test_drop_tables_parsed_from_yaml(tmp_path):
p = tmp_path / "SHA02MNC.yaml"
p.write_text(_YAML, encoding="utf-8")
schema = ProgramSchema.from_yaml(p)
assert len(schema.runs) == 2
fail = schema.runs[1]
assert fail.id == "emp_open_fail"
assert fail.drop_tables == ["EMP_MASTER"]