summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2017-06-07 19:59:09 -0400
committerNoam Postavsky <npostavs@gmail.com>2017-07-22 08:47:31 -0400
commit8b18911a5c7c6c8a15b3cff12a4376ba68205e1c (patch)
tree87354ab39568fb3162761b578bbdd70035e3b727 /test/src
parent37954f39168e0dbfe3a82feb9b58fecfc5f1f318 (diff)
downloademacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.tar.gz
emacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.tar.bz2
emacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.zip
Signal error for symbol names with strange quotes (Bug#2967)
* src/lread.c (read1): Signal an error when a symbol starts with a non-escaped quote-like character. * test/src/lread-tests.el (lread-tests--funny-quote-symbols): New test. * etc/NEWS: Announce change.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/lread-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index a0a317feeeb..dd5a2003b41 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -142,6 +142,23 @@ literals (Bug#20852)."
"unescaped character literals "
"`?\"', `?(', `?)', `?;', `?[', `?]' detected!")))))
+(ert-deftest lread-tests--funny-quote-symbols ()
+ "Check that 'smart quotes' or similar trigger errors in symbol names."
+ (dolist (quote-char
+ '(#x2018 ;; LEFT SINGLE QUOTATION MARK
+ #x2019 ;; RIGHT SINGLE QUOTATION MARK
+ #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK
+ #x201C ;; LEFT DOUBLE QUOTATION MARK
+ #x201D ;; RIGHT DOUBLE QUOTATION MARK
+ #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK
+ #x301E ;; DOUBLE PRIME QUOTATION MARK
+ #xFF02 ;; FULLWIDTH QUOTATION MARK
+ #xFF07 ;; FULLWIDTH APOSTROPHE
+ ))
+ (let ((str (format "%cfoo" quote-char)))
+ (should-error (read str) :type 'invalid-read-syntax)
+ (should (eq (read (concat "\\" str)) (intern str))))))
+
(ert-deftest lread-test-bug26837 ()
"Test for http://debbugs.gnu.org/26837 ."
(let ((load-path (cons