aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/go-ts-mode-resources/indent.erts47
-rw-r--r--test/lisp/progmodes/go-ts-mode-tests.el31
2 files changed, 78 insertions, 0 deletions
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