diff options
Diffstat (limited to 'test/lisp/button-tests.el')
| -rw-r--r-- | test/lisp/button-tests.el | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lisp/button-tests.el b/test/lisp/button-tests.el new file mode 100644 index 00000000000..d54a992ab89 --- /dev/null +++ b/test/lisp/button-tests.el | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | ;;; button-tests.el --- tests for button.el -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2019 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 | |||
| 24 | (ert-deftest button-at () | ||
| 25 | "Test `button-at' behavior." | ||
| 26 | (with-temp-buffer | ||
| 27 | (should-not (button-at (point))) | ||
| 28 | (let ((button (insert-text-button "text button")) | ||
| 29 | (marker (button-at (1- (point))))) | ||
| 30 | (should (markerp marker)) | ||
| 31 | (should (= (button-end button) (button-end marker) (point)))) | ||
| 32 | (let ((button (insert-button "overlay button")) | ||
| 33 | (overlay (button-at (1- (point))))) | ||
| 34 | (should (overlayp overlay)) | ||
| 35 | (should (eq button overlay))) | ||
| 36 | ;; Buttons and widgets are incompatible (bug#34506). | ||
| 37 | (widget-create 'link "link widget") | ||
| 38 | (should-not (button-at (1- (point)))))) | ||
| 39 | |||
| 40 | ;;; button-tests.el ends here | ||