Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #94 from Imasius/leiningen-test-structure

Update clojure-test-mode for leiningen test structure.
  • Loading branch information...
commit 80994d866704e637934d980a4a4f751ab4d3edaa 2 parents 96e5a7e + 2be006f
@technomancy technomancy authored
Showing with 10 additions and 8 deletions.
  1. +4 −3 clojure-mode.el
  2. +6 −5 clojure-test-mode.el
View
7 clojure-mode.el
@@ -109,8 +109,8 @@ Clojure to load that file."
(define-key map "\C-c\C-e" 'lisp-eval-last-sexp)
(define-key map "\C-c\C-l" 'clojure-load-file)
(define-key map "\C-c\C-r" 'lisp-eval-region)
+ (define-key map (kbd "C-c C-s") 'clojure-jump-between-tests-and-code)
(define-key map "\C-c\C-z" 'clojure-display-inferior-lisp-buffer)
- (define-key map (kbd "C-c t") 'clojure-jump-to-test)
(define-key map (kbd "C-c M-q") 'clojure-fill-docstring)
map)
"Keymap for Clojure mode. Inherits from `lisp-mode-shared-map'.")
@@ -1172,7 +1172,7 @@ The arguments are dir, hostname, and port. The return value should be an `alist
;; Test navigation:
(defun clojure-in-tests-p ()
- (or (string-match-p "test\." (clojure-find-ns))
+ (or (string-match-p "-test$" (clojure-find-ns))
(string-match-p "/test" (buffer-file-name))))
(defun clojure-underscores-for-hyphens (namespace)
@@ -1183,7 +1183,8 @@ The arguments are dir, hostname, and port. The return value should be an `alist
(segments (split-string namespace "\\."))
(before (subseq segments 0 clojure-test-ns-segment-position))
(after (subseq segments clojure-test-ns-segment-position))
- (test-segments (append before (list "test") after)))
+ (newfile (format "%s_test" (car after)))
+ (test-segments (append before (list newfile))))
(mapconcat 'identity test-segments "/")))
(defun clojure-jump-to-test ()
View
11 clojure-test-mode.el
@@ -325,9 +325,10 @@ Retuns the problem overlay if such a position is found, otherwise nil."
(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)))
+ (before (subseq segments 0 clojure-test-ns-segment-position))
+ (after (subseq segments clojure-test-ns-segment-position))
+ (newfile (replace-regexp-in-string "_test$" "" (car after)))
+ (impl-segments (append before (list newfile))))
(mapconcat 'identity impl-segments "/")))
;; Commands
@@ -343,7 +344,7 @@ Retuns the problem overlay if such a position is found, otherwise nil."
(clojure-test-clear
(lambda (&rest args)
;; clojure-test-eval will wrap in with-out-str
- (clojure-test-eval (format "(clojure.core/load-file %s)"
+ (clojure-test-eval (format "(clojure.core/load-file \"%s\")"
(expand-file-name (buffer-file-name)))
(lambda (&rest args)
(clojure-test-eval "(binding [clojure.test/report
@@ -428,7 +429,7 @@ Retuns the problem overlay if such a position is found, otherwise nil."
(define-key map (kbd "C-c C-'") 'clojure-test-show-result)
(define-key map (kbd "C-c '") 'clojure-test-show-result)
(define-key map (kbd "C-c k") 'clojure-test-clear)
- (define-key map (kbd "C-c t") 'clojure-test-jump-to-implementation)
+ (define-key map (kbd "C-c C-s") 'clojure-jump-between-tests-and-code)
(define-key map (kbd "M-p") 'clojure-test-previous-problem)
(define-key map (kbd "M-n") 'clojure-test-next-problem)
map)
Please sign in to comment.
Something went wrong with that request. Please try again.