Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed 'clojure-jump-between-tests-and-code' when the namespace is #105

Merged
merged 2 commits into from

2 participants

@bonega

several levels deep.

bonega added some commits
@bonega bonega Fixed 'clojure-jump-between-tests-and-code' when the namespace is
several levels deep.
22d213b
@bonega bonega More fixes for the test-structure.
As of "Leiningen 2.0.0-preview10" the structure is the following:

project/test/project/restofnamespace/core_test.clj
100570b
@technomancy technomancy merged commit ca86a89 into from
@technomancy

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 13, 2012
  1. @bonega
Commits on Nov 24, 2012
  1. @bonega

    More fixes for the test-structure.

    bonega authored
    As of "Leiningen 2.0.0-preview10" the structure is the following:
    
    project/test/project/restofnamespace/core_test.clj
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 14 deletions.
  1. +3 −7 clojure-mode.el
  2. +3 −7 clojure-test-mode.el
View
10 clojure-mode.el
@@ -1198,17 +1198,13 @@ The arguments are dir, hostname, and port. The return value should be an `alist
(defun clojure-test-for (namespace)
(let* ((namespace (clojure-underscores-for-hyphens namespace))
- (segments (split-string namespace "\\."))
- (before (subseq segments 0 clojure-test-ns-segment-position))
- (after (subseq segments clojure-test-ns-segment-position))
- (newfile (car after))
- (test-segments (append before (list newfile))))
- (mapconcat 'identity test-segments "/test/")))
+ (segments (split-string namespace "\\.")))
+ (mapconcat 'identity segments "/")))
(defun clojure-jump-to-test ()
"Jump from implementation file to test."
(interactive)
- (find-file (format "%stest/%s.clj"
+ (find-file (format "%stest/%s_test.clj"
(file-name-as-directory
(locate-dominating-file buffer-file-name "src/"))
(clojure-test-for (clojure-find-ns)))))
View
10 clojure-test-mode.el
@@ -326,13 +326,9 @@ Retuns the problem overlay if such a position is found, otherwise nil."
(defun clojure-test-implementation-for (namespace)
(let* ((namespace (clojure-underscores-for-hyphens namespace))
(segments (split-string namespace "\\."))
- (test-position
- (if (> 0 clojure-test-ns-segment-position)
- (1- (+ (length segments) clojure-test-ns-segment-position))
- clojure-test-ns-segment-position))
- (before (subseq segments 0 test-position))
- (after (subseq segments (1+ test-position)))
- (impl-segments (append before after)))
+ (namespace-end (split-string (car (last segments)) "_"))
+ (namespace-end (mapconcat 'identity (butlast namespace-end 1) "_"))
+ (impl-segments (append (butlast segments 1) (list namespace-end))))
(mapconcat 'identity impl-segments "/")))
;; Commands
Something went wrong with that request. Please try again.