Add 21 new tests: scope/context, multi-signal, reactive DOM, VM HO forms

WASM browser tests (web/tests/test-wasm-browser.sx): 32 tests
- scope/context: push+read, default, nesting, pop reveals outer
- multi-signal: effect tracks 2 signals, computed from 2 sources,
  unsubscribe on dependency change
- reactive DOM: computed expression attrs, map rendering, component
  rendering, spread signal update, style attributes
- conditional: if/when/cond/let/begin in render-to-dom

VM HO form tests (lib/tests/test-vm.sx): +8 tests
- map, filter, reduce, for-each, some, every? in vm-eval
- nested map, map with closure over local

32/32 WASM (source+bytecode), 1593/1593 JS full (1 pre-existing silent).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 18:52:39 +00:00
parent e7fe6598c5
commit 3d6f43260b
2 changed files with 79 additions and 0 deletions

View File

@@ -303,3 +303,34 @@
((el (with-island-scope (fn (x) (append! d x)) (fn () (render-to-dom (quote (div :class (deref test-reactive-sig) "content")) (global-env) nil)))))
(reset! test-reactive-sig "after")
(dom-get-attr el "class")))))))
(defsuite
"wasm-scope-context"
(deftest
"scope-push + context reads value"
(scope-push! "test-scope" "hello")
(let
((v (context "test-scope" nil)))
(scope-pop! "test-scope")
(assert-equal "hello" v)))
(deftest
"context returns default when not pushed"
(assert-equal "default" (context "nonexistent-scope" "default")))
(deftest
"nested scope-push shadows outer"
(scope-push! "test-nest" "outer")
(scope-push! "test-nest" "inner")
(let
((v (context "test-nest" nil)))
(scope-pop! "test-nest")
(scope-pop! "test-nest")
(assert-equal "inner" v)))
(deftest
"scope-pop reveals outer"
(scope-push! "test-reveal" "outer")
(scope-push! "test-reveal" "inner")
(scope-pop! "test-reveal")
(let
((v (context "test-reveal" nil)))
(scope-pop! "test-reveal")
(assert-equal "outer" v))))