Skip to content

Instantly share code, notes, and snippets.

@bowbow99
Created May 6, 2012 13:10
Show Gist options
  • Save bowbow99/2622281 to your computer and use it in GitHub Desktop.
Save bowbow99/2622281 to your computer and use it in GitHub Desktop.
#xyzzy unittest で今いるdeftestを実行
;(require "simple-test") ;無駄だった
(defun read-deftest-at-point ()
"カーソル位置の deftest 式を読み込む。"
(save-excursion
(while (up-list -1 t))
(let ((*readtable* *test-file-readtable*)
(*package* (find-package :user)))
(with-input-from-selected-buffer (read)))))
(defun run-test-at-point ()
"カーソル位置の deftest を実行する。"
(interactive)
(let ((form (read-deftest-at-point)))
(unless (and (consp form)
(eql (car form) (find-symbol "deftest" :user)))
(error "deftest 式じゃないです: ~S" form))
(eval form)
(run-tests (list (find-test (second form))))))
;; キーはお好みで
(define-key ed::*lisp-mode-map* '(#\C-c #\C-e) 'run-test-at-point)
@deecay
Copy link

deecay commented May 7, 2012

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment