Add c-ts-mode tests
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New .erts file to test indentation of typical C constructs and prevent regression of bug fixes. * test/lisp/progmodes/c-ts-mode-tests.el: New file with c-ts-mode tests.
This commit is contained in:
parent
a760364f5f
commit
c6bbf9cc27
2 changed files with 75 additions and 0 deletions
44
test/lisp/progmodes/c-ts-mode-resources/indent.erts
Normal file
44
test/lisp/progmodes/c-ts-mode-resources/indent.erts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
Code:
|
||||||
|
(lambda ()
|
||||||
|
(c-ts-mode)
|
||||||
|
(indent-region (point-min) (point-max)))
|
||||||
|
|
||||||
|
Name: Basic
|
||||||
|
|
||||||
|
=-=
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
=-=-=
|
||||||
|
|
||||||
|
Name: Hanging Braces (GNU Style)
|
||||||
|
|
||||||
|
=-=
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
=-=-=
|
||||||
|
|
||||||
|
Name: Multiline Parameter List (bug#60398)
|
||||||
|
|
||||||
|
=-=
|
||||||
|
int f2(int x,
|
||||||
|
int y) {
|
||||||
|
return x + y;
|
||||||
|
};
|
||||||
|
=-=-=
|
||||||
|
|
||||||
|
Name: Multiline Block Comments (bug#60270)
|
||||||
|
|
||||||
|
=-=
|
||||||
|
/**
|
||||||
|
* @some_func:
|
||||||
|
* @arg1:
|
||||||
|
*/
|
||||||
|
=-=-=
|
31
test/lisp/progmodes/c-ts-mode-tests.el
Normal file
31
test/lisp/progmodes/c-ts-mode-tests.el
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
;;; c-ts-mode-tests.el --- Tests for Tree-sitter-based C mode -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; Copyright (C) 2023 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
;; This file is part of GNU Emacs.
|
||||||
|
|
||||||
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
|
||||||
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'ert)
|
||||||
|
(require 'ert-x)
|
||||||
|
(require 'treesit)
|
||||||
|
|
||||||
|
(ert-deftest c-ts-mode-test-indentation ()
|
||||||
|
(skip-unless (treesit-ready-p 'c))
|
||||||
|
(ert-test-erts-file (ert-resource-file "indent.erts")))
|
||||||
|
|
||||||
|
(provide 'c-ts-mode-tests)
|
||||||
|
;;; c-ts-mode-tests.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue