Created
January 9, 2012 11:50
-
-
Save lazywithclass/1582626 to your computer and use it in GitHub Desktop.
TDD functions for emacs
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
(global-set-key (kbd "C-c C-r") 'run-mocha) | |
(defun run-mocha() | |
"Runs all the tests in the current buffer" | |
(interactive) | |
(let* (command result exit-value) | |
(setq command (concat "mocha -r should " (buffer-name))) | |
(setq exit-value (shell-command command)) | |
(color-modeline exit-value))) | |
(defun color-modeline(exit-value) | |
"Colors the modeline, green success red failure" | |
(interactive) | |
(let (test-result-color) | |
(if (= exit-value 0) | |
(setq test-result-color "Green") | |
(setq test-result-color "Red")) | |
(set-face-background 'modeline test-result-color) | |
(run-at-time "1 sec" nil 'no-color-modeline))) | |
(defun no-color-modeline() | |
"No color for the modeline" | |
(interactive) | |
(set-face-background 'modeline nil)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment