Skip to content

Commit

Permalink
Merge pull request #208 from voytech/master
Browse files Browse the repository at this point in the history
Fixed issues: #207 unit tests fails on win due to line breaks, #206 driver/run returns simplify maps with no :file
  • Loading branch information
danielcompton authored Feb 10, 2018
2 parents 7847a7d + e068571 commit c2d5e48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions kibit/src/kibit/check.clj
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@
(with-open [reader (io/reader source-file)]
(with-bindings default-data-reader-binding
(doall (map (fn [simplify-map]
(do (reporter (assoc simplify-map :file source-file))
simplify-map))
(let [file-simplify (assoc simplify-map :file source-file)]
(reporter file-simplify)
file-simplify))
(check-reader reader
:rules rules
:guard guard
Expand Down
13 changes: 9 additions & 4 deletions kibit/test/kibit/test/reporters.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
[clojure.string :as string]
[clojure.test :refer :all]))

(defn- reported-lines [reporting]
(->> (clojure.string/split reporting #"\n")
(mapv #(clojure.string/replace % "\r" ""))
(filterv (complement clojure.string/blank?))))

(deftest plain
(are [check-map result]
(= (with-out-str (reporters/cli-reporter check-map))
(string/join "\n" result))
(string/join (System/getProperty "line.separator") result))
{:file "some/file.clj"
:line 30
:expr '(+ x 1)
Expand All @@ -15,11 +20,11 @@
" (inc x)"
"instead of:"
" (+ x 1)"
"" ""]))
"" ""]))
(deftest gfm
(are [check-map result]
(= (with-out-str (reporters/gfm-reporter check-map))
(string/join "\n" result))
(string/join (System/getProperty "line.separator") result))
{:file "some/file.clj"
:line 30
:expr '(+ x 1)
Expand All @@ -33,4 +38,4 @@
"```clojure"
" (+ x 1)"
"```"
"" ""]))
"" ""]))

0 comments on commit c2d5e48

Please sign in to comment.