summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjohn muhl <jm@pub.pink>2024-04-20 21:19:27 -0500
committerEli Zaretskii <eliz@gnu.org>2024-04-25 18:39:30 +0300
commitc493f28cc948ac4aef9c262345a608b3c7d413a4 (patch)
tree5599c46573495fd84a57b0fce24131ce399c847f /test
parenta45ae6bce982ee7eff33242e0742a6cfda01d4cb (diff)
downloademacs-c493f28cc948ac4aef9c262345a608b3c7d413a4.tar.gz
Fix which-function error in 'lua-ts-mode' (bug#70515)
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Remove incorrect usage of 'which-func-functions'. * test/lisp/progmodes/lua-ts-mode-tests.el (lua-ts-test-which-function): Add test. * test/lisp/progmodes/lua-ts-mode-resources/which-function.lua: New file.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/lua-ts-mode-resources/which-function.lua3
-rw-r--r--test/lisp/progmodes/lua-ts-mode-tests.el11
2 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua b/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua
new file mode 100644
index 00000000000..621d818461c
--- /dev/null
+++ b/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua
@@ -0,0 +1,3 @@
+local function f(x)
+ print(x)
+end
diff --git a/test/lisp/progmodes/lua-ts-mode-tests.el b/test/lisp/progmodes/lua-ts-mode-tests.el
index 565e6f91dbd..a7b637d18d1 100644
--- a/test/lisp/progmodes/lua-ts-mode-tests.el
+++ b/test/lisp/progmodes/lua-ts-mode-tests.el
@@ -23,6 +23,7 @@
(require 'ert-font-lock)
(require 'ert-x)
(require 'treesit)
+(require 'which-func)
(ert-deftest lua-ts-test-indentation ()
(skip-unless (treesit-ready-p 'lua))
@@ -37,6 +38,16 @@
(let ((treesit-font-lock-level 4))
(ert-font-lock-test-file (ert-resource-file "font-lock.lua") 'lua-ts-mode)))
+(ert-deftest lua-ts-test-which-function ()
+ (skip-unless (treesit-ready-p 'lua))
+ (with-temp-buffer
+ (insert-file-contents (ert-resource-file "which-function.lua"))
+ (lua-ts-mode)
+ (which-function-mode)
+ (goto-char (point-min))
+ (should (equal "f" (which-function)))
+ (which-function-mode -1)))
+
(provide 'lua-ts-mode-tests)
;;; lua-ts-mode-tests.el ends here