aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorPaul Eggert2019-01-13 15:45:14 -0800
committerPaul Eggert2019-01-13 15:46:44 -0800
commit1a722e888454a0cb24dffc35455467688b4b4c60 (patch)
tree715e89cb287001ec3857aacbe988bf5ec0d9f6fd /test/src
parent800d3815e4a82f83b98cf87b205dcfdb0670907f (diff)
downloademacs-1a722e888454a0cb24dffc35455467688b4b4c60.tar.gz
emacs-1a722e888454a0cb24dffc35455467688b4b4c60.zip
Fix translation-region bug with MAX_CHAR
Also, clean up the code a bit. Actually I discovered the bug while cleaning up the code. * src/editfns.c (Fsubst_char_in_region) (Ftranslate_region_internal): Use bool for booleans. (Ftranslate_region_internal): Fix off-by-1 bug when a translation table translates the maximum char. Assume C99 decl-after-statement, similar minor cleanups. * test/src/editfns-tests.el (test-translate-region-internal): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/editfns-tests.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index d3b0a11d836..a01dc4a4789 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -373,4 +373,13 @@
373 ((eq stat 2) 373 ((eq stat 2)
374 (should-not name))))))))) 374 (should-not name)))))))))
375 375
376(ert-deftest test-translate-region-internal ()
377 (with-temp-buffer
378 (let ((max-char #16r3FFFFF)
379 (tt (make-char-table 'translation-table)))
380 (aset tt max-char ?*)
381 (insert max-char)
382 (translate-region-internal (point-min) (point-max) tt)
383 (should (string-equal (buffer-string) "*")))))
384
376;;; editfns-tests.el ends here 385;;; editfns-tests.el ends here