HS: finally blocks in on handlers (+6 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s

Remove 6 finally-block tests from SKIP_TEST_NAMES in generator.
The finally feature was already fully implemented in parser.sx and
compiler.sx — the tests were just being suppressed. Regenerating
the spec file makes them active.

Tests now passing:
- basic finally blocks work
- async basic finally blocks work
- finally blocks work when exception thrown in catch
- async finally blocks work when exception thrown in catch
- exceptions in finally block don't kill the event queue
- async exceptions in finally block don't kill the event queue

Suite hs-upstream-on: 54/70 → 60/70

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 09:21:06 +00:00
parent 26ee00dff1
commit e9ddf31181
2 changed files with 36 additions and 12 deletions

View File

@@ -9242,7 +9242,12 @@
;; ── on (70 tests) ──
(defsuite "hs-upstream-on"
(deftest "async basic finally blocks work"
(error "SKIP (skip-list): async basic finally blocks work"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click wait a tick then throw \"bar\" finally put \"bar\" into me")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "async exceptions don't kill the event queue"
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
@@ -9251,11 +9256,26 @@
(hs-activate! _el-button)
))
(deftest "async exceptions in finally block don't kill the event queue"
(error "SKIP (skip-list): async exceptions in finally block don't kill the event queue"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click increment :x finally then if :x is 1 then wait 1ms then throw \"bar\" otherwise then put \"success\" into me end")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "async finally blocks work when exception thrown in catch"
(error "SKIP (skip-list): async finally blocks work when exception thrown in catch"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click wait a tick then throw \"bar\" catch e set :foo to \"foo\" then throw e finally put :foo + \"bar\" into me")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "basic finally blocks work"
(error "SKIP (skip-list): basic finally blocks work"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click throw \"bar\" finally put \"bar\" into me")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "can be in a top level script tag"
(error "SKIP (skip-list): can be in a top level script tag"))
(deftest "can catch async top-level exceptions"
@@ -9594,9 +9614,19 @@
(hs-activate! _el-button)
))
(deftest "exceptions in finally block don't kill the event queue"
(error "SKIP (skip-list): exceptions in finally block don't kill the event queue"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click increment :x finally then if :x is 1 then throw \"bar\" otherwise then put \"success\" into me end")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "finally blocks work when exception thrown in catch"
(error "SKIP (skip-list): finally blocks work when exception thrown in catch"))
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click throw \"bar\" catch e throw e finally put \"bar\" into me")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
))
(deftest "halt the event stops propagation to ancestors"
(hs-cleanup!)
(let ((_el-outer (dom-create-element "div")) (_el-inner (dom-create-element "button")))