Skip to content

Commit

Permalink
* add test-throw
Browse files Browse the repository at this point in the history
* add test-def
  • Loading branch information
swannodette committed Oct 25, 2024
1 parent 68e120f commit 2bd179a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/clojure/cljs/analyzer/spec_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))
Expand All @@ -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))))

)

0 comments on commit 2bd179a

Please sign in to comment.