aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/emacs-module-tests.el40
1 files changed, 37 insertions, 3 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 622bbadb3ef..99a853b17e0 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -19,9 +19,17 @@
19 19
20(require 'ert) 20(require 'ert)
21 21
22(require 'mod-test 22(defconst mod-test-emacs
23 (expand-file-name "data/emacs-module/mod-test" 23 (expand-file-name invocation-name invocation-directory)
24 (getenv "EMACS_TEST_DIRECTORY"))) 24 "File name of the Emacs binary currently running.")
25
26(eval-and-compile
27 (defconst mod-test-file
28 (substitute-in-file-name
29 "$EMACS_TEST_DIRECTORY/data/emacs-module/mod-test")
30 "File name of the module test file."))
31
32(require 'mod-test mod-test-file)
25 33
26;; 34;;
27;; Basic tests. 35;; Basic tests.
@@ -174,4 +182,30 @@ changes."
174 (should (equal (help-function-arglist #'mod-test-sum) 182 (should (equal (help-function-arglist #'mod-test-sum)
175 '(arg1 arg2)))) 183 '(arg1 arg2))))
176 184
185(ert-deftest module--test-assertions ()
186 "Check that -module-assertions work."
187 (skip-unless (file-executable-p mod-test-emacs))
188 ;; This doesn’t yet cause undefined behavior.
189 (should (eq (mod-test-invalid-store) 123))
190 (with-temp-buffer
191 (should (equal (call-process mod-test-emacs nil t nil
192 "-batch" "-Q" "-module-assertions" "-eval"
193 (prin1-to-string
194 `(progn
195 (require 'mod-test ,mod-test-file)
196 ;; Storing and reloading a local
197 ;; value causes undefined
198 ;; behavior, which should be
199 ;; detected by the module
200 ;; assertions.
201 (mod-test-invalid-store)
202 (mod-test-invalid-load))))
203 ;; FIXME: This string is probably different on
204 ;; Windows and Linux.
205 "Abort trap: 6"))
206 (re-search-backward (rx bos "Emacs module assertion: "
207 "Emacs value not found in "
208 (+ digit) " values of "
209 (+ digit) " environments" ?\n eos))))
210
177;;; emacs-module-tests.el ends here 211;;; emacs-module-tests.el ends here