commit af0c5ba7576c9a54ee104430647d496b627dd762
parent e4a8e5a71a0ea20675a7deb795cc0ee0db04b9e9
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Sun, 1 Nov 2015 15:49:04 +0530
Improve `emojify-tests-with-emojified-buffer` to return value of last form
Diffstat:
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/emojify-tests.el b/emojify-tests.el
@@ -46,22 +46,23 @@ Helps isolate tests from each other's customizations."
(declare (indent 1))
;; Run tests in a new buffer
`(let ((test-buffer (get-buffer-create " *emojify-test-buffer*")))
- (with-current-buffer test-buffer
- ;; Rename it uniquely so that subsequent buffers do not conflict with it
- (rename-uniquely)
- ;; Save all possible customizations
- (emojify-tests-with-saved-custumizations
- (setq emojify-point-entered-behaviour nil)
- (insert ,str)
- (emojify-mode +1)
- ;; Force refontification since JIT does it lazily
- (emojify-display-emojis-in-region (point-min) (point-max))
- (goto-char (point-min))
- ,@forms))
- ;; Keep the buffer around for interactive tests, helps debugging failing
- ;; tests
- (when noninteractive
- (kill-buffer test-buffer))))
+ (unwind-protect
+ (with-current-buffer test-buffer
+ ;; Rename it uniquely so that subsequent buffers do not conflict with it
+ (rename-uniquely)
+ ;; Save all possible customizations
+ (emojify-tests-with-saved-custumizations
+ (setq emojify-point-entered-behaviour nil)
+ (insert ,str)
+ (emojify-mode +1)
+ ;; Force refontification since JIT does it lazily
+ (emojify-display-emojis-in-region (point-min) (point-max))
+ (goto-char (point-min))
+ ,@forms))
+ ;; Keep the buffer around for interactive tests, helps debugging failing
+ ;; tests
+ (when noninteractive
+ (kill-buffer test-buffer)))))
(defmacro emojify-tests-with-emojified-static-buffer (str &rest forms)
(declare (indent 1))