aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTom Tromey2018-06-24 11:18:19 -0600
committerTom Tromey2018-06-24 11:33:02 -0600
commitcd5bb4bf3dbad8941d25823f398b595b8f0edbb9 (patch)
tree09ad146d785847a05fb96a998a357165176b5402 /test
parenteaa054a94b786ce7dc4169c9b14893f50335f657 (diff)
downloademacs-cd5bb4bf3dbad8941d25823f398b595b8f0edbb9.tar.gz
emacs-cd5bb4bf3dbad8941d25823f398b595b8f0edbb9.zip
Fix two tcl-mode defun-related bugs
Fixes bug#23565 * lisp/progmodes/tcl.el (tcl-mode): Set beginning-of-defun-function and end-of-defun-function. (tcl-beginning-of-defun-function, tcl-end-of-defun-function): New defuns. * test/lisp/progmodes/tcl-tests.el: New file.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/tcl-tests.el68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el
new file mode 100644
index 00000000000..55211b70be2
--- /dev/null
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -0,0 +1,68 @@
1;;; tcl-tests.el --- Test suite for tcl-mode
2
3;; Copyright (C) 2018 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;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'tcl)
26
27;; From bug#23565
28(ert-deftest tcl-mode-beginning-of-defun-1 ()
29 (with-temp-buffer
30 (tcl-mode)
31 (insert "proc bad {{value \"\"}} {\n # do something\n}")
32 (should (beginning-of-defun))
33 (should (= (point) (point-min)))
34 (end-of-defun)
35 (should (= (point) (point-max)))))
36
37;; From bug#23565
38(ert-deftest tcl-mode-beginning-of-defun-2 ()
39 (with-temp-buffer
40 (tcl-mode)
41 (insert "proc good {{value}} {\n # do something\n}")
42 (should (beginning-of-defun))
43 (should (= (point) (point-min)))
44 (end-of-defun)
45 (should (= (point) (point-max)))))
46
47(ert-deftest tcl-mode-function-name ()
48 (with-temp-buffer
49 (tcl-mode)
50 (insert "proc notinthis {} {\n # nothing\n}\n\n")
51 (should-not (add-log-current-defun))))
52
53(ert-deftest tcl-mode-function-name ()
54 (with-temp-buffer
55 (tcl-mode)
56 (insert "proc simple {} {\n # nothing\n}")
57 (backward-char 3)
58 (should (equal "simple" (add-log-current-defun)))))
59
60(ert-deftest tcl-mode-function-name ()
61 (with-temp-buffer
62 (tcl-mode)
63 (insert "proc inthis {} {\n # nothing\n")
64 (should (equal "inthis" (add-log-current-defun)))))
65
66(provide 'tcl-tests)
67
68;;; tcl-tests.el ends here