Skip to content

Commit 1e06283

Browse files
committed
add warn configure flag to infer-test-helper
1 parent 81144f6 commit 1e06283

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,13 +856,14 @@
856856
))))
857857
)
858858

859-
(defn infer-test-helper [{:keys [forms externs warnings]}]
859+
(defn infer-test-helper [{:keys [forms externs warnings warn]}]
860860
(let [test-cenv (atom {::a/externs
861861
(externs/externs-map
862862
(closure/load-externs {:externs (or externs [])}))})]
863863
(a/with-warning-handlers [(collecting-warning-handler (or warnings (atom [])))]
864864
(binding [a/*cljs-ns* a/*cljs-ns*
865-
a/*cljs-warnings* (assoc a/*cljs-warnings* :infer-warning true)]
865+
a/*cljs-warnings* (assoc a/*cljs-warnings*
866+
:infer-warning (if (nil? warn) true warn))]
866867
(e/with-compiler-env test-cenv
867868
(a/analyze-form-seq forms)
868869
(with-out-str
@@ -972,4 +973,15 @@
972973

973974
(comment
974975

976+
(let [ws (atom [])
977+
res (infer-test-helper
978+
{:forms '[(ns warn-on-infer-test.app)
979+
(set! *warn-on-infer* true)
980+
(defn wrap-baz [x]
981+
(.baz x))]
982+
:externs ["src/test/externs/test.js"]
983+
:warnings ws
984+
:warn false})]
985+
(println (pr-str res) @ws))
986+
975987
)

0 commit comments

Comments
 (0)