Skip to content

Commit

Permalink
[#335] fix clojure.test/is + are false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jul 10, 2019
1 parent f2b1f7d commit b82e5b8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
16 changes: 16 additions & 0 deletions corpus/deftest.cljc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns deftest
(:require [clojure.test :refer [deftest is are]])
(:import clojure.lang.ExceptionInfo))

(deftest are-test
(are [?a ?b]
(is (= ?a (dec ?b)))
1 2
10 11
14 15))

(deftest thown-with-msg-test
(is (thrown-with-msg?
ExceptionInfo #"uh oh"
(throw (ex-info "uh oh" {}))))
(is (thrown? ExceptionInfo (throw (ex-info "uh oh" {})))))
6 changes: 3 additions & 3 deletions src/clj_kondo/impl/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
#_(riemann.streams/where [service event])
;; ignore all unresolved symbols in one-of:
#_(clj-kondo.impl.utils/one-of)
(clojure.test/are)
(clojure.test/is [thrown-with-msg?])
]}
(clojure.test/are) (cljs.test/are)
(clojure.test/is [thrown? thrown-with-msg?])
(cljs.test/is [thrown? thrown-with-msg?])]}
:misplaced-docstring {:level :warning}
:not-empty? {:level :warning}}
:lint-as {cats.core/->= clojure.core/->
Expand Down
4 changes: 3 additions & 1 deletion test/clj_kondo/main_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,9 @@
(is (empty? (lint! "(cond-> 1 true (as-> x (inc x)))")))
(is (empty? (lint! "(reify clojure.lang.IDeref (deref [_] nil))")))
(is (empty? (lint! "(ns foo) (defn foo [] (ns bar (:require [clojure.string :as s])))")))
(is (empty? (lint! "(defn foo [x y z] ^{:a x :b y :c z} [1 2 3])"))))
(is (empty? (lint! "(defn foo [x y z] ^{:a x :b y :c z} [1 2 3])")))
(is (empty? (lint! (io/file "corpus" "deftest.cljc")
'{:linters {:unresolved-symbol {:level :error}}}))))

(deftest file-error-test
(assert-submaps '({:file "not-existing.clj",
Expand Down

0 comments on commit b82e5b8

Please sign in to comment.