Skip to content

Commit

Permalink
Fix #219 - No dbg messages for pre/postconditions that are expanded a…
Browse files Browse the repository at this point in the history
…s if statements
  • Loading branch information
jafingerhut committed Oct 11, 2017
1 parent 028bb22 commit 89d89c6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cases/testcases/wrongprepost2.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(ns testcases.wrongprepost2
(:require [clojure.spec.alpha :as spec]))


(defn issue-219-fn [data]
{:pre [(spec/assert ::my-spec data)]}
(assoc data 5 7))
2 changes: 1 addition & 1 deletion src/eastwood/linters/typos.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ warning, that contains the constant value."
;; The following kinds of things are 'complex' enough that we
;; will not try to do any fancy calculation to determine
;; whether their results are constant or not.
(#{:invoke :static-call :let :instance?} (:op test-ast))
(#{:invoke :static-call :let :if :instance?} (:op test-ast))
nil

:else
Expand Down
15 changes: 15 additions & 0 deletions test/eastwood/test/linters_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
[1 8])
0))

(def clojure-1-9-or-later
(>= (compare ((juxt :major :minor) *clojure-version*)
[1 9])
0))

(def lint-warning-map-keys-for-testing-in-order
[:linter
:msg
Expand Down Expand Up @@ -1853,3 +1858,13 @@ the next."
;; default-opts
;; {})
)


(deftest test2
(when clojure-1-9-or-later
(lint-test
'testcases.wrongprepost2
@#'eastwood.lint/default-linters
default-opts
{}))
)

0 comments on commit 89d89c6

Please sign in to comment.