From 4d66de6e7943a214e58d5888e1ca0b347d7288d2 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 7 Mar 2015 18:23:05 -0500 Subject: Mute messages in tests --- test-snakemake-mode.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/test-snakemake-mode.el b/test-snakemake-mode.el index 2f8e53b..b48b128 100644 --- a/test-snakemake-mode.el +++ b/test-snakemake-mode.el @@ -19,6 +19,7 @@ ;;; Code: +(require 'cl-lib) (require 'snakemake-mode) (require 'ert) @@ -29,19 +30,22 @@ Fill the buffer with TEXT. If the string \"\" appears in TEXT then remove it and place the point there before running BODY, otherwise place the point at the beginning of the inserted -text." +text. + +Also, mute messages." (declare (indent 1)) - `(let ((inside-text (if (stringp ,text) ,text (eval ,text)))) - (with-temp-buffer - (snakemake-mode) - (let ((point (string-match "" inside-text))) - (if point - (progn - (insert (replace-match "" nil nil inside-text)) - (goto-char (1+ (match-beginning 0)))) - (insert inside-text) - (goto-char (point-min)))) - ,@body))) + `(cl-letf (((symbol-function 'message) (lambda (&rest args) nil))) + (let ((inside-text (if (stringp ,text) ,text (eval ,text)))) + (with-temp-buffer + (snakemake-mode) + (let ((point (string-match "" inside-text))) + (if point + (progn + (insert (replace-match "" nil nil inside-text)) + (goto-char (1+ (match-beginning 0)))) + (insert inside-text) + (goto-char (point-min)))) + ,@body)))) (def-edebug-spec org-test-with-temp-text (form body)) -- cgit v1.2.3