diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-03-07 18:23:05 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-03-07 18:23:05 -0500 |
commit | 4d66de6e7943a214e58d5888e1ca0b347d7288d2 (patch) | |
tree | 82b48dc7a352b9dfb6969fae41c25aff34dfe450 | |
parent | 8540bfcee23880fd64a41739308c20503a1a25e5 (diff) | |
download | snakemake-mode-4d66de6e7943a214e58d5888e1ca0b347d7288d2.tar.gz |
Mute messages in tests
-rw-r--r-- | test-snakemake-mode.el | 28 |
1 files 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 \"<point>\" 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 "<point>" 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 "<point>" 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)) |