| 1 |
;; Initialize tests -*- lexical-binding: t -*- |
| 2 |
|
| 3 |
(defun init-rst-ert (&optional with-buffer) |
| 4 |
"Initialize tests. |
| 5 |
Prepare for buffer using tests if WITH-BUFFER." |
| 6 |
(when with-buffer |
| 7 |
(add-to-list 'load-path ".") |
| 8 |
(load "ert-buffer" nil t) |
| 9 |
(if (equal (car load-path) ".") |
| 10 |
(setq load-path (cdr load-path)))) |
| 11 |
|
| 12 |
(add-to-list 'load-path "..") |
| 13 |
(load "rst.el" nil t) |
| 14 |
(if (equal (car load-path) "..") |
| 15 |
(setq load-path (cdr load-path))) |
| 16 |
|
| 17 |
;; Emacs 24 should have a patch in `testcover-after` declaring a |
| 18 |
;; `gv-expander'. |
| 19 |
(if (< emacs-major-version 24) |
| 20 |
;; Define a setf-method for `testcover-after' so `ert' tests can be run |
| 21 |
;; without problems. |
| 22 |
(defsetf testcover-after (idx val) (store) |
| 23 |
(list 'progn |
| 24 |
(list 'testcover-after idx val) |
| 25 |
;; FIXME: Though it solves the problem it is not really correct |
| 26 |
;; because `val' is only a temporary variable here. |
| 27 |
(list 'setf val store))))) |
| 28 |
|
| 29 |
;; Clean up `load-path' if set caller just to load this file. |
| 30 |
(if (equal (car load-path) ".") |
| 31 |
(setq load-path (cdr load-path))) |