aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Monnier2023-01-14 09:10:45 -0500
committerStefan Monnier2023-01-14 09:10:45 -0500
commit4f0459aaf756e56db5fb943177eec6eb5bd5fc4a (patch)
treed4f404727a4a55e2efc1dd4979851bcb67ccd852 /test
parent99120491730c5839a5ba15ded187d481af1e71a7 (diff)
parent861556c1339cd65842ec3e24ba48590e6b72bd48 (diff)
downloademacs-4f0459aaf756e56db5fb943177eec6eb5bd5fc4a.tar.gz
emacs-4f0459aaf756e56db5fb943177eec6eb5bd5fc4a.zip
Merge from origin/emacs-29
861556c1339 Fix minibuffer-completion tests c0578edc8fc ; * doc/misc/eglot.texi (Troubleshooting Eglot): Fix typo... c6bbf9cc270 Add c-ts-mode tests a760364f5f3 Fix c-ts-mode--fill-paragraph 2a2b1d09ac7 Fix minor issues with 'pp' and related commands dfb38fb2ee6 ; Improve documentation of tree-sitter node comparison e8a89a18b69 ; Fix non-tree-sitter builds f27a330b99e ; Fix typo in ert-with-temp-file 956889d8ff1 Equal now recognizes tree-sitter nodes (bug#60659) 8f446c2d397 Fix c-ts-mode comment indentation (bug#60270) 083badc9c12 * lisp/subr.el (while-let): Use if-let, not if-let* (bug#... 9ecebcdded1 * lisp/simple.el (next-completion): Handle first completi... cfd2b3504ab Fix encoding with 'utf-8-auto' 53b47df8229 Report cursor correctly on PGTK when there is a margin # Conflicts: # etc/NEWS
Diffstat (limited to 'test')
-rw-r--r--test/lisp/minibuffer-tests.el2
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent.erts44
-rw-r--r--test/lisp/progmodes/c-ts-mode-tests.el31
-rw-r--r--test/src/coding-tests.el30
4 files changed, 91 insertions, 16 deletions
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 1de8e56cbd4..2ac5e0f29d6 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -421,7 +421,7 @@
421 (switch-to-completions) 421 (switch-to-completions)
422 ;; Fixed in bug#55430 422 ;; Fixed in bug#55430
423 (should (equal "aa" (get-text-property (point) 'completion--string))) 423 (should (equal "aa" (get-text-property (point) 'completion--string)))
424 (next-completion 2) 424 (next-completion 3)
425 (should (equal "ac" (get-text-property (point) 'completion--string))) 425 (should (equal "ac" (get-text-property (point) 'completion--string)))
426 (previous-completion 2) 426 (previous-completion 2)
427 (should (equal "aa" (get-text-property (point) 'completion--string))) 427 (should (equal "aa" (get-text-property (point) 'completion--string)))
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
new file mode 100644
index 00000000000..5defcbd3c83
--- /dev/null
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -0,0 +1,44 @@
1Code:
2 (lambda ()
3 (c-ts-mode)
4 (indent-region (point-min) (point-max)))
5
6Name: Basic
7
8=-=
9int
10main (void)
11{
12 return 0;
13}
14=-=-=
15
16Name: Hanging Braces (GNU Style)
17
18=-=
19int
20main (void)
21{
22 if (true)
23 {
24 }
25}
26=-=-=
27
28Name: Multiline Parameter List (bug#60398)
29
30=-=
31int f2(int x,
32 int y) {
33 return x + y;
34};
35=-=-=
36
37Name: Multiline Block Comments (bug#60270)
38
39=-=
40/**
41 * @some_func:
42 * @arg1:
43 */
44=-=-=
diff --git a/test/lisp/progmodes/c-ts-mode-tests.el b/test/lisp/progmodes/c-ts-mode-tests.el
new file mode 100644
index 00000000000..8606faf9913
--- /dev/null
+++ b/test/lisp/progmodes/c-ts-mode-tests.el
@@ -0,0 +1,31 @@
1;;; c-ts-mode-tests.el --- Tests for Tree-sitter-based C mode -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2023 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23(require 'ert-x)
24(require 'treesit)
25
26(ert-deftest c-ts-mode-test-indentation ()
27 (skip-unless (treesit-ready-p 'c))
28 (ert-test-erts-file (ert-resource-file "indent.erts")))
29
30(provide 'c-ts-mode-tests)
31;;; c-ts-mode-tests.el ends here
diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el
index 6bd8d1ae6c4..b27907027ba 100644
--- a/test/src/coding-tests.el
+++ b/test/src/coding-tests.el
@@ -148,21 +148,21 @@
148 148
149(defun coding-tests (content-type write-coding read-coding detected-coding 149(defun coding-tests (content-type write-coding read-coding detected-coding
150 &optional translator) 150 &optional translator)
151 (prefer-coding-system 'utf-8-auto) 151 (with-coding-priority '(utf-8-auto)
152 (let ((filename (coding-tests-filename content-type write-coding))) 152 (let ((filename (coding-tests-filename content-type write-coding)))
153 (with-temp-buffer 153 (with-temp-buffer
154 (let ((coding-system-for-read read-coding) 154 (let ((coding-system-for-read read-coding)
155 (contents (coding-tests-file-contents content-type)) 155 (contents (coding-tests-file-contents content-type))
156 (disable-ascii-optimization nil)) 156 (disable-ascii-optimization nil))
157 (if translator 157 (if translator
158 (setq contents (funcall translator contents))) 158 (setq contents (funcall translator contents)))
159 (insert-file-contents filename) 159 (insert-file-contents filename)
160 (if (and (coding-system-equal buffer-file-coding-system detected-coding) 160 (if (and (coding-system-equal buffer-file-coding-system detected-coding)
161 (string= (buffer-string) contents)) 161 (string= (buffer-string) contents))
162 nil 162 nil
163 (list buffer-file-coding-system 163 (list buffer-file-coding-system
164 (string-to-list (buffer-string)) 164 (string-to-list (buffer-string))
165 (string-to-list contents))))))) 165 (string-to-list contents))))))))
166 166
167(ert-deftest ert-test-coding-ascii () 167(ert-deftest ert-test-coding-ascii ()
168 (unwind-protect 168 (unwind-protect