HS test generator: bind run() me: and balanced-brace locals — +2 comparisonOperator

Two related Pattern 1 bugs:

1. The locals capture used `\\{([^}]+)\\}` (greedy non-`}` chars), so
   `locals: { that: [1, 2, 3] }` truncated at the first `,` inside `[...]`
   and bound `that` to `"[1"`. Switched to balanced-brace extraction +
   `split_top_level` so nested arrays/objects survive.

2. `{ me: <X> }` was only forwarded to the SX runtime when X was a single
   integer (eval-hs-with-me only accepts numbers). For `me: [1, 2, 3]`
   or `me: 1` alongside other locals, `me` was silently dropped, so
   `I contain that` couldn't see its receiver. Now any non-numeric `me`
   value is bound as a local (`(list (quote me) <val>)`); a numeric
   `me` alongside other locals/setups is also bound, so the HS expr
   always sees its `me`.

comparisonOperator 79/83 → 81/83 (+2: contains/includes works with arrays).
bind unchanged (43/44).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 11:41:47 +00:00
parent e4773ec336
commit 19f5bf7d72
2 changed files with 44 additions and 12 deletions

View File

@@ -4341,8 +4341,8 @@
(assert= (eval-hs "'Hello World' contains 'missing' ignoring case") false)
)
(deftest "contains works with arrays"
(assert= (eval-hs-locals "I contain that" (list (list (quote that) 1))) true)
(assert= (eval-hs-locals "that contains me" (list (list (quote that) "[1"))) true)
(assert= (eval-hs-locals "I contain that" (list (list (quote that) 1) (list (quote me) (list 1 2 3)))) true)
(assert= (eval-hs-locals "that contains me" (list (list (quote that) (list 1 2 3)) (list (quote me) 1))) true)
)
(deftest "contains works with css literals"
(hs-cleanup!)
@@ -4501,8 +4501,8 @@
(assert= (eval-hs-locals "foobar does not include foo" (list (list (quote foo) "foo") (list (quote foobar) "foobar"))) false)
)
(deftest "includes works with arrays"
(assert= (eval-hs-locals "I include that" (list (list (quote that) 1))) true)
(assert= (eval-hs-locals "that includes me" (list (list (quote that) "[1"))) true)
(assert= (eval-hs-locals "I include that" (list (list (quote that) 1) (list (quote me) (list 1 2 3)))) true)
(assert= (eval-hs-locals "that includes me" (list (list (quote that) (list 1 2 3)) (list (quote me) 1))) true)
)
(deftest "includes works with css literals"
(hs-cleanup!)