From 7833fc2716a14a27ec8803f53a8c53afd7731db5 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 22 Apr 2026 20:36:45 +0000 Subject: [PATCH] HS test generator: flatten whitespace in toEqual({...}) TODO comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Pattern 1c emitter wrote `;; TODO: assert= ... against {...}` for object-literal .toEqual() assertions it couldn't translate. It only .strip()'d the literal, leaving internal newlines intact — so a multi-line `{...}` leaked SX-invalid text onto subsequent lines and broke the parse for the rest of the suite. Collapse all whitespace inside the literal so the `;;` prefix covers the whole comment. After regenerating, 1,022/1,496 pass (was 1,013/1,496 with a hand- patched behavioral.sx). No runtime changes. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/playwright/generate-sx-tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/playwright/generate-sx-tests.py b/tests/playwright/generate-sx-tests.py index f6025a85..14fb2123 100644 --- a/tests/playwright/generate-sx-tests.py +++ b/tests/playwright/generate-sx-tests.py @@ -1072,8 +1072,11 @@ def generate_eval_only_test(test, idx): body, re.DOTALL ): hs_expr = extract_hs_expr(m.group(2)) - # Object toEqual — emit as dict assertion comment (can't fully convert JS objects to SX) - obj_str = m.group(3).strip() + # Object toEqual — emit as single-line TODO comment. Collapse + # whitespace inside the JS literal so the `;;` prefix covers the + # whole line; a multi-line `{...}` would leak SX-invalid text + # onto subsequent lines and break the parse. + obj_str = re.sub(r'\s+', ' ', m.group(3)).strip() assertions.append(f' ;; TODO: assert= (eval-hs "{hs_expr}") against {obj_str}') # Pattern 2: Two-line — var result = await run(`expr`, opts); expect(result...).toBe/toEqual(val)