summaryrefslogtreecommitdiff
path: root/test/src/data-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r--test/src/data-tests.el28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 3cd4802a981..a9d48e29a8a 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -1,6 +1,6 @@
;;; data-tests.el --- tests for src/data.c -*- lexical-binding:t -*-
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
@@ -484,7 +484,7 @@ comparing the subr with a much slower lisp implementation."
(should-have-watch-data `(data-tests-lvar 3 set ,buf1)))
(should-have-watch-data `(data-tests-lvar 1 unlet ,buf1))
(setq-default data-tests-lvar 4)
- (should-have-watch-data `(data-tests-lvar 4 set nil))
+ (should-have-watch-data '(data-tests-lvar 4 set nil))
(with-temp-buffer
(setq buf2 (current-buffer))
(setq data-tests-lvar 1)
@@ -501,7 +501,7 @@ comparing the subr with a much slower lisp implementation."
(kill-all-local-variables)
(should-have-watch-data `(data-tests-lvar nil makunbound ,buf2)))
(setq-default data-tests-lvar 4)
- (should-have-watch-data `(data-tests-lvar 4 set nil))
+ (should-have-watch-data '(data-tests-lvar 4 set nil))
(makunbound 'data-tests-lvar)
(should-have-watch-data '(data-tests-lvar nil makunbound nil))
(setq data-tests-lvar 5)
@@ -656,6 +656,10 @@ comparing the subr with a much slower lisp implementation."
(ert-deftest data-tests-ash-lsh ()
(should (= (ash most-negative-fixnum 1)
(* most-negative-fixnum 2)))
+ (should (= (ash 0 (* 2 most-positive-fixnum)) 0))
+ (should (= (ash 1000 (* 2 most-negative-fixnum)) 0))
+ (should (= (ash -1000 (* 2 most-negative-fixnum)) -1))
+ (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1))
(should (= (lsh most-negative-fixnum 1)
(* most-negative-fixnum 2)))
(should (= (ash (* 2 most-negative-fixnum) -1)
@@ -665,4 +669,22 @@ comparing the subr with a much slower lisp implementation."
(should (= (lsh -1 -1) most-positive-fixnum))
(should-error (lsh (1- most-negative-fixnum) -1)))
+(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