aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJoΓ£o TΓ‘vora2025-11-10 12:28:14 +0000
committerJoΓ£o TΓ‘vora2025-11-10 12:28:14 +0000
commit1772a4e468c4436e07ab4ea7098e9712c8dcae2d (patch)
treec7fe2210fcedba88aa5c0cc66415ecd7b254ad1d /test
parent683e7462df3d5b17e7da8956302069415bba6998 (diff)
downloademacs-1772a4e468c4436e07ab4ea7098e9712c8dcae2d.tar.gz
emacs-1772a4e468c4436e07ab4ea7098e9712c8dcae2d.zip
; Eglot: unbreak "lsp-abiding-column" test for newer clangd
Newer/newest clangd support more encodings and actually negotiate with us, so test shouldn't assume UTF-16.. * test/lisp/progmodes/eglot-tests.el (eglot-tests--lsp-abiding-column-1): Tweak.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/eglot-tests.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index b01b7d269ec..8455c8ff8db 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -1005,26 +1005,31 @@ int main() {
1005 (eglot--with-fixture 1005 (eglot--with-fixture
1006 '(("project" . 1006 '(("project" .
1007 (("foo.c" . "const char write_data[] = u8\"πŸš‚πŸšƒπŸš„πŸš…πŸš†πŸšˆπŸš‡πŸšˆπŸš‰πŸšŠπŸš‹πŸšŒπŸšŽπŸšπŸšžπŸšŸπŸš πŸš‘πŸ›€πŸ›²\";")))) 1007 (("foo.c" . "const char write_data[] = u8\"πŸš‚πŸšƒπŸš„πŸš…πŸš†πŸšˆπŸš‡πŸšˆπŸš‰πŸšŠπŸš‹πŸšŒπŸšŽπŸšπŸšžπŸšŸπŸš πŸš‘πŸ›€πŸ›²\";"))))
1008 (let ((eglot-server-programs 1008 (let (expected-column
1009 (eglot-server-programs
1009 '((c-mode . ("clangd"))))) 1010 '((c-mode . ("clangd")))))
1010 (with-current-buffer 1011 (with-current-buffer
1011 (eglot--find-file-noselect "project/foo.c") 1012 (eglot--find-file-noselect "project/foo.c")
1012 (setq-local eglot-move-to-linepos-function #'eglot-move-to-utf-16-linepos)
1013 (setq-local eglot-current-linepos-function #'eglot-utf-16-linepos)
1014 (eglot--sniffing (:client-notifications c-notifs) 1013 (eglot--sniffing (:client-notifications c-notifs)
1015 (eglot--tests-connect) 1014 (eglot--tests-connect)
1016 (end-of-line) 1015 (end-of-line)
1016
1017 ;; will be 71 if utf-16 was negotiated, 51 if utf-32,
1018 ;; something else if utf-8
1019 (setq expected-column (funcall eglot-current-linepos-function))
1020 (eglot--test-message
1021 "Looks like we negotiated %S as the offset encoding"
1022 (list eglot-move-to-linepos-function eglot-current-linepos-function))
1017 (insert "p ") 1023 (insert "p ")
1018 (eglot--signal-textDocument/didChange) 1024 (eglot--signal-textDocument/didChange)
1019 (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys) 1025 (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys)
1020 (message "PARAMS=%S" params) 1026 (should (equal expected-column
1021 (should (equal 71 (eglot-tests--get 1027 (eglot-tests--get
1022 params 1028 params
1023 '(:contentChanges 0 1029 '(:contentChanges 0
1024 :range :start :character))))) 1030 :range :start :character)))))
1025 (beginning-of-line) 1031 (beginning-of-line)
1026 (should (eq eglot-move-to-linepos-function #'eglot-move-to-utf-16-linepos)) 1032 (funcall eglot-move-to-linepos-function expected-column)
1027 (funcall eglot-move-to-linepos-function 71)
1028 (should (looking-at "p"))))))) 1033 (should (looking-at "p")))))))
1029 1034
1030(ert-deftest eglot-test-lsp-abiding-column () 1035(ert-deftest eglot-test-lsp-abiding-column ()