Skip to content

Commit

Permalink
* convert eval comments into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Mar 4, 2025
1 parent 9b25553 commit 6e927aa
Showing 2 changed files with 12 additions and 16 deletions.
15 changes: 0 additions & 15 deletions src/test/clojure/cljs/externs_infer_tests.clj
Original file line number Diff line number Diff line change
@@ -486,21 +486,6 @@
:with-core? true})]
(is (empty? @ws)))))

(comment

(externs/info
(::ana/externs @(env/default-compiler-env))
'[console])

(externs/info
(::ana/externs @(env/default-compiler-env))
'[crypto])

(-> (externs/filtered-externs "externs.zip//w3c_webcrypto.js")
(externs/info '[crypto]))

)

(comment
(binding [ana/*cljs-ns* ana/*cljs-ns*]
(ana/no-warn
13 changes: 12 additions & 1 deletion src/test/clojure/cljs/externs_parsing_tests.clj
Original file line number Diff line number Diff line change
@@ -8,9 +8,11 @@

(ns cljs.externs-parsing-tests
(:require [cljs.closure :as closure]
[cljs.analyzer :as ana]
[cljs.env :as env]
[cljs.externs :as externs]
[clojure.java.io :as io]
[clojure.test :as test :refer [deftest is]])
[clojure.test :as test :refer [deftest is testing]])
(:import [com.google.javascript.jscomp CommandLineRunner]))

(deftest cljs-3121
@@ -45,6 +47,15 @@
(find 'HTMLDocument) first meta)]
(is (= 'Document (:super info)))))

(deftest test-parse-closure-type-annotations
(let [externs (::ana/externs @(env/default-compiler-env))]
(testing "JS global console has tag Console"
(let [info (externs/info externs '[console])]
(is (= 'Console (:tag info)))))
(testing "JS global crypto has tag webCrypto.Crypto"
(let [info (externs/info externs '[crypto])]
(is (= 'webCrypto.Crypto (:tag info)))))))

(comment

(externs/parse-externs

0 comments on commit 6e927aa

Please sign in to comment.