1
;;; sh-werk-setup-ert-tests.el --- Provide needed forms
3
;; Copyright (C) 2015 Andreas Röhler
5
;; Author: Andreas Röhler <andreas.roehler@easy-emacs.de>
9
;; This program is free software; you can redistribute it and/or modify
10
;; it under the terms of the GNU General Public License as published by
11
;; the Free Software Foundation, either version 3 of the License, or
12
;; (at your option) any later version.
14
;; This program is distributed in the hope that it will be useful,
15
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
;; GNU General Public License for more details.
19
;; You should have received a copy of the GNU General Public License
20
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
26
(defvar ar-switch-p nil
27
"Switch into test-buffer.")
29
(defcustom ar-switch-p nil
34
(defun ar-toggle-switch-p ()
35
"Toggle `ar-switch-p'. "
37
(setq ar-switch-p (not ar-switch-p))
38
(message "ar-switch-p: %s" ar-switch-p))
40
(defmacro ar-test-with-temp-buffer (contents &rest body)
41
"Create temp buffer inserting CONTENTS.
42
BODY is code to be executed within the temp buffer. Point is
43
at the end of buffer."
44
(declare (indent 2) (debug t))
49
(switch-to-buffer (current-buffer)))
50
(font-lock-fontify-buffer)
53
(defmacro ar-test-with-temp-buffer-point-min (contents &rest body)
54
"Create temp buffer inserting CONTENTS.
55
BODY is code to be executed within the temp buffer. Point is
56
at the end of buffer."
57
(declare (indent 2) (debug t))
61
(goto-char (point-min))
63
(switch-to-buffer (current-buffer)))
64
(font-lock-fontify-buffer)
67
(defmacro ar-test-with-python-buffer-point-min (contents &rest body)
68
"Create temp buffer in `python-mode' inserting CONTENTS.
69
BODY is code to be executed within the temp buffer. Point is
70
at the beginning of buffer."
71
(declare (indent 1) (debug t))
76
(goto-char (point-min))
78
(switch-to-buffer (current-buffer)))
79
(font-lock-fontify-buffer)
82
(defmacro ar-test-with-python-buffer (contents &rest body)
83
"Create temp buffer in `python-mode' inserting CONTENTS.
84
BODY is code to be executed within the temp buffer. Point is
85
at the end of buffer."
86
(declare (indent 1) (debug t))
92
(switch-to-buffer (current-buffer)))
93
(font-lock-fontify-buffer)
94
;; (message "ERT %s" (point))
97
(defmacro ar-test-with-haskell-buffer-point-min (contents &rest body)
98
"Create temp buffer in `haskell-mode' inserting CONTENTS.
99
BODY is code to be executed within the temp buffer. Point is
100
at the beginning of buffer."
101
(declare (indent 1) (debug t))
106
(goto-char (point-min))
108
(switch-to-buffer (current-buffer)))
109
(font-lock-fontify-buffer)
112
(defmacro ar-test-with-haskell-buffer (contents &rest body)
113
"Create temp buffer in `haskell-mode' inserting CONTENTS.
114
BODY is code to be executed within the temp buffer. Point is
115
at the end of buffer."
116
(declare (indent 1) (debug t))
122
(switch-to-buffer (current-buffer)))
123
(font-lock-fontify-buffer)
124
;; (message "ERT %s" (point))
127
(defmacro ar-test-with-elisp-buffer (contents &rest body)
128
"Create temp buffer in `emacs-lisp-mode' inserting CONTENTS.
129
BODY is code to be executed within the temp buffer. Point is
130
at the end of buffer."
131
(declare (indent 1) (debug t))
137
(switch-to-buffer (current-buffer)))
138
(font-lock-fontify-buffer)
141
(defmacro ar-test-with-elisp-buffer-point-min (contents &rest body)
142
"Create temp buffer inserting CONTENTS.
143
BODY is code to be executed within the temp buffer. Point is
144
at the end of buffer."
145
(declare (indent 2) (debug t))
150
(goto-char (point-min))
152
(switch-to-buffer (current-buffer)))
153
(font-lock-fontify-buffer)
156
(defmacro ar-test-with-shell-script-buffer (contents &rest body)
157
"Create temp buffer in shell-script mode inserting CONTENTS.
158
BODY is code to be executed within the temp buffer. Point is
159
at the end of buffer."
160
(declare (indent 2) (debug t))
166
(switch-to-buffer (current-buffer)))
167
(font-lock-fontify-buffer)
170
(defmacro ar-test-with-shell-script-buffer-point-min (contents &rest body)
171
"Create temp buffer inserting CONTENTS.
172
BODY is code to be executed within the temp buffer. Point is
173
at the end of buffer."
174
(declare (indent 2) (debug t))
179
(goto-char (point-min))
181
(switch-to-buffer (current-buffer)))
182
(font-lock-fontify-buffer)
185
(provide 'ar-setup-ert-tests)
186
;; sh-werk-setup-ert-tests.el ends here