branch: externals/elpa commit 8b94cf467b9894e5c623bca1ebe2052d960edf5a Author: theothornhill <theodorthornh...@icloud.com> Commit: João Távora <joaotav...@gmail.com>
Per #397: Add new eglot-lsp-abiding-column test Co-authored-by: João Távora <joatoav...@gmail.com> * eglot-tests.el: (eglot-lsp-abiding-column): add test to check for utf-16 non-ascii characters and character offset. --- eglot-tests.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/eglot-tests.el b/eglot-tests.el index 29770c6..d516891 100644 --- a/eglot-tests.el +++ b/eglot-tests.el @@ -631,6 +631,30 @@ pyls prefers autopep over yafp, despite its README stating the contrary." (should (looking-back "\"foo.bar\": \"")) (should (looking-at "fb\"$")))))) +(ert-deftest eglot-lsp-abiding-column () + "Test basic `eglot-lsp-abiding-column' and `eglot-move-to-lsp-abiding-column'" + (skip-unless (executable-find "clangd")) + (eglot--with-fixture + '(("project" . + (("foo.c" . "const char write_data[] = u8\"🚂🚃🚄🚅🚆🚈🚇🚈🚉🚊🚋🚌🚎🚝🚞🚟🚠🚡🛤🛲\";")))) + (let ((eglot-server-programs + '((c-mode . ("clangd"))))) + (with-current-buffer + (eglot--find-file-noselect "project/foo.c") + (setq-local eglot-move-to-column-function #'eglot-move-to-lsp-abiding-column) + (setq-local eglot-current-column-function #'eglot-lsp-abiding-column) + (eglot--sniffing (:client-notifications c-notifs) + (eglot--tests-connect) + (end-of-line) + (insert "p ") + (eglot--signal-textDocument/didChange) + (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys) + (should (equal 71 (cadddr (cadadr (aref (cadddr params) 0)))))) + (beginning-of-line) + (should (eq eglot-move-to-column-function #'eglot-move-to-lsp-abiding-column)) + (funcall eglot-move-to-column-function 71) + (should (looking-at "p"))))))) + (ert-deftest eglot-ensure () "Test basic `eglot-ensure' functionality" (skip-unless (executable-find "pyls"))