From 3222b53d942daa404852e5148ba9d3ebb8fe96d0 Mon Sep 17 00:00:00 2001 From: dickmao Date: Mon, 27 Aug 2018 17:00:35 -0400 Subject: Pre-moves To activate, look for Chess Display Allow Pre Moves in: M-x customize-group chess-display Tested via: make test make test24 (requires evim) --- features/support/env.el | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'features/support/env.el') 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 -- cgit v1.2.3