-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
In the process #33 also got fixed.
- Loading branch information
Showing
7 changed files
with
105 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns clj-kondo.impl.macroexpand-test | ||
(:require | ||
[clj-kondo.impl.macroexpand :as macroexpand] | ||
[clj-kondo.impl.utils :refer [parse-string]] | ||
[clojure.test :as t :refer [deftest is testing]] | ||
[rewrite-clj.node.protocols :refer [tag]])) | ||
|
||
(defn location [node] | ||
(let [m (meta node)] | ||
(when (and (:row m) (:col m)) | ||
m))) | ||
|
||
(deftest expand->-test | ||
(testing | ||
"Expanded -> expression preserves location" | ||
(is | ||
(every? location | ||
(filter #(= :list (tag %)) | ||
(tree-seq :children :children | ||
(macroexpand/expand-> | ||
(parse-string "(-> 1 inc inc)")))))))) | ||
|
||
(deftest expand-fn-test | ||
(testing | ||
"Expanded function literals have a location for the function they call" | ||
(is | ||
(every? location | ||
(filter #(= :list (tag %)) | ||
(tree-seq :children :children | ||
(macroexpand/expand-fn | ||
(parse-string "#(valid? %)")))))))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters