From 70b16c70f1faeec28840998c8516c2ee48eefdd5 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Sun, 17 Nov 2024 14:42:05 -0500 Subject: [PATCH] * add js-array --- src/test/clojure/cljs/analyzer/spec_tests.clj | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/clojure/cljs/analyzer/spec_tests.clj b/src/test/clojure/cljs/analyzer/spec_tests.clj index e7c7dd820..844c2e0d4 100644 --- a/src/test/clojure/cljs/analyzer/spec_tests.clj +++ b/src/test/clojure/cljs/analyzer/spec_tests.clj @@ -12,7 +12,8 @@ [cljs.analyzer-tests :refer [analyze ns-env]] [cljs.analyzer.specs :as a] [clojure.test :as test :refer [deftest is]] - [clojure.spec.alpha :as s])) + [clojure.spec.alpha :as s]) + (:import [java.io StringReader])) (deftest test-binding (let [node (analyze ns-env '(let [x 1] x)) @@ -114,11 +115,19 @@ (is (= :invoke (:op node))) (is (s/valid? ::a/node node)))) -;; js-array +(deftest test-js-array + (let [node (analyze ns-env + (ana-api/with-state (ana-api/empty-state) + (first (ana-api/forms-seq (StringReader. "#js [1 2 3]")))))] + (is (= :js-array (:op node))) + (is (s/valid? ::a/node node)))) -;; js-object -;(deftest test-js-object -; ) +#_(deftest test-js-object + (let [node (analyze ns-env + (ana-api/with-state (ana-api/empty-state) + (first (ana-api/forms-seq (StringReader. "#js {:foo 1 :bar 2}")))))] + (is (= :js-object (:op node))) + (is (s/valid? ::a/node node)))) ;; js-var