Created
June 28, 2013 18:20
-
-
Save mgaare/5886837 to your computer and use it in GitHub Desktop.
Settings to allow test <-> implementation file jumping to work when using speclj rather than clojure.test
This file contains hidden or 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
;; test mode setup for speclj | |
(require 'clojure-test-mode) | |
;; Test navigation: | |
(defun clojure-in-tests-p () | |
(or (string-match-p "spec\." (clojure-find-ns)) | |
(string-match-p "/spec" (buffer-file-name)))) | |
(defun clojure-test-for (namespace) | |
"Returns the path of the test file for the given namespace." | |
(let* ((namespace (clojure-underscores-for-hyphens namespace)) | |
(segments (split-string namespace "\\."))) | |
(format "%sspec/%s_spec.clj" | |
(file-name-as-directory | |
(locate-dominating-file buffer-file-name "src/")) | |
(mapconcat 'identity segments "/")))) | |
(defvar clojure-test-for-fn 'clojure-test-for) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment