Skip to content

Commit 8365848

Browse files
committed
add a test case to show that :import does in fact trigger goog ns analysis,
leave note that this isn't good enough for the infer test to pass.
1 parent ccdd5f5 commit 8365848

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
[cljs.analyzer.api :as ana-api]
1313
[cljs.compiler :as comp]
1414
[cljs.env :as env]
15+
[cljs.js-deps :as deps]
1516
[cljs.test-util :refer [unsplit-lines]]
1617
[cljs.util :as util]
1718
[clojure.java.io :as io]
@@ -1793,3 +1794,14 @@
17931794
(is (= w2 "cljs.core/-, all arguments must be numbers, got [string] instead"))
17941795
(is (= w3 "cljs.core//, all arguments must be numbers, got [number string] instead"))
17951796
(is (= w4 "cljs.core/*, all arguments must be numbers, got [string] instead")))))
1797+
1798+
;; this test does pass, but shows a current problem goog file analysis
1799+
;; we only consider the functional API, we don't include information needed
1800+
;; to infer usage of classes
1801+
(deftest test-analyze-goog-ns
1802+
(let [cenv (env/default-compiler-env)]
1803+
(env/with-compiler-env cenv
1804+
(ana/analyze-form-seq
1805+
'[(ns test.foo
1806+
(:import [goog.history Html5History]))]))
1807+
(is (some? (get-in @cenv [::ana/namespaces 'goog.history.Html5History :defs])))))

0 commit comments

Comments
 (0)