Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/com/mjdowney/rich_comment_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,26 @@
vals
(keep (comp :file meta))
first)]
(let [nsf (io/file ns-file-from-metadata)]
;; Yet another hack: Sometimes the path taken from meta is not a full path.
;; If so, process it as a resource and resolve the full path that way.
(let [full-path (if (string/starts-with? ns-file-from-metadata (System/getProperty "user.home"))
ns-file-from-metadata
(io/resource ns-file-from-metadata))
nsf (io/file full-path)]
(when (.isFile nsf)
(.getPath nsf))))
(throw
(ex-info (str "Failed to resolve source file for ns " ns)
{:ns ns}))))

^:rct/test
(comment
(require-file-for-ns *ns*) ;=> string?
(require-file-for-ns 'com.mjdowney.rich-comment-tests) ;=> string?
(require 'com.mjdowney.rich-comment-tests.impl)
(require-file-for-ns 'com.mjdowney.rich-comment-tests.impl) ;=> string?
#_:rct/test)

(defn run-ns-tests!
"Take a namespace or namespace symbol, attempt to find the corresponding
source file, and run tests in the namespace."
Expand Down