aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/button-tests.el40
-rw-r--r--test/lisp/net/tramp-tests.el142
-rw-r--r--test/lisp/progmodes/flymake-tests.el2
-rw-r--r--test/lisp/progmodes/python-tests.el10
-rw-r--r--test/lisp/wid-edit-tests.el39
5 files changed, 172 insertions, 61 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
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 1c7198ce560..5a9541db8fb 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3849,12 +3849,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3849 "Check `start-file-process'." 3849 "Check `start-file-process'."
3850 :tags '(:expensive-test) 3850 :tags '(:expensive-test)
3851 (skip-unless (tramp--test-enabled)) 3851 (skip-unless (tramp--test-enabled))
3852 (skip-unless (tramp--test-sh-p)) 3852 (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
3853 3853
3854 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) 3854 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
3855 (let ((default-directory tramp-test-temporary-file-directory) 3855 (let ((default-directory tramp-test-temporary-file-directory)
3856 (tmp-name (tramp--test-make-temp-name nil quoted)) 3856 (tmp-name (tramp--test-make-temp-name nil quoted))
3857 kill-buffer-query-functions proc) 3857 kill-buffer-query-functions proc)
3858
3859 ;; Simple process.
3858 (unwind-protect 3860 (unwind-protect
3859 (with-temp-buffer 3861 (with-temp-buffer
3860 (setq proc (start-file-process "test1" (current-buffer) "cat")) 3862 (setq proc (start-file-process "test1" (current-buffer) "cat"))
@@ -3866,11 +3868,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3866 (with-timeout (10 (tramp--test-timeout-handler)) 3868 (with-timeout (10 (tramp--test-timeout-handler))
3867 (while (< (- (point-max) (point-min)) (length "foo")) 3869 (while (< (- (point-max) (point-min)) (length "foo"))
3868 (while (accept-process-output proc 0 nil t)))) 3870 (while (accept-process-output proc 0 nil t))))
3869 (should (string-equal (buffer-string) "foo"))) 3871 ;; We cannot use `string-equal', because tramp-adb.el
3872 ;; echoes also the sent string.
3873 (should (string-match "\\`foo" (buffer-string))))
3870 3874
3871 ;; Cleanup. 3875 ;; Cleanup.
3872 (ignore-errors (delete-process proc))) 3876 (ignore-errors (delete-process proc)))
3873 3877
3878 ;; Simple process using a file.
3874 (unwind-protect 3879 (unwind-protect
3875 (with-temp-buffer 3880 (with-temp-buffer
3876 (write-region "foo" nil tmp-name) 3881 (write-region "foo" nil tmp-name)
@@ -3891,6 +3896,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3891 (delete-process proc) 3896 (delete-process proc)
3892 (delete-file tmp-name))) 3897 (delete-file tmp-name)))
3893 3898
3899 ;; Process filter.
3894 (unwind-protect 3900 (unwind-protect
3895 (with-temp-buffer 3901 (with-temp-buffer
3896 (setq proc (start-file-process "test3" (current-buffer) "cat")) 3902 (setq proc (start-file-process "test3" (current-buffer) "cat"))
@@ -3905,7 +3911,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3905 (with-timeout (10 (tramp--test-timeout-handler)) 3911 (with-timeout (10 (tramp--test-timeout-handler))
3906 (while (< (- (point-max) (point-min)) (length "foo")) 3912 (while (< (- (point-max) (point-min)) (length "foo"))
3907 (while (accept-process-output proc 0 nil t)))) 3913 (while (accept-process-output proc 0 nil t))))
3908 (should (string-equal (buffer-string) "foo"))) 3914 ;; We cannot use `string-equal', because tramp-adb.el
3915 ;; echoes also the sent string.
3916 (should (string-match "\\`foo" (buffer-string))))
3909 3917
3910 ;; Cleanup. 3918 ;; Cleanup.
3911 (ignore-errors (delete-process proc)))))) 3919 (ignore-errors (delete-process proc))))))
@@ -3914,9 +3922,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3914 "Check `make-process'." 3922 "Check `make-process'."
3915 :tags '(:expensive-test) 3923 :tags '(:expensive-test)
3916 (skip-unless (tramp--test-enabled)) 3924 (skip-unless (tramp--test-enabled))
3917 (skip-unless (tramp--test-sh-p)) 3925 (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
3926 ;; `make-process' supports file name handlers since Emacs 27.
3918 (skip-unless (tramp--test-emacs27-p)) 3927 (skip-unless (tramp--test-emacs27-p))
3919 3928
3929 (tramp--test-instrument-test-case 0
3920 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) 3930 (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
3921 (let ((default-directory tramp-test-temporary-file-directory) 3931 (let ((default-directory tramp-test-temporary-file-directory)
3922 (tmp-name (tramp--test-make-temp-name nil quoted)) 3932 (tmp-name (tramp--test-make-temp-name nil quoted))
@@ -3938,7 +3948,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3938 (with-timeout (10 (tramp--test-timeout-handler)) 3948 (with-timeout (10 (tramp--test-timeout-handler))
3939 (while (< (- (point-max) (point-min)) (length "foo")) 3949 (while (< (- (point-max) (point-min)) (length "foo"))
3940 (while (accept-process-output proc 0 nil t)))) 3950 (while (accept-process-output proc 0 nil t))))
3941 (should (string-equal (buffer-string) "foo"))) 3951 ;; We cannot use `string-equal', because tramp-adb.el
3952 ;; echoes also the sent string.
3953 (should (string-match "\\`foo" (buffer-string))))
3942 3954
3943 ;; Cleanup. 3955 ;; Cleanup.
3944 (ignore-errors (delete-process proc))) 3956 (ignore-errors (delete-process proc)))
@@ -3981,9 +3993,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
3981 (process-send-eof proc) 3993 (process-send-eof proc)
3982 ;; Read output. 3994 ;; Read output.
3983 (with-timeout (10 (tramp--test-timeout-handler)) 3995 (with-timeout (10 (tramp--test-timeout-handler))
3984 (while (< (- (point-max) (point-min)) (length "foo")) 3996 (while (not (string-match "foo" (buffer-string)))
3985 (while (accept-process-output proc 0 nil t)))) 3997 (while (accept-process-output proc 0 nil t))))
3986 (should (string-equal (buffer-string) "foo"))) 3998 ;; We cannot use `string-equal', because tramp-adb.el
3999 ;; echoes also the sent string.
4000 (should (string-match "\\`foo" (buffer-string))))
3987 4001
3988 ;; Cleanup. 4002 ;; Cleanup.
3989 (ignore-errors (delete-process proc))) 4003 (ignore-errors (delete-process proc)))
@@ -4006,33 +4020,37 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4006 ;; Read output. 4020 ;; Read output.
4007 (with-timeout (10 (tramp--test-timeout-handler)) 4021 (with-timeout (10 (tramp--test-timeout-handler))
4008 (while (accept-process-output proc 0 nil t))) 4022 (while (accept-process-output proc 0 nil t)))
4009 (should (string-equal (buffer-string) "killed\n"))) 4023 ;; We cannot use `string-equal', because tramp-adb.el
4024 ;; echoes also the sent string.
4025 (should (string-match "killed\n\\'" (buffer-string))))
4010 4026
4011 ;; Cleanup. 4027 ;; Cleanup.
4012 (ignore-errors (delete-process proc))) 4028 (ignore-errors (delete-process proc)))
4013 4029
4014 ;; Process with stderr. 4030 ;; Process with stderr. tramp-adb.el doesn't support it (yet).
4015 (let ((stderr (generate-new-buffer (generate-new-buffer-name "stderr")))) 4031 (unless (tramp--test-adb-p)
4016 (unwind-protect 4032 (let ((stderr
4017 (with-temp-buffer 4033 (generate-new-buffer (generate-new-buffer-name "stderr"))))
4018 (setq proc 4034 (unwind-protect
4019 (make-process 4035 (with-temp-buffer
4020 :name "test5" :buffer (current-buffer) 4036 (setq proc
4021 :command '("cat" "/") 4037 (make-process
4022 :stderr stderr 4038 :name "test5" :buffer (current-buffer)
4023 :file-handler t)) 4039 :command '("cat" "/")
4024 (should (processp proc)) 4040 :stderr stderr
4025 ;; Read stderr. 4041 :file-handler t))
4026 (with-current-buffer stderr 4042 (should (processp proc))
4027 (with-timeout (10 (tramp--test-timeout-handler)) 4043 ;; Read stderr.
4028 (while (= (point-min) (point-max)) 4044 (with-current-buffer stderr
4029 (while (accept-process-output proc 0 nil t)))) 4045 (with-timeout (10 (tramp--test-timeout-handler))
4030 (should 4046 (while (= (point-min) (point-max))
4031 (string-equal (buffer-string) "cat: /: Is a directory\n")))) 4047 (while (accept-process-output proc 0 nil t))))
4048 (should
4049 (string-match "^cat:.* Is a directory" (buffer-string)))))
4032 4050
4033 ;; Cleanup. 4051 ;; Cleanup.
4034 (ignore-errors (delete-process proc)) 4052 (ignore-errors (delete-process proc))
4035 (ignore-errors (kill-buffer stderr))))))) 4053 (ignore-errors (kill-buffer stderr)))))))))
4036 4054
4037(ert-deftest tramp-test31-interrupt-process () 4055(ert-deftest tramp-test31-interrupt-process ()
4038 "Check `interrupt-process'." 4056 "Check `interrupt-process'."
@@ -4096,8 +4114,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4096 ;; Cleanup. 4114 ;; Cleanup.
4097 (ignore-errors (delete-file tmp-name))) 4115 (ignore-errors (delete-file tmp-name)))
4098 4116
4099 ;; tramp-adb.el is not fit yet for asynchronous processes.
4100 (unless (tramp--test-adb-p)
4101 (unwind-protect 4117 (unwind-protect
4102 (with-temp-buffer 4118 (with-temp-buffer
4103 (write-region "foo" nil tmp-name) 4119 (write-region "foo" nil tmp-name)
@@ -4124,10 +4140,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4124 (buffer-string)))) 4140 (buffer-string))))
4125 4141
4126 ;; Cleanup. 4142 ;; Cleanup.
4127 (ignore-errors (delete-file tmp-name)))) 4143 (ignore-errors (delete-file tmp-name)))
4128 4144
4129 ;; tramp-adb.el is not fit yet for asynchronous processes.
4130 (unless (tramp--test-adb-p)
4131 (unwind-protect 4145 (unwind-protect
4132 (with-temp-buffer 4146 (with-temp-buffer
4133 (write-region "foo" nil tmp-name) 4147 (write-region "foo" nil tmp-name)
@@ -4155,7 +4169,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4155 (buffer-string)))) 4169 (buffer-string))))
4156 4170
4157 ;; Cleanup. 4171 ;; Cleanup.
4158 (ignore-errors (delete-file tmp-name))))))) 4172 (ignore-errors (delete-file tmp-name))))))
4159 4173
4160(defun tramp--test-shell-command-to-string-asynchronously (command) 4174(defun tramp--test-shell-command-to-string-asynchronously (command)
4161 "Like `shell-command-to-string', but for asynchronous processes." 4175 "Like `shell-command-to-string', but for asynchronous processes."
@@ -4350,11 +4364,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4350;; The functions were introduced in Emacs 26.1. 4364;; The functions were introduced in Emacs 26.1.
4351(ert-deftest tramp-test34-explicit-shell-file-name () 4365(ert-deftest tramp-test34-explicit-shell-file-name ()
4352 "Check that connection-local `explicit-shell-file-name' is set." 4366 "Check that connection-local `explicit-shell-file-name' is set."
4353 ;; The handling of connection-local variables has changed. Test 4367 :tags '(:expensive-test)
4354 ;; must be reworked.
4355 :tags '(:expensive-test :unstable)
4356 (skip-unless (tramp--test-enabled)) 4368 (skip-unless (tramp--test-enabled))
4357 (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p))) 4369 ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
4370 ;; remote processes in Emacs. That doesn't work for tramp-adb.el.
4371 (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
4372 (tramp--test-sh-p)))
4358 ;; Since Emacs 26.1. 4373 ;; Since Emacs 26.1.
4359 (skip-unless (and (fboundp 'connection-local-set-profile-variables) 4374 (skip-unless (and (fboundp 'connection-local-set-profile-variables)
4360 (fboundp 'connection-local-set-profiles))) 4375 (fboundp 'connection-local-set-profiles)))
@@ -4368,15 +4383,16 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4368 (unwind-protect 4383 (unwind-protect
4369 (progn 4384 (progn
4370 ;; `shell-mode' would ruin our test, because it deletes all 4385 ;; `shell-mode' would ruin our test, because it deletes all
4371 ;; buffer local variables. 4386 ;; buffer local variables. Not needed in Emacs 27.1.
4372 (put 'explicit-shell-file-name 'permanent-local t) 4387 (put 'explicit-shell-file-name 'permanent-local t)
4373 ;; Declare connection-local variable `explicit-shell-file-name'. 4388 ;; Declare connection-local variables `explicit-shell-file-name'
4389 ;; and `explicit-sh-args'.
4374 (with-no-warnings 4390 (with-no-warnings
4375 (connection-local-set-profile-variables 4391 (connection-local-set-profile-variables
4376 'remote-sh 4392 'remote-sh
4377 `((explicit-shell-file-name 4393 `((explicit-shell-file-name
4378 . ,(if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")) 4394 . ,(if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh"))
4379 (explicit-sh-args . ("-i")))) 4395 (explicit-sh-args . ("-c" "echo foo"))))
4380 (connection-local-set-profiles 4396 (connection-local-set-profiles
4381 `(:application tramp 4397 `(:application tramp
4382 :protocol ,(file-remote-p default-directory 'method) 4398 :protocol ,(file-remote-p default-directory 'method)
@@ -4386,14 +4402,18 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4386 (put 'explicit-shell-file-name 'safe-local-variable #'identity) 4402 (put 'explicit-shell-file-name 'safe-local-variable #'identity)
4387 (put 'explicit-sh-args 'safe-local-variable #'identity) 4403 (put 'explicit-sh-args 'safe-local-variable #'identity)
4388 4404
4389 ;; Run interactive shell. Since the default directory is 4405 ;; Run `shell' interactively. Since the default directory
4390 ;; remote, `explicit-shell-file-name' shall be set in order 4406 ;; is remote, `explicit-shell-file-name' shall be set in
4391 ;; to avoid a question. 4407 ;; order to avoid a question. `explicit-sh-args' echoes the
4408 ;; test data.
4392 (with-current-buffer (get-buffer-create "*shell*") 4409 (with-current-buffer (get-buffer-create "*shell*")
4393 (ignore-errors (kill-process (current-buffer))) 4410 (ignore-errors (kill-process (current-buffer)))
4394 (should-not explicit-shell-file-name) 4411 (should-not explicit-shell-file-name)
4395 (call-interactively #'shell) 4412 (call-interactively #'shell)
4396 (should explicit-shell-file-name))) 4413 (with-timeout (10)
4414 (while (accept-process-output
4415 (get-buffer-process (current-buffer)) nil nil t)))
4416 (should (string-match "^foo$" (buffer-string)))))
4397 4417
4398 ;; Cleanup. 4418 ;; Cleanup.
4399 (put 'explicit-shell-file-name 'permanent-local nil) 4419 (put 'explicit-shell-file-name 'permanent-local nil)
@@ -5347,20 +5367,17 @@ process sentinels. They shall not disturb each other."
5347 ;; we mark it as unstable. 5367 ;; we mark it as unstable.
5348 :tags '(:expensive-test :unstable) 5368 :tags '(:expensive-test :unstable)
5349 (skip-unless (tramp--test-enabled)) 5369 (skip-unless (tramp--test-enabled))
5350 (skip-unless (tramp--test-sh-p)) 5370 ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
5351 ;; This test is sensible wrt to other running tests. Let it work 5371 ;; remote processes in Emacs. That doesn't work for tramp-adb.el.
5352 ;; only if it is the only selected test. 5372 (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
5353 ;; FIXME: There must be a better solution. 5373 (tramp--test-sh-p)))
5354 (skip-unless
5355 (= 1 (length
5356 (ert-select-tests (ert--stats-selector ert--current-run-stats) t))))
5357 5374
5358 (with-timeout 5375 (with-timeout
5359 (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler)) 5376 (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler))
5360 (define-key special-event-map [sigusr1] #'tramp--test-timeout-handler) 5377 (define-key special-event-map [sigusr1] #'tramp--test-timeout-handler)
5361 (let* (;; For the watchdog. 5378 (let* (;; For the watchdog.
5362 (default-directory (expand-file-name temporary-file-directory)) 5379 (default-directory (expand-file-name temporary-file-directory))
5363 (shell-file-name "/bin/sh") 5380 (shell-file-name (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh"))
5364 (watchdog 5381 (watchdog
5365 (start-process-shell-command 5382 (start-process-shell-command
5366 "*watchdog*" nil 5383 "*watchdog*" nil
@@ -5460,7 +5477,7 @@ process sentinels. They shall not disturb each other."
5460 "Process filter %s %s %s" proc string (current-time-string)) 5477 "Process filter %s %s %s" proc string (current-time-string))
5461 (with-current-buffer (process-buffer proc) 5478 (with-current-buffer (process-buffer proc)
5462 (insert string)) 5479 (insert string))
5463 (unless (zerop (length string)) 5480 (when (< (process-get proc 'bar) 2)
5464 (dired-uncache (process-get proc 'foo)) 5481 (dired-uncache (process-get proc 'foo))
5465 (should (file-attributes (process-get proc 'foo)))))) 5482 (should (file-attributes (process-get proc 'foo))))))
5466 ;; Add process sentinel. It shall not perform remote 5483 ;; Add process sentinel. It shall not perform remote
@@ -5513,7 +5530,12 @@ process sentinels. They shall not disturb each other."
5513 (dolist (buf buffers) 5530 (dolist (buf buffers)
5514 (with-current-buffer buf 5531 (with-current-buffer buf
5515 (should 5532 (should
5516 (string-equal (format "%s\n%s\n" buf buf) (buffer-string))))) 5533 (string-equal
5534 ;; tramp-adb.el echoes, so we must add the three strings.
5535 (if (tramp--test-adb-p)
5536 (format "%s\n%s\n%s\n%s\n%s\n" buf buf buf buf buf)
5537 (format "%s\n%s\n" buf buf))
5538 (buffer-string)))))
5517 (should-not 5539 (should-not
5518 (directory-files 5540 (directory-files
5519 tmp-name nil directory-files-no-dot-files-regexp))) 5541 tmp-name nil directory-files-no-dot-files-regexp)))
@@ -5714,11 +5736,9 @@ Since it unloads Tramp, it shall be the last test to run."
5714;; do not work properly for `nextcloud'. 5736;; do not work properly for `nextcloud'.
5715;; * Fix `tramp-test29-start-file-process' and 5737;; * Fix `tramp-test29-start-file-process' and
5716;; `tramp-test30-make-process' on MS Windows (`process-send-eof'?). 5738;; `tramp-test30-make-process' on MS Windows (`process-send-eof'?).
5717;; * Fix `tramp-test29-start-file-process', 5739;; * Fix Bug#16928 in `tramp-test43-asynchronous-requests'. Looks
5718;; `tramp-test30-make-process' and `tramp-test32-shell-command' for 5740;; like it is resolved now. Remove `:unstable' tag?
5719;; `adb' (see comment in `tramp-adb-send-command'). 5741;; * Implement `tramp-test31-interrupt-process' for `adb'.
5720;; * Rework `tramp-test34-explicit-shell-file-name'.
5721;; * Fix Bug#16928 in `tramp-test43-asynchronous-requests'.
5722 5742
5723(provide 'tramp-tests) 5743(provide 'tramp-tests)
5724;;; tramp-tests.el ends here 5744;;; tramp-tests.el ends here
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el
index 629cdf9a137..732193476dd 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -142,6 +142,8 @@ SEVERITY-PREDICATE is used to setup
142 142
143(ert-deftest different-diagnostic-types () 143(ert-deftest different-diagnostic-types ()
144 "Test GCC warning via function predicate." 144 "Test GCC warning via function predicate."
145 ;; http://lists.gnu.org/archive/html/emacs-devel/2019-03/msg01043.html
146 :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed)
145 (skip-unless (and (executable-find "gcc") 147 (skip-unless (and (executable-find "gcc")
146 (version<= 148 (version<=
147 "5" (string-trim 149 "5" (string-trim
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 94c846ecb16..999cf8dc7a3 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5345,13 +5345,23 @@ class SomeClass:
5345(ert-deftest python-tests--python-nav-end-of-statement--infloop () 5345(ert-deftest python-tests--python-nav-end-of-statement--infloop ()
5346 "Checks that `python-nav-end-of-statement' doesn't infloop in a 5346 "Checks that `python-nav-end-of-statement' doesn't infloop in a
5347buffer with overlapping strings." 5347buffer with overlapping strings."
5348 ;; FIXME: The treatment of strings has changed in the mean time, and the
5349 ;; test below now neither signals an error nor inf-loops.
5350 ;; The description of the problem it's trying to catch is not clear enough
5351 ;; to be able to see if the underlying problem is really fixed, sadly.
5352 ;; E.g. I don't know what is meant by "overlap", really.
5353 (skip-unless nil)
5348 (python-tests-with-temp-buffer "''' '\n''' ' '\n" 5354 (python-tests-with-temp-buffer "''' '\n''' ' '\n"
5349 (syntax-propertize (point-max)) 5355 (syntax-propertize (point-max))
5350 ;; Create a situation where strings nominally overlap. This 5356 ;; Create a situation where strings nominally overlap. This
5351 ;; shouldn't happen in practice, but apparently it can happen when 5357 ;; shouldn't happen in practice, but apparently it can happen when
5352 ;; a package calls `syntax-ppss' in a narrowed buffer during JIT 5358 ;; a package calls `syntax-ppss' in a narrowed buffer during JIT
5353 ;; lock. 5359 ;; lock.
5360 ;; FIXME: 4-5 is the SPC right after the opening triple quotes: why
5361 ;; put a string-fence syntax on it?
5354 (put-text-property 4 5 'syntax-table (string-to-syntax "|")) 5362 (put-text-property 4 5 'syntax-table (string-to-syntax "|"))
5363 ;; FIXME: 8-9 is the middle quote in the closing triple quotes:
5364 ;; it shouldn't have any syntax-table property to remove anyway!
5355 (remove-text-properties 8 9 '(syntax-table nil)) 5365 (remove-text-properties 8 9 '(syntax-table nil))
5356 (goto-char 4) 5366 (goto-char 4)
5357 (setq-local syntax-propertize-function nil) 5367 (setq-local syntax-propertize-function nil)
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
new file mode 100644
index 00000000000..a4350e715ed
--- /dev/null
+++ b/test/lisp/wid-edit-tests.el
@@ -0,0 +1,39 @@
1;;; wid-edit-tests.el --- tests for wid-edit.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(require 'wid-edit)
24
25(ert-deftest widget-at ()
26 "Test `widget-at' behavior."
27 (with-temp-buffer
28 (should-not (widget-at))
29 (let ((marco (widget-create 'link "link widget"))
30 (polo (widget-at (1- (point)))))
31 (should (widgetp polo))
32 (should (eq marco polo)))
33 ;; Buttons and widgets are incompatible (bug#34506).
34 (insert-text-button "text button")
35 (should-not (widget-at (1- (point))))
36 (insert-button "overlay button")
37 (should-not (widget-at (1- (point))))))
38
39;;; wid-edit-tests.el ends here