HS: cookies iteration via host-iter? before dict? (+1 test)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -140,6 +140,23 @@ SKIP_TEST_NAMES = {
|
||||
"Response can be converted to JSON via as JSON",
|
||||
}
|
||||
|
||||
# Manually-written SX test bodies for tests whose upstream body cannot be
|
||||
# auto-translated. Key = test name; value = SX lines to emit inside deftest.
|
||||
MANUAL_TEST_BODIES = {
|
||||
"iterate cookies values work": [
|
||||
' (hs-cleanup!)',
|
||||
' (host-set! (host-global "cookies") "foo" "bar")',
|
||||
' (let ((_names (list)) (_values (list)))',
|
||||
' (hs-for-each',
|
||||
' (fn (x)',
|
||||
' (append! _names (host-get x "name"))',
|
||||
' (append! _values (host-get x "value")))',
|
||||
' (host-global "cookies"))',
|
||||
' (assert-contains "foo" _names)',
|
||||
' (assert-contains "bar" _values))',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def find_me_receiver(elements, var_names, tag):
|
||||
"""For tests with multiple top-level elements of the same tag, find the
|
||||
@@ -2599,6 +2616,11 @@ def generate_compile_only_test(test):
|
||||
|
||||
def generate_test(test, idx):
|
||||
"""Generate SX deftest for an upstream test. Dispatches to Chai, PW, or eval-only."""
|
||||
if test['name'] in MANUAL_TEST_BODIES:
|
||||
name = sx_name(test['name'])
|
||||
lines = [f' (deftest "{name}"'] + MANUAL_TEST_BODIES[test['name']] + [' )']
|
||||
return '\n'.join(lines)
|
||||
|
||||
elements = parse_html(test['html'])
|
||||
|
||||
if not elements and not test.get('html', '').strip():
|
||||
|
||||
Reference in New Issue
Block a user