Created
May 6, 2012 13:10
-
-
Save bowbow99/2622281 to your computer and use it in GitHub Desktop.
#xyzzy unittest で今いるdeftestを実行
This file contains 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
;(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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!