aboutsummaryrefslogtreecommitdiffstats
path: root/test/src/syntax-tests.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-01-16 11:58:00 +0100
committerMattias EngdegÄrd2022-01-20 11:44:07 +0100
commitb929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0 (patch)
tree8b0ee1ce3c8a355b67ac46ee26c3ec064997afc6 /test/src/syntax-tests.el
parentb1488a6582d8557e3e3fd894d81bab165d4aca77 (diff)
downloademacs-b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0.tar.gz
emacs-b929bdaeb6bcb919d4d1a5d02713cdcac3fc44d0.zip
Fix Fchar_syntax for non-ASCII in unibyte buffers
Fchar_syntax did not convert unibyte characters to multibyte when the current buffer was unibyte, in contrast to `char-syntax` in byte-compiled code (bug#53260). * src/bytecode.c (exec_byte_code): Call out to Fchar_syntax; the dynamic frequency is too low to justify inlining here, and it did lead to implementations diverging. * src/syntax.c (Fchar_syntax): Convert non-ASCII unibyte values to multibyte. * test/src/syntax-tests.el (syntax-char-syntax): New test.
Diffstat (limited to 'test/src/syntax-tests.el')
-rw-r--r--test/src/syntax-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el
index 3b9f21cde37..751a900a23e 100644
--- a/test/src/syntax-tests.el
+++ b/test/src/syntax-tests.el
@@ -506,4 +506,19 @@ the `parse-partial-sexp's are expected to stop. See
506 (should (parse-partial-sexp 1 1)) 506 (should (parse-partial-sexp 1 1))
507 (should-error (parse-partial-sexp 2 1)))) 507 (should-error (parse-partial-sexp 2 1))))
508 508
509(ert-deftest syntax-char-syntax ()
510 ;; Verify that char-syntax behaves identically in interpreted and
511 ;; byte-compiled code (bug#53260).
512 (let ((cs (byte-compile (lambda (x) (char-syntax x)))))
513 ;; Use a unibyte buffer with a syntax table using symbol syntax
514 ;; for raw byte 128.
515 (with-temp-buffer
516 (set-buffer-multibyte nil)
517 (let ((st (make-syntax-table)))
518 (modify-syntax-entry (unibyte-char-to-multibyte 128) "_" st)
519 (set-syntax-table st)
520 (should (equal (eval '(char-syntax 128) t) ?_))
521 (should (equal (funcall cs 128) ?_))))
522 (list (char-syntax 128) (funcall cs 128))))
523
509;;; syntax-tests.el ends here 524;;; syntax-tests.el ends here