diff options
| author | Noam Postavsky | 2017-06-07 19:59:09 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-07-22 08:47:31 -0400 |
| commit | 8b18911a5c7c6c8a15b3cff12a4376ba68205e1c (patch) | |
| tree | 87354ab39568fb3162761b578bbdd70035e3b727 /test/src | |
| parent | 37954f39168e0dbfe3a82feb9b58fecfc5f1f318 (diff) | |
| download | emacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.tar.gz 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.el | 17 |
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)." | |||
| 142 | "unescaped character literals " | 142 | "unescaped character literals " |
| 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) | 143 | "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) |
| 144 | 144 | ||
| 145 | (ert-deftest lread-tests--funny-quote-symbols () | ||
| 146 | "Check that 'smart quotes' or similar trigger errors in symbol names." | ||
| 147 | (dolist (quote-char | ||
| 148 | '(#x2018 ;; LEFT SINGLE QUOTATION MARK | ||
| 149 | #x2019 ;; RIGHT SINGLE QUOTATION MARK | ||
| 150 | #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK | ||
| 151 | #x201C ;; LEFT DOUBLE QUOTATION MARK | ||
| 152 | #x201D ;; RIGHT DOUBLE QUOTATION MARK | ||
| 153 | #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK | ||
| 154 | #x301E ;; DOUBLE PRIME QUOTATION MARK | ||
| 155 | #xFF02 ;; FULLWIDTH QUOTATION MARK | ||
| 156 | #xFF07 ;; FULLWIDTH APOSTROPHE | ||
| 157 | )) | ||
| 158 | (let ((str (format "%cfoo" quote-char))) | ||
| 159 | (should-error (read str) :type 'invalid-read-syntax) | ||
| 160 | (should (eq (read (concat "\\" str)) (intern str)))))) | ||
| 161 | |||
| 145 | (ert-deftest lread-test-bug26837 () | 162 | (ert-deftest lread-test-bug26837 () |
| 146 | "Test for http://debbugs.gnu.org/26837 ." | 163 | "Test for http://debbugs.gnu.org/26837 ." |
| 147 | (let ((load-path (cons | 164 | (let ((load-path (cons |