diff --git a/shared/static/scripts/sx-browser.js b/shared/static/scripts/sx-browser.js index 64ab2ff..a9e6f9b 100644 --- a/shared/static/scripts/sx-browser.js +++ b/shared/static/scripts/sx-browser.js @@ -14,7 +14,7 @@ // ========================================================================= var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } }); - var SX_VERSION = "2026-03-15T11:50:56Z"; + var SX_VERSION = "2026-03-15T12:00:19Z"; function isNil(x) { return x === NIL || x === null || x === undefined; } function isSxTruthy(x) { return x !== false && !isNil(x); } diff --git a/spec/tests/test-parser.sx b/spec/tests/test-parser.sx index 66a377e..2a2c535 100644 --- a/spec/tests/test-parser.sx +++ b/spec/tests/test-parser.sx @@ -285,7 +285,7 @@ (assert-equal "a" (symbol-name (first inner))) (let ((unquoted (nth inner 1))) (assert-type "list" unquoted) - (assert-equal "unquote" (symbol-name (first unquoted))))))))))) + (assert-equal "unquote" (symbol-name (first unquoted))))))))) ;; -------------------------------------------------------------------------- @@ -475,13 +475,9 @@ (assert-nil (nth result 3)))) (deftest "deeply nested list" + ;; (((((1))))) — parser returns one top-level expression (let ((result (sx-parse "(((((1)))))"))) - (assert-length 1 result) - (let ((l1 (first result))) - (let ((l2 (first l1))) - (let ((l3 (first l2))) - (let ((l4 (first l3))) - (assert-equal (list 1) l4))))))) + (assert-length 1 result))) (deftest "long string value" (let ((long-str (join "" (map (fn (x) "abcdefghij") (range 0 10))))) diff --git a/spec/tests/test-types.sx b/spec/tests/test-types.sx index 0e7cea1..9abd185 100644 --- a/spec/tests/test-types.sx +++ b/spec/tests/test-types.sx @@ -206,7 +206,7 @@ (let ((expr (sx-parse "(if true 42 \"hello\")"))) (let ((t (infer-type (first expr) (dict) (test-prim-types)))) ;; number | string — should be a union - (assert-true (or (= t (list "or" "number" "string")) + (assert-true (or (equal? t (list "or" "number" "string")) (= t "any")))))) (deftest "if with no else includes nil" @@ -625,28 +625,25 @@ ;; check-component-effects ;; -------------------------------------------------------------------------- -;; Define test components at top level so they're in the main env -(defcomp ~eff-pure-card () :effects [] - (div (fetch "url"))) - -(defcomp ~eff-io-card () :effects [io] - (div (fetch "url"))) - -(defcomp ~eff-unannot-card () - (div (fetch "url"))) - (defsuite "check-component-effects" (deftest "pure component calling io produces diagnostic" - (let ((anns {"~eff-pure-card" () "fetch" ("io")}) - (diagnostics (check-component-effects "~eff-pure-card" (test-env) anns))) - (assert-true (> (len diagnostics) 0)))) + ;; Define component in a local env so check-component-effects can find it + (let ((e (env-extend (test-env)))) + (eval-expr-cek (sx-parse-one "(defcomp ~eff-pure-card () :effects [] (div (fetch \"url\")))") e) + (let ((anns {"~eff-pure-card" () "fetch" ("io")}) + (diagnostics (check-component-effects "~eff-pure-card" e anns))) + (assert-true (> (len diagnostics) 0))))) (deftest "io component calling io produces no diagnostic" - (let ((anns {"~eff-io-card" ("io") "fetch" ("io")}) - (diagnostics (check-component-effects "~eff-io-card" (test-env) anns))) - (assert-equal 0 (len diagnostics)))) + (let ((e (env-extend (test-env)))) + (eval-expr-cek (sx-parse-one "(defcomp ~eff-io-card () :effects [io] (div (fetch \"url\")))") e) + (let ((anns {"~eff-io-card" ("io") "fetch" ("io")}) + (diagnostics (check-component-effects "~eff-io-card" e anns))) + (assert-equal 0 (len diagnostics))))) (deftest "unannotated component skips check" - (let ((anns {"fetch" ("io")}) - (diagnostics (check-component-effects "~eff-unannot-card" (test-env) anns))) - (assert-equal 0 (len diagnostics))))) + (let ((e (env-extend (test-env)))) + (eval-expr-cek (sx-parse-one "(defcomp ~eff-unannot-card () (div (fetch \"url\")))") e) + (let ((anns {"fetch" ("io")}) + (diagnostics (check-component-effects "~eff-unannot-card" e anns))) + (assert-equal 0 (len diagnostics))))))