summaryrefslogtreecommitdiff
path: root/test/src/data-tests.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2019-02-12 16:33:23 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2019-02-12 16:33:23 -0500
commit3f4b8e9a299f88a8ea11c0ea6a281a34852e541a (patch)
treeb8e7c1a11db4e76a9ec156b84a41b11288a763c8 /test/src/data-tests.el
parentb384996e86cb5172dd0d5283f178de7f2654a2f4 (diff)
downloademacs-3f4b8e9a299f88a8ea11c0ea6a281a34852e541a.tar.gz
* src/data.c (Fmake_local_variable): Fix bug#34318
Revert part of ed962f2b8a. * test/src/data-tests.el (data-tests-make-local-forwarded-var): Add corresponding test.
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r--test/src/data-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 0069ee84fe1..f3b4262de4b 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -508,4 +508,22 @@ comparing the subr with a much slower lisp implementation."
(bound-and-true-p data-tests-foo2)
(bound-and-true-p data-tests-foo3)))))))
+(ert-deftest data-tests-make-local-forwarded-var () ;bug#34318
+ ;; Boy, this bug is tricky to trigger. You need to:
+ ;; - call make-local-variable on a forwarded var (i.e. one that
+ ;; has a corresponding C var linked via DEFVAR_(LISP|INT|BOOL))
+ ;; - cause the C code to modify this variable from the C side of the
+ ;; forwarding, but this needs to happen before the var is accessed
+ ;; from the Lisp side and before we switch to another buffer.
+ ;; The trigger in bug#34318 doesn't exist any more because the C code has
+ ;; changes. Instead I found the trigger below.
+ (with-temp-buffer
+ (setq last-coding-system-used 'bug34318)
+ (make-local-variable 'last-coding-system-used)
+ ;; This should set last-coding-system-used to `no-conversion'.
+ (decode-coding-string "hello" nil)
+ (should (equal (list last-coding-system-used
+ (default-value 'last-coding-system-used))
+ '(no-conversion bug34318)))))
+
;;; data-tests.el ends here