From 2bd179a7f824487f3e08f4f5459c5529d9394cff Mon Sep 17 00:00:00 2001 From: davidnolen Date: Fri, 25 Oct 2024 13:50:45 -0400 Subject: [PATCH] * add test-throw * add test-def --- src/test/clojure/cljs/analyzer/spec_tests.clj | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/clojure/cljs/analyzer/spec_tests.clj b/src/test/clojure/cljs/analyzer/spec_tests.clj index ef5ba35ec..44ab18ef4 100644 --- a/src/test/clojure/cljs/analyzer/spec_tests.clj +++ b/src/test/clojure/cljs/analyzer/spec_tests.clj @@ -27,6 +27,15 @@ (is (s/valid? ::a/node (analyze ns-env '(let [x 1])))) (is (s/valid? ::a/node (analyze ns-env '(let [x 1] x))))) +(deftest test-throw + (is (s/valid? ::a/node (no-warn (analyze ns-env '(throw (js/Error. "foo"))))))) + +(deftest test-def + (is (s/valid? ::a/node (no-warn (analyze ns-env '(def x))))) + (is (s/valid? ::a/node (no-warn (analyze ns-env '(def x 1))))) + (is (s/valid? ::a/node (no-warn (analyze ns-env '(fn []))))) + (is (s/valid? ::a/node (no-warn (analyze ns-env '(fn [] 1)))))) + (deftest test-new (is (s/valid? ::a/node (no-warn (analyze ns-env '(new String))))) (is (s/valid? ::a/node (no-warn (analyze ns-env '(new js/String))))) @@ -37,4 +46,13 @@ (test/run-tests) + (s/valid? ::a/node (no-warn (analyze ns-env '(case x 1 :foo 2 :bar)))) + (s/explain ::a/node (no-warn (analyze ns-env '(case x 1 :foo 2 :bar)))) + + (s/valid? ::a/node (no-warn (analyze ns-env '(def x (fn []))))) + (s/explain ::a/node (no-warn (analyze ns-env '(def x (fn []))))) + + (s/valid? ::a/node (no-warn (analyze ns-env '(fn [x])))) + (s/valid? ::a/node (no-warn (analyze ns-env '(fn [x] 1)))) + )