Skip to content

Instantly share code, notes, and snippets.

@lsgrep
Created September 30, 2015 12:16
Show Gist options
  • Save lsgrep/f89d6b5afb1fac7e4ded to your computer and use it in GitHub Desktop.
Save lsgrep/f89d6b5afb1fac7e4ded to your computer and use it in GitHub Desktop.
(defun clojure-test-filename ()
(concat (projectile-project-root)
"test/"
(mapconcat #'identity
(butlast (split-string (cider-current-ns) "\\.")) "/")
"/"
(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))
"_test.clj"))
(defadvice projectile-toggle-between-implementation-and-test (around create-clojure-test-advice)
"Visit new file if can't find test"
(condition-case nil
ad-do-it
(error (find-file (clojure-test-filename)))))
(ad-activate 'projectile-toggle-between-implementation-and-test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment