summaryrefslogtreecommitdiff
path: root/features/support/env.el
diff options
context:
space:
mode:
Diffstat (limited to 'features/support/env.el')
-rw-r--r--features/support/env.el33
1 files changed, 27 insertions, 6 deletions
diff --git a/features/support/env.el b/features/support/env.el
index 58ed42f..3429e34 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -9,9 +9,17 @@
(defvar emacs-chess-root-path
(f-parent emacs-chess-features-path))
+;; Nikolaj Schumacher
+(defmacro measure-time (&rest body)
+ "Measure the time it takes to evaluate BODY."
+ `(let ((time (current-time)))
+ ,@body
+ (float-time (time-since time))))
+
(add-to-list 'load-path emacs-chess-root-path)
(require 'chess-ics)
+(require 'chess)
(require 'espuds)
(require 'ert)
(require 'cl)
@@ -19,6 +27,18 @@
(Setup
(defvar test-display nil)
(defvar test-fifo nil)
+ (defvar test-port nil)
+ (setq test-port (catch 'loop
+ (dolist (cand (list "5678" "5413" "5142" "5308" "5987"))
+ (when (= 1 (call-process "nc" nil nil nil "-z" "localhost" cand))
+ (throw 'loop cand)))))
+ (setq noninteractive t)
+ (custom-set-variables '(chess-sound-moves nil)
+ '(chess-display-highlight-last-move t)
+ '(chess-display-highlight-legal t)
+ '(chess-display-popup nil)
+ '(chess-display-allow-pre-moves t)
+ '(chess-images-separate-frame nil))
)
(Before
@@ -30,12 +50,13 @@
(when test-display
(chess-module-destroy test-display)
(setq test-display nil))
- (when (process-status "*chess-ics*")
- (delete-process "*chess-ics*"))
- (when test-fifo
- (process-send-eof test-fifo)
- (delete-process test-fifo)
- (setq test-fifo nil))
+ (dolist (p (process-list))
+ (delete-process p))
+ (setq test-fifo nil)
+ (let ((buf (get-buffer "*Chessboard*"))
+ (buf2 (get-buffer "*Chessboard*<2>")))
+ (if buf (kill-buffer buf))
+ (if buf2 (kill-buffer buf2)))
)
(Teardown