aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Kangas2023-02-08 06:30:15 +0100
committerStefan Kangas2023-02-08 06:30:15 +0100
commitd492be400e1676cee68432a1dc1009a0fa8b9a2b (patch)
tree9fdf73418ee35249a22c752075da70404dee7ccb /test
parent2273cdb40e1939f7c29a669f6a64e6a27738c1a5 (diff)
parentc9ba05af8dfabca00023bd2312dec4ec59497801 (diff)
downloademacs-d492be400e1676cee68432a1dc1009a0fa8b9a2b.tar.gz
emacs-d492be400e1676cee68432a1dc1009a0fa8b9a2b.zip
Merge from origin/emacs-29
c9ba05af8df Fix crashes inside 'xfree' called from treesit.c 746748f5c28 Make java-ts-mode use the c-ts-common-indent-type-regexp-... 87d39a30b12 Fix c-ts-mode indentation 7cb92b53987 Fix c-ts-mode indentation d68ff6016d0 Fix c-ts-mode indentation (bug#61291) 2ac8c4bbd6f (eglot-completion-at-point): Return correct values in :co... 321cbd9a601 Tighten and simplify typescript compilation-mode regexps ... 97533e73ad6 ; * lisp/progmodes/c-ts-common.el (treesit-node-prev-sibl... 9dfccb89fc5 Clarify bug-reference-auto-setup-functions docstring. 17ab426670a * lisp/treesit.el (treesit): Fix shortdoc example form (b... 5a6dfab1e4d Use c-ts-common-statement-offset in java-ts-mode (bug#61142) c3262216abb Add array_initializer to java-ts-mode 79ab62e0bb5 go-ts-mode: Highlight variable declarations 1fab91d852e go-ts-mode: Fix highlighting of function name in call_exp... 07ffe902c63 c-ts-mode: Highlight "property functions" as functions a529b0d6463 rust-ts-mode: Fix highlighting of function name in call_e... 088425538f2 rust-ts-mode--font-lock-settings: Improve consistency 793c24a6ac7 Make sure 'M-x show-paren-local-mode' turns on right away 60089dcfe06 Add to bug-reference-auto-setup-functions after its decla... 26e947ccb14 * lisp/vc/vc.el (vc-find-revision-no-save): Fix parens (b... 948e343496b ; Fix byte-compilation warning 6568a1aaf9a Fix inability to turn show-paren-local-mode on manually (... 24085ba6105 ; go-ts-mode--indent-rules: Indent to 0 at top level 0862a79fef5 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... bb999df5d6f ; Fix whitespace of last change 929daafa1d6 ; Fix trivial mistake in emoji--choose-emoji d7b4a8487f6 ; * lisp/isearch.el (emoji--read-emoji): Avoid compilatio... e38ff004631 rust-ts-mode: Highlight variable declarations d12727057d4 rust-ts-mode--indent-rules: Indent to 0 at top level 85705a7059f ; Move misplaces parenthesis in emoji--choose-emoji 18c43bb9d6c Ensure upper bound of font-lock region is less than point... 94f291d1505 ; * lisp/paren.el (show-paren-predicate): Doc fix. (Bug#... 3ffd0eddce6 Highlight more complex function parameters 58dc03ba7e4 No longer use transient in isearch-emoji-by-name 0c125fcc67a Make highlighting more regular across TS modes (bug#61205) 1dd751c3ac4 ; Improve documentation of 'proper-list-p' 96181ed3f09 Document 'plistp' 03d9d18513b Fix display of raised/lowered composed text f13479d9556 Fix installation of tree-sitter grammar on MS-Windows 0358267204d Update the Emacs FAQ for Emacs 29 2c33e2889b4 Fix byte-compilation of *-ts-mode.el files b40a929a3f2 ; ruby-ts--syntax-propertize: Amend commentary b80f36b88c7 Make c-ts-mode-set-style's effect local (bug#61245) 671e5d9fad5 ; * lisp/treesit.el (treesit--font-lock-level-setter): Mi... 69380a88e92 c-ts-mode: Highlight name in parameter declarations 89b550eac29 Fix switch statement indentation for go-ts-mode (bug#61238) 1a123feb181 Fix bidi reordering of sequence of whitespace characters ... 8870b54db99 Add tests for compilation support for TypeScript (bug#61104) 873a0a15085 Add support for TypeScript compilation to compile.el (bug... 3a64f81ebc1 Don't clobber match data in 'y-or-n-p' 4c765d93ab3 Refine the previous change d99b5151f8c Add syntax-propertize-function to ruby-ts-mode f25c15ceb7d ; Fix typos 35e238cae8b Improve documentation of 'header-line-indent-mode' c3f58a66514 Don't casemap erc-sasl-user when set to :nick e444115d026 Improve keymap-global-set and keymap-local-set interactiv... # Conflicts: # etc/NEWS
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts2
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent.erts87
-rw-r--r--test/lisp/progmodes/compile-tests.el6
-rw-r--r--test/lisp/progmodes/go-ts-mode-resources/indent.erts47
-rw-r--r--test/lisp/progmodes/go-ts-mode-tests.el31
5 files changed, 169 insertions, 4 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
index ba4f854baf8..74e34fe821b 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts
@@ -3,7 +3,7 @@ Code:
3 (c-ts-mode) 3 (c-ts-mode)
4 (setq-local indent-tabs-mode nil) 4 (setq-local indent-tabs-mode nil)
5 (setq-local c-ts-mode-indent-offset 2) 5 (setq-local c-ts-mode-indent-offset 2)
6 (c-ts-mode-set-local-style 'bsd) 6 (c-ts-mode-set-style 'bsd)
7 (indent-region (point-min) (point-max))) 7 (indent-region (point-min) (point-max)))
8 8
9Point-Char: | 9Point-Char: |
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 058c6e9099c..21b84c2e7e3 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -3,7 +3,7 @@ Code:
3 (c-ts-mode) 3 (c-ts-mode)
4 (setq-local indent-tabs-mode nil) 4 (setq-local indent-tabs-mode nil)
5 (setq-local c-ts-mode-indent-offset 2) 5 (setq-local c-ts-mode-indent-offset 2)
6 (c-ts-mode-set-local-style 'gnu) 6 (c-ts-mode-set-style 'gnu)
7 (indent-region (point-min) (point-max))) 7 (indent-region (point-min) (point-max)))
8 8
9Point-Char: | 9Point-Char: |
@@ -144,6 +144,44 @@ int f2(int x,
144}; 144};
145=-=-= 145=-=-=
146 146
147Name: Semi-colon in While Loop (bug#61291)
148
149=-=
150while (true)
151 ;
152for (int i = 0;
153 i < 5;
154 i++)
155 ;
156=-=-=
157
158Name: Bracketless Simple Statement
159
160=-=
161for (int i = 0; i < 5; i++)
162 continue;
163
164while (true)
165 return 1;
166
167do
168 i++;
169while (true)
170=-=-=
171
172Name: Nested If-Else
173
174=-=
175if (true)
176 return 0;
177else if (false)
178 return 1;
179else if (true)
180 return 2;
181else if (false)
182 return 3;
183=-=-=
184
147Name: Multiline Block Comments 1 (bug#60270) 185Name: Multiline Block Comments 1 (bug#60270)
148 186
149=-= 187=-=
@@ -196,7 +234,7 @@ Code:
196 (c-ts-mode) 234 (c-ts-mode)
197 (setq-local indent-tabs-mode nil) 235 (setq-local indent-tabs-mode nil)
198 (setq-local c-ts-mode-indent-offset 8) 236 (setq-local c-ts-mode-indent-offset 8)
199 (c-ts-mode-set-local-style 'linux) 237 (c-ts-mode-set-style 'linux)
200 (indent-region (point-min) (point-max))) 238 (indent-region (point-min) (point-max)))
201 239
202Name: Labels (Linux Style) 240Name: Labels (Linux Style)
@@ -244,3 +282,48 @@ int main() {
244 } 282 }
245} 283}
246=-=-= 284=-=-=
285
286Name: Complicated mixed bracket matching indentation (bug#61142)
287
288=-=
289void foo(
290 int foo) {
291 for (;;)
292 return 5;
293
294 if (a == 0
295 && b == 1
296 && foo)
297 {
298 return 0;
299 }
300 else if (a == 1)
301 {
302 return 1;
303 }
304 else if (true)
305 return 5;
306 else
307 {
308 if (a == 0
309 && b == 1
310 && foo)
311 for (
312 int i = 0;
313 i < 5;
314 i++)
315 if (true)
316 do
317 i = 5;
318 while (true);
319 else if (false)
320 {
321 return 6;
322 }
323 else
324 if (true
325 && false)
326 return 6;
327 }
328}
329=-=-=
diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el
index 53dc7f2a133..078eef36774 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -382,6 +382,10 @@
382 ;; sun-ada 382 ;; sun-ada
383 (sun-ada "/home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: \",\" inserted" 383 (sun-ada "/home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: \",\" inserted"
384 1 6 361 "/home3/xdhar/rcds_rc/main.a") 384 1 6 361 "/home3/xdhar/rcds_rc/main.a")
385 (typescript-tsc-plain "/home/foo/greeter.ts(30,12): error TS2339: Property 'foo' does not exist."
386 1 12 30 "/home/foo/greeter.ts")
387 (typescript-tsc-pretty "src/resources/document.ts:140:22 - error TS2362: something."
388 1 22 140 "src/resources/document.ts")
385 ;; 4bsd 389 ;; 4bsd
386 (edg-1 "/usr/src/foo/foo.c(8): warning: w may be used before set" 390 (edg-1 "/usr/src/foo/foo.c(8): warning: w may be used before set"
387 1 nil 8 "/usr/src/foo/foo.c") 391 1 nil 8 "/usr/src/foo/foo.c")
@@ -495,7 +499,7 @@ The test data is in `compile-tests--test-regexps-data'."
495 (compilation-num-warnings-found 0) 499 (compilation-num-warnings-found 0)
496 (compilation-num-infos-found 0)) 500 (compilation-num-infos-found 0))
497 (mapc #'compile--test-error-line compile-tests--test-regexps-data) 501 (mapc #'compile--test-error-line compile-tests--test-regexps-data)
498 (should (eq compilation-num-errors-found 98)) 502 (should (eq compilation-num-errors-found 100))
499 (should (eq compilation-num-warnings-found 35)) 503 (should (eq compilation-num-warnings-found 35))
500 (should (eq compilation-num-infos-found 28))))) 504 (should (eq compilation-num-infos-found 28)))))
501 505
diff --git a/test/lisp/progmodes/go-ts-mode-resources/indent.erts b/test/lisp/progmodes/go-ts-mode-resources/indent.erts
new file mode 100644
index 00000000000..a89d69b307c
--- /dev/null
+++ b/test/lisp/progmodes/go-ts-mode-resources/indent.erts
@@ -0,0 +1,47 @@
1Code:
2 (lambda ()
3 (go-ts-mode)
4 (indent-region (point-min) (point-max)))
5
6Point-Char: |
7
8Name: Basic
9
10=-=
11package main
12
13func main() {
14}
15=-=-=
16
17Name: Switch and Select
18
19=-=
20package main
21
22func main() {
23 var x any
24 switch x {
25 case 1:
26 println("one")
27 default:
28 println("default case")
29 }
30
31 switch x.(type) {
32 case int:
33 println("integer")
34 default:
35 println("don't know the type")
36 }
37
38 var c chan int
39 select {
40 case x := <-c:
41 println(x)
42 default:
43 println("no communication")
44 }
45}
46
47=-=-=
diff --git a/test/lisp/progmodes/go-ts-mode-tests.el b/test/lisp/progmodes/go-ts-mode-tests.el
new file mode 100644
index 00000000000..548465208f9
--- /dev/null
+++ b/test/lisp/progmodes/go-ts-mode-tests.el
@@ -0,0 +1,31 @@
1;;; go-ts-mode-tests.el --- Tests for Tree-sitter-based Go 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 go-ts-mode-test-indentation ()
27 (skip-unless (treesit-ready-p 'go))
28 (ert-test-erts-file (ert-resource-file "indent.erts")))
29
30(provide 'go-ts-mode-tests)
31;;; go-ts-mode-tests.el ends here