HS test generator: drop bogus then after else and catch X

process_hs_val replaces newlines with `then` to give the HS parser a
statement separator, but `else then` and `catch foo then` are syntax
errors — `else` and `catch <name>` already open new blocks. Strip the
inserted `then` after them so multi-line if/try parses cleanly.

No net pass-count delta on smoke-tested suites (the if-with-window-state
tests fail for a separate reason: window setups all run before any click
rather than being interleaved with state changes), but the source now
parses correctly and matches what upstream HS sees.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 12:01:53 +00:00
parent 7330bc1a36
commit b90aa54dd0
2 changed files with 10 additions and 6 deletions

View File

@@ -813,6 +813,10 @@ def process_hs_val(hs_val):
hs_val = re.sub(r'(\bin (?:\[.*?\]|\S+)) then\b', r'\1 ', hs_val)
hs_val = re.sub(r'\btimes then\b', 'times ', hs_val)
hs_val = re.sub(r'\bend then\b', 'end ', hs_val)
# `else then` is invalid HS — `else` already opens a new block.
hs_val = re.sub(r'\belse then\b', 'else ', hs_val)
# Same for `catch <name> then` (try/catch syntax).
hs_val = re.sub(r'\bcatch (\w+) then\b', r'catch \1 ', hs_val)
return hs_val.strip()