diff --git a/src/test/clojure/cljs/analyzer/spec_tests.clj b/src/test/clojure/cljs/analyzer/spec_tests.clj index faca7b06a..72167104c 100644 --- a/src/test/clojure/cljs/analyzer/spec_tests.clj +++ b/src/test/clojure/cljs/analyzer/spec_tests.clj @@ -123,9 +123,9 @@ (is (s/valid? ::a/node node))) (let [node (analyze ns-env '(loop [x 1] x))] (is (s/valid? ::a/node node))) - #_(let [node (analyze ns-env '(loop [x 1] (recur (inc x))))] + (let [node (analyze ns-env '(loop [x 1] (recur (inc x))))] (is (s/valid? ::a/node node))) - #_(let [node (no-warn + (let [node (no-warn (analyze ns-env '(loop [x 100] (if (pos? x) @@ -133,7 +133,15 @@ x))))] (is (s/valid? ::a/node node)))) -;; leftfn +(deftest test-recur + (let [node (no-warn (analyze ns-env '(fn [x] (recur (inc x)))))] + (is (s/valid? ::a/node node)))) + +(deftest test-case + (let [node (no-warn (analyze ns-env '(case x 1 :foo 2 :bar)))] + (is (s/valid? ::a/node node)))) + +;; letfn ;; local @@ -145,7 +153,4 @@ (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)))) - ) diff --git a/src/test/clojure/cljs/analyzer/specs.cljc b/src/test/clojure/cljs/analyzer/specs.cljc index 11b6ab029..2ef433cd0 100644 --- a/src/test/clojure/cljs/analyzer/specs.cljc +++ b/src/test/clojure/cljs/analyzer/specs.cljc @@ -286,6 +286,13 @@ (s/keys :req-un [::meta ::expr]))) +(s/def ::code string?) + +(defmethod node :js [_] + (s/merge ::base + (s/keys + :opt-un [::code]))) + (comment (s/valid? ::node 1)