Skip to content

Commit b28addc

Browse files
committed
* add spec tests ns
* add first test
1 parent 8d8a55a commit b28addc

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
;; Copyright (c) Rich Hickey. All rights reserved.
2+
;; The use and distribution terms for this software are covered by the
3+
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4+
;; which can be found in the file epl-v10.html at the root of this distribution.
5+
;; By using this software in any fashion, you are agreeing to be bound by
6+
;; the terms of this license.
7+
;; You must not remove this notice, or any other, from this software.
8+
9+
(ns cljs.analyzer.spec-tests
10+
(:require [cljs.analyzer-tests :refer [analyze ns-env]]
11+
[cljs.analyzer.specs :as a]
12+
[clojure.test :as test :refer [deftest is]]
13+
[clojure.spec.alpha :as s]))
14+
15+
(deftest test-if
16+
(is '(s/valid? ::a/node (analyze ns-env '(if true true false)))))
17+
18+
(comment
19+
20+
(test/run-tests)
21+
22+
)

src/test/clojure/cljs/analyzer/specs.cljc

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@
5252
(defmethod node :const [_]
5353
(s/merge ::base
5454
(s/keys
55-
:req-un [::literal? ::val]
56-
:opt-un [])))
55+
:req-un [::val]
56+
;; ::literal? is required in the AST REF, but we don't actually use it
57+
;; should check tools.analyzer
58+
:opt-un [::literal?])))
5759

5860
(s/def ::keys (s/* ::node))
5961
(s/def ::vals (s/* ::node))

0 commit comments

Comments
 (0)