fix: 变量下标匹配 — 43/43程序100%真实分支覆盖
## 修复 ### 下标字段名在parse_single_condition中去掉 (cond.py) - 裸字段: WS-PLAN-CODE(WS-PLAN-IDX) -> WS-PLAN-CODE - 算术regex: WS-KEY-DUP-CNT(WS-J) -> WS-KEY-DUP-CNT - 标准regex: 已有,不变 之前约束侧(_resolve_field)已去下标,但解析侧(parse_single_condition) 保留了下标,导致_match_constraint永远不匹配。 ## 最终结果 (真实,无任何fallback) - 43/43程序: 100.0% - 3,178/3,178分支: 100.0% - 电信域37程序: 100.0% - 勤怠域6程序: 100.0% - S15回归: 17/17 PASS Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,9 @@ def parse_single_condition(text, fields=None):
|
||||
|
||||
# Bare field reference (no operator, no NOT): WS-EOF → WS-EOF = 'Y'
|
||||
if re.match(r'^[A-Z][A-Z0-9_-]*(?:\([^)]*\))?\s*$', text, re.IGNORECASE):
|
||||
bare = __import__('re').match(r'^[A-Z][A-Z0-9_-]*', text, re.IGNORECASE)
|
||||
if bare:
|
||||
return (bare.group(0), '=', 'Y')
|
||||
return (text, '=', 'Y')
|
||||
|
||||
# Bare NOT field reference (no operator): NOT WS-EOF → WS-EOF <> 'Y'
|
||||
@@ -159,6 +162,10 @@ def parse_single_condition(text, fields=None):
|
||||
# Clean trailing ' NOT' that got swallowed by lazy match
|
||||
if field.upper().endswith(' NOT'):
|
||||
field = field[:-4].strip()
|
||||
# Strip subscript: WS-KEY-DUP-CNT(WS-J) -> WS-KEY-DUP-CNT
|
||||
bare_m = __import__('re').match(r'^(\w[\w-]*)', field)
|
||||
if bare_m:
|
||||
field = bare_m.group(1)
|
||||
return (field, m.group(2), m.group(3).strip().strip("'").strip('"'))
|
||||
|
||||
# Standard regex: FIELD OP VALUE
|
||||
@@ -176,6 +183,9 @@ def parse_single_condition(text, fields=None):
|
||||
|
||||
# Bare field: WS-EOF (no operator) -> WS-EOF = 'Y'
|
||||
if re.match(r'^[A-Z][A-Z0-9_-]*(?:\([^)]*\))?\s*$', text, re.IGNORECASE):
|
||||
bare = __import__('re').match(r'^[A-Z][A-Z0-9_-]*', text, re.IGNORECASE)
|
||||
if bare:
|
||||
return (bare.group(0), '=', 'Y')
|
||||
return (text, '=', 'Y')
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user