summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorK. Handa <handa@gnu.org>2015-09-27 17:06:12 +0900
committerK. Handa <handa@gnu.org>2015-09-27 17:06:12 +0900
commit52beda922d2cb523a03661bf74b8678c8b45e440 (patch)
tree04617b37298746a61d5324a5b35c9b71f439d762 /test
parent94ed5167557112fb00eeca05e62589db744206de (diff)
parent1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff)
downloademacs-52beda922d2cb523a03661bf74b8678c8b45e440.tar.gz
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'test')
-rw-r--r--test/automated/Makefile.in2
-rw-r--r--test/automated/auto-revert-tests.el62
-rw-r--r--test/automated/compile-tests.el8
-rw-r--r--test/automated/elisp-mode-tests.el44
-rw-r--r--test/automated/ert-x-tests.el4
-rw-r--r--test/automated/file-notify-tests.el317
-rw-r--r--test/automated/icalendar-tests.el10
-rw-r--r--test/automated/info-xref.el2
-rw-r--r--test/automated/seq-tests.el10
-rw-r--r--test/etags/el-src/emacs/lisp/progmodes/etags.el2
-rw-r--r--test/indent/prolog.prolog27
11 files changed, 355 insertions, 133 deletions
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index 59a88663e2a..41f54f8aa69 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -86,7 +86,7 @@ WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@
## -l ./basename treats basename as a literal file (it would be nice
## to change this; bug#17848 - if that gets done, this can be simplified).
##
-## Beware: it approximates `no-byte-compile', so watch out for false-positives!
+## Beware: it approximates 'no-byte-compile', so watch out for false-positives!
%.log: ${srcdir}/%.el
@if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
loadfile=$<; \
diff --git a/test/automated/auto-revert-tests.el b/test/automated/auto-revert-tests.el
index 204e03d423d..86184d613fc 100644
--- a/test/automated/auto-revert-tests.el
+++ b/test/automated/auto-revert-tests.el
@@ -28,7 +28,18 @@
(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
auto-revert-stop-on-user-input nil)
-(defvar auto-revert--timeout 10)
+(defconst auto-revert--timeout 10
+ "Time to wait until a message appears in the *Messages* buffer.")
+
+(defun auto-revert--wait-for-revert (buffer)
+ "Wait until the *Messages* buffer reports reversion of BUFFER."
+ (with-timeout (auto-revert--timeout nil)
+ (with-current-buffer "*Messages*"
+ (while
+ (null (string-match
+ (format-message "Reverting buffer `%s'." (buffer-name buffer))
+ (buffer-string)))
+ (read-event nil nil 0.1)))))
(ert-deftest auto-revert-test00-auto-revert-mode ()
"Check autorevert for a file."
@@ -57,13 +68,7 @@
(write-region "another text" nil tmpfile nil 'no-message)
;; Check, that the buffer has been reverted.
- (with-timeout (auto-revert--timeout nil)
- (with-current-buffer "*Messages*"
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- (read-event nil nil 0.1))))
+ (auto-revert--wait-for-revert buf)
(should (string-match "another text" (buffer-string)))
;; When the buffer is modified, it shall not be reverted.
@@ -73,14 +78,8 @@
(sleep-for 1)
(write-region "any text" nil tmpfile nil 'no-message)
- ;; Check, whether the buffer has been reverted.
- (with-timeout (auto-revert--timeout nil)
- (with-current-buffer "*Messages*"
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- (read-event nil nil 0.1))))
+ ;; Check, that the buffer hasn't been reverted.
+ (auto-revert--wait-for-revert buf)
(should-not (string-match "any text" (buffer-string)))))
;; Exit.
@@ -119,13 +118,7 @@
(write-region "another text" nil tmpfile 'append 'no-message)
;; Check, that the buffer has been reverted.
- (with-timeout (auto-revert--timeout nil)
- (with-current-buffer "*Messages*"
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- (read-event nil nil 0.1))))
+ (auto-revert--wait-for-revert buf)
(should
(string-match "modified text\nanother text" (buffer-string)))))
@@ -162,16 +155,9 @@
(delete-file tmpfile)
;; Check, that the buffer has been reverted.
- (with-timeout (auto-revert--timeout nil)
- (with-current-buffer "*Messages*"
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- (read-event nil nil 0.1))))
- (should
- (null
- (string-match name (substring-no-properties (buffer-string)))))
+ (auto-revert--wait-for-revert buf)
+ (should-not
+ (string-match name (substring-no-properties (buffer-string))))
;; Make dired buffer modified. Check, that the buffer has
;; been still reverted.
@@ -181,14 +167,8 @@
(sleep-for 1)
(write-region "any text" nil tmpfile nil 'no-message)
- ;; Check, that the buffer hasn't been reverted.
- (with-timeout (auto-revert--timeout nil)
- (with-current-buffer "*Messages*"
- (while
- (null (string-match
- (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string)))
- (read-event nil nil 0.1))))
+ ;; Check, that the buffer has been reverted.
+ (auto-revert--wait-for-revert buf)
(should
(string-match name (substring-no-properties (buffer-string))))))
diff --git a/test/automated/compile-tests.el b/test/automated/compile-tests.el
index 0c383f7c7b6..0974a78e073 100644
--- a/test/automated/compile-tests.el
+++ b/test/automated/compile-tests.el
@@ -228,10 +228,10 @@
("1>test_main.cpp(29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int"
3 nil 29 "test_main.cpp")
;; watcom
- ("..\src\ctrl\lister.c(109): Error! E1009: Expecting ';' but found '{'"
- 1 nil 109 "..\src\ctrl\lister.c")
- ("..\src\ctrl\lister.c(120): Warning! W201: Unreachable code"
- 1 nil 120 "..\src\ctrl\lister.c")
+ ("..\\src\\ctrl\\lister.c(109): Error! E1009: Expecting ';' but found '{'"
+ 1 nil 109 "..\\src\\ctrl\\lister.c")
+ ("..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code"
+ 1 nil 120 "..\\src\\ctrl\\lister.c")
;; oracle
("Semantic error at line 528, column 5, file erosacqdb.pc:"
1 5 528 "erosacqdb.pc")
diff --git a/test/automated/elisp-mode-tests.el b/test/automated/elisp-mode-tests.el
index 7886b557141..2f6675a2804 100644
--- a/test/automated/elisp-mode-tests.el
+++ b/test/automated/elisp-mode-tests.el
@@ -258,7 +258,7 @@ to (xref-elisp-test-descr-to-target xref)."
(cl-defstruct (xref-elisp-root-type)
slot-1)
-(cl-defgeneric xref-elisp-generic-no-methods ()
+(cl-defgeneric xref-elisp-generic-no-methods (arg1 arg2)
"doc string generic no-methods"
;; No default implementation, no methods, but fboundp is true for
;; this symbol; it calls cl-no-applicable-method
@@ -269,44 +269,44 @@ to (xref-elisp-test-descr-to-target xref)."
;; causes the batch mode test to fail; the symbol shows up as
;; ‘this’. It passes in interactive tests, so I haven't been able to
;; track down the problem.
-(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type))
+(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2)
"doc string generic no-default xref-elisp-root-type"
"non-default for no-default")
;; defgeneric after defmethod in file to ensure the fallback search
;; method of just looking for the function name will fail.
-(cl-defgeneric xref-elisp-generic-no-default ()
+(cl-defgeneric xref-elisp-generic-no-default (arg1 arg2)
"doc string generic no-default generic"
;; No default implementation; this function calls the cl-generic
;; dispatching code.
)
-(cl-defgeneric xref-elisp-generic-co-located-default ()
+(cl-defgeneric xref-elisp-generic-co-located-default (arg1 arg2)
"doc string generic co-located-default"
"co-located default")
-(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type))
+(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2)
"doc string generic co-located-default xref-elisp-root-type"
"non-default for co-located-default")
-(cl-defgeneric xref-elisp-generic-separate-default ()
+(cl-defgeneric xref-elisp-generic-separate-default (arg1 arg2)
"doc string generic separate-default"
;; default implementation provided separately
)
-(cl-defmethod xref-elisp-generic-separate-default ()
+(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2)
"doc string generic separate-default default"
"separate default")
-(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type))
+(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2)
"doc string generic separate-default xref-elisp-root-type"
"non-default for separate-default")
-(cl-defmethod xref-elisp-generic-implicit-generic ()
+(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2)
"doc string generic implicit-generic default"
"default for implicit generic")
-(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type))
+(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2)
"doc string generic implicit-generic xref-elisp-root-type"
"non-default for implicit generic")
@@ -327,9 +327,9 @@ to (xref-elisp-test-descr-to-target xref)."
(xref-make-elisp-location
'xref-elisp-generic-no-default 'cl-defgeneric
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
- (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type)))"
+ (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-no-default xref-elisp-root-type) 'cl-defmethod
+ '(xref-elisp-generic-no-default xref-elisp-root-type t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
))
@@ -340,9 +340,9 @@ to (xref-elisp-test-descr-to-target xref)."
(xref-make-elisp-location
'xref-elisp-generic-co-located-default 'cl-defgeneric
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
- (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type)))"
+ (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-co-located-default xref-elisp-root-type) 'cl-defmethod
+ '(xref-elisp-generic-co-located-default xref-elisp-root-type t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
))
@@ -353,26 +353,26 @@ to (xref-elisp-test-descr-to-target xref)."
(xref-make-elisp-location
'xref-elisp-generic-separate-default 'cl-defgeneric
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
- (xref-make "(cl-defmethod xref-elisp-generic-separate-default ())"
+ (xref-make "(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-separate-default) 'cl-defmethod
+ '(xref-elisp-generic-separate-default t t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
- (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type)))"
+ (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-separate-default xref-elisp-root-type) 'cl-defmethod
+ '(xref-elisp-generic-separate-default xref-elisp-root-type t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
))
(xref-elisp-deftest find-defs-defgeneric-implicit-generic
(elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic)
(list
- (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ())"
+ (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-implicit-generic) 'cl-defmethod
+ '(xref-elisp-generic-implicit-generic t t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
- (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type)))"
+ (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2))"
(xref-make-elisp-location
- '(xref-elisp-generic-implicit-generic xref-elisp-root-type) 'cl-defmethod
+ '(xref-elisp-generic-implicit-generic xref-elisp-root-type t) 'cl-defmethod
(expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
))
diff --git a/test/automated/ert-x-tests.el b/test/automated/ert-x-tests.el
index 11b7ed4da7f..660a1cb218e 100644
--- a/test/automated/ert-x-tests.el
+++ b/test/automated/ert-x-tests.el
@@ -224,8 +224,8 @@
"This test attempts to demonstrate that there is no way to
force immediate truncation of the *Messages* buffer from Lisp
\(and hence justifies the existence of
-`ert--force-message-log-buffer-truncation'\): The only way that
-came to my mind was \(message \"\"\), which doesn't have the
+`ert--force-message-log-buffer-truncation'): The only way that
+came to my mind was \(message \"\"), which doesn't have the
desired effect."
:tags '(:causes-redisplay)
(ert-with-buffer-renamed ("*Messages*")
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 11589b99295..03946dd8acf 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -1,4 +1,4 @@
-;;; file-notify-tests.el --- Tests of file notifications
+;;; file-notify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*-
;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
@@ -60,6 +60,35 @@
(defvar file-notify--test-desc nil)
(defvar file-notify--test-results nil)
(defvar file-notify--test-event nil)
+(defvar file-notify--test-events nil)
+(defun file-notify--test-timeout ()
+ (if (file-remote-p temporary-file-directory) 6 3))
+
+(defun file-notify--test-cleanup ()
+ "Cleanup after a test."
+ (file-notify-rm-watch file-notify--test-desc)
+
+ (when (and file-notify--test-tmpfile
+ (file-exists-p file-notify--test-tmpfile))
+ (if (directory-name-p file-notify--test-tmpfile)
+ (delete-directory file-notify--test-tmpfile 'recursive)
+ (delete-file file-notify--test-tmpfile)))
+ (when (and file-notify--test-tmpfile1
+ (file-exists-p file-notify--test-tmpfile1))
+ (if (directory-name-p file-notify--test-tmpfile1)
+ (delete-directory file-notify--test-tmpfile1 'recursive)
+ (delete-file file-notify--test-tmpfile1)))
+ (when (file-remote-p temporary-file-directory)
+ (tramp-cleanup-connection
+ (tramp-dissect-file-name temporary-file-directory) nil 'keep-password))
+
+ (setq file-notify--test-tmpfile nil)
+ (setq file-notify--test-tmpfile1 nil)
+ (setq file-notify--test-desc nil)
+ (setq file-notify--test-results nil)
+ (setq file-notify--test-events nil)
+ (when file-notify--test-event
+ (error "file-notify--test-event should not be set but bound dynamically")))
(setq password-cache-expiry nil
tramp-verbose 0
@@ -116,10 +145,19 @@ being the result.")
(ert-deftest file-notify-test00-availability ()
"Test availability of `file-notify'."
(skip-unless (file-notify--test-local-enabled))
+ ;; Report the native library which has been used.
+ (if (null (file-remote-p temporary-file-directory))
+ (message "Local library: `%s'" file-notify--library)
+ (message "Remote command: `%s'"
+ (replace-regexp-in-string
+ "<[[:digit:]]+>\\'" ""
+ (process-name (cdr file-notify--test-remote-enabled-checked)))))
(should
(setq file-notify--test-desc
(file-notify-add-watch temporary-file-directory '(change) 'ignore)))
- (file-notify-rm-watch file-notify--test-desc))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup))
(file-notify--deftest-remote file-notify-test00-availability
"Test availability of `file-notify' for remote files.")
@@ -157,7 +195,10 @@ being the result.")
(should
(equal (should-error
(file-notify-add-watch temporary-file-directory '(change) 3))
- '(wrong-type-argument 3))))
+ '(wrong-type-argument 3)))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup))
(file-notify--deftest-remote file-notify-test01-add-watch
"Check `file-notify-add-watch' for remote files.")
@@ -166,7 +207,7 @@ being the result.")
"Ert test function to be called by `file-notify--test-event-handler'.
We cannot pass arguments, so we assume that `file-notify--test-event'
is bound somewhere."
- ;(message "Event %S" file-notify--test-event)
+ ;;(message "Event %S" file-notify--test-event)
;; Check the descriptor.
(should (equal (car file-notify--test-event) file-notify--test-desc))
;; Check the file name.
@@ -180,11 +221,15 @@ is bound somewhere."
(file-notify--event-file1-name file-notify--test-event)
file-notify--test-tmpfile1))))
-(defun file-notify--test-event-handler (file-notify--test-event)
+(defun file-notify--test-event-handler (event)
"Run a test over FILE-NOTIFY--TEST-EVENT.
-Save the result in `file-notify--test-results', for later analysis."
- (let ((result
- (ert-run-test (make-ert-test :body 'file-notify--test-event-test))))
+For later analysis, append the test result to `file-notify--test-results'
+and the event to `file-notify--test-events'."
+ (let* ((file-notify--test-event event)
+ (result
+ (ert-run-test (make-ert-test :body 'file-notify--test-event-test))))
+ (setq file-notify--test-events
+ (append file-notify--test-events `(,file-notify--test-event)))
(setq file-notify--test-results
(append file-notify--test-results `(,result)))))
@@ -194,60 +239,123 @@ Save the result in `file-notify--test-results', for later analysis."
(make-temp-name "file-notify-test") temporary-file-directory))
(defmacro file-notify--wait-for-events (timeout until)
- "Wait for file notification events until form UNTIL is true.
+ "Wait for and return file notification events until form UNTIL is true.
TIMEOUT is the maximum time to wait for, in seconds."
`(with-timeout (,timeout (ignore))
(while (null ,until)
(read-event nil nil 0.1))))
+(defmacro file-notify--test-with-events (timeout events &rest body)
+ "Run BODY collecting events and then compare with EVENTS.
+Don't wait longer than TIMEOUT seconds for the events to be delivered."
+ (declare (indent 2))
+ (let ((outer (make-symbol "outer")))
+ `(let ((,outer file-notify--test-events))
+ (let (file-notify--test-events)
+ ,@body
+ (file-notify--wait-for-events
+ ,timeout (= (length ,events) (length file-notify--test-events)))
+ (should (equal ,events (mapcar #'cadr file-notify--test-events)))
+ (setq ,outer (append ,outer file-notify--test-events)))
+ (setq file-notify--test-events ,outer))))
+
(ert-deftest file-notify-test02-events ()
- "Check file creation/removal notifications."
+ "Check file creation/change/removal notifications."
(skip-unless (file-notify--test-local-enabled))
(unwind-protect
(progn
- (setq file-notify--test-results nil
- file-notify--test-tmpfile (file-notify--test-make-temp-name)
+ ;; Check creation, change, and deletion.
+ (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
file-notify--test-tmpfile1 (file-notify--test-make-temp-name)
file-notify--test-desc
(file-notify-add-watch
file-notify--test-tmpfile
'(change) 'file-notify--test-event-handler))
+ (file-notify--test-with-events
+ (file-notify--test-timeout) '(created changed deleted)
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (delete-file file-notify--test-tmpfile))
+ (file-notify-rm-watch file-notify--test-desc)
+
+ ;; Check copy.
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) 'file-notify--test-event-handler))
(should file-notify--test-desc)
-
- ;; Check creation and removal.
- (write-region
- "any text" nil file-notify--test-tmpfile nil 'no-message)
- (delete-file file-notify--test-tmpfile)
- (sleep-for 0.1)
-
- ;; Check copy and rename.
- (write-region
- "any text" nil file-notify--test-tmpfile nil 'no-message)
- (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
- (delete-file file-notify--test-tmpfile)
- (delete-file file-notify--test-tmpfile1)
- (sleep-for 0.1)
-
- (write-region
- "any text" nil file-notify--test-tmpfile nil 'no-message)
- (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
- (delete-file file-notify--test-tmpfile1)
- (sleep-for 0.1))
-
- ;; Wait for events, and exit.
- (file-notify--wait-for-events 5 file-notify--test-results)
- (file-notify-rm-watch file-notify--test-desc)
- (ignore-errors (delete-file file-notify--test-tmpfile))
- (ignore-errors (delete-file file-notify--test-tmpfile1)))
-
- (should file-notify--test-results)
- (dolist (result file-notify--test-results)
- ;(message "%s" (ert-test-result-messages result))
- (when (ert-test-failed-p result)
- (ert-fail (cadr (ert-test-result-with-condition-condition result))))))
+ (file-notify--test-with-events
+ (file-notify--test-timeout)
+ ;; w32notify does not distinguish between `changed' and
+ ;; `attribute-changed'.
+ (if (eq file-notify--library 'w32notify)
+ '(created changed changed deleted)
+ '(created changed deleted))
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
+ ;; The next two events shall not be visible.
+ (set-file-modes file-notify--test-tmpfile 000)
+ (read-event nil nil 0.1) ; In order to distinguish the events.
+ (set-file-times file-notify--test-tmpfile '(0 0))
+ (delete-file file-notify--test-tmpfile)
+ (delete-file file-notify--test-tmpfile1))
+ (file-notify-rm-watch file-notify--test-desc)
+
+ ;; Check rename.
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) 'file-notify--test-event-handler))
+ (should file-notify--test-desc)
+ (file-notify--test-with-events
+ (file-notify--test-timeout) '(created changed renamed)
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
+ ;; After the rename, we won't get events anymore.
+ (delete-file file-notify--test-tmpfile1))
+ (file-notify-rm-watch file-notify--test-desc)
+
+ ;; Check attribute change. It doesn't work for w32notify.
+ (unless (eq file-notify--library 'w32notify)
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(attribute-change) 'file-notify--test-event-handler))
+ (file-notify--test-with-events
+ (file-notify--test-timeout) '(attribute-changed attribute-changed)
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (set-file-modes file-notify--test-tmpfile 000)
+ (read-event nil nil 0.1) ; In order to distinguish the events.
+ (set-file-times file-notify--test-tmpfile '(0 0))
+ (delete-file file-notify--test-tmpfile))
+ (file-notify-rm-watch file-notify--test-desc))
+
+ ;; Check the global sequence again just to make sure that
+ ;; `file-notify--test-events' has been set correctly.
+ (should (equal (mapcar #'cadr file-notify--test-events)
+ (if (eq file-notify--library 'w32notify)
+ '(created changed deleted
+ created changed changed deleted
+ created changed renamed)
+ '(created changed deleted
+ created changed deleted
+ created changed renamed
+ attribute-changed attribute-changed))))
+ (should file-notify--test-results)
+ (dolist (result file-notify--test-results)
+ ;;(message "%s" (ert-test-result-messages result))
+ (when (ert-test-failed-p result)
+ (ert-fail
+ (cadr (ert-test-result-with-condition-condition result))))))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup)))
(file-notify--deftest-remote file-notify-test02-events
- "Check file creation/removal notifications for remote files.")
+ "Check file creation/change/removal notifications for remote files.")
(require 'autorevert)
(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
@@ -255,8 +363,7 @@ TIMEOUT is the maximum time to wait for, in seconds."
auto-revert-stop-on-user-input nil)
(ert-deftest file-notify-test03-autorevert ()
- "Check autorevert via file notification.
-This test is skipped in batch mode."
+ "Check autorevert via file notification."
(skip-unless (file-notify--test-local-enabled))
;; `auto-revert-buffers' runs every 5". And we must wait, until the
;; file has been reverted.
@@ -297,17 +404,121 @@ This test is skipped in batch mode."
(with-current-buffer (get-buffer-create "*Messages*")
(file-notify--wait-for-events
timeout
- (string-match (format "Reverting buffer `%s'." (buffer-name buf))
- (buffer-string))))
+ (string-match
+ (format-message "Reverting buffer `%s'." (buffer-name buf))
+ (buffer-string))))
(should (string-match "another text" (buffer-string)))))
- ;; Exit.
+ ;; Cleanup.
(ignore-errors (kill-buffer buf))
- (ignore-errors (delete-file file-notify--test-tmpfile)))))
+ (file-notify--test-cleanup))))
(file-notify--deftest-remote file-notify-test03-autorevert
- "Check autorevert via file notification for remote files.
-This test is skipped in batch mode.")
+ "Check autorevert via file notification for remote files.")
+
+(ert-deftest file-notify-test04-file-validity ()
+ "Check `file-notify-valid-p' for files."
+ (skip-unless (file-notify--test-local-enabled))
+
+ (unwind-protect
+ (progn
+ (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) #'file-notify--test-event-handler))
+ (file-notify--test-with-events
+ (file-notify--test-timeout) '(created changed)
+ (should (file-notify-valid-p file-notify--test-desc))
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (should (file-notify-valid-p file-notify--test-desc)))
+ ;; After removing the watch, the descriptor must not be valid
+ ;; anymore.
+ (file-notify-rm-watch file-notify--test-desc)
+ (should-not (file-notify-valid-p file-notify--test-desc)))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup))
+
+ (unwind-protect
+ ;; The batch-mode operation of w32notify is fragile (there's no
+ ;; input threads to send the message to).
+ (unless (and noninteractive (eq file-notify--library 'w32notify))
+ (let ((temporary-file-directory (make-temp-file
+ "file-notify-test-parent" t)))
+ (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) #'file-notify--test-event-handler))
+ (file-notify--test-with-events
+ (file-notify--test-timeout) '(created changed)
+ (should (file-notify-valid-p file-notify--test-desc))
+ (write-region
+ "any text" nil file-notify--test-tmpfile nil 'no-message)
+ (should (file-notify-valid-p file-notify--test-desc)))
+ ;; After deleting the parent, the descriptor must not be valid
+ ;; anymore.
+ (delete-directory temporary-file-directory t)
+ (file-notify--wait-for-events
+ (file-notify--test-timeout)
+ (not (file-notify-valid-p file-notify--test-desc)))
+ (should-not (file-notify-valid-p file-notify--test-desc))))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup)))
+
+(file-notify--deftest-remote file-notify-test04-file-validity
+ "Check `file-notify-valid-p' via file notification for remote files.")
+
+(ert-deftest file-notify-test05-dir-validity ()
+ "Check `file-notify-valid-p' for directories."
+ (skip-unless (file-notify--test-local-enabled))
+
+ (unwind-protect
+ (progn
+ (setq file-notify--test-tmpfile (file-name-as-directory
+ (file-notify--test-make-temp-name)))
+ (make-directory file-notify--test-tmpfile)
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) #'file-notify--test-event-handler))
+ (should (file-notify-valid-p file-notify--test-desc))
+ ;; After removing the watch, the descriptor must not be valid
+ ;; anymore.
+ (file-notify-rm-watch file-notify--test-desc)
+ (should-not (file-notify-valid-p file-notify--test-desc)))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup))
+
+ (unwind-protect
+ ;; The batch-mode operation of w32notify is fragile (there's no
+ ;; input threads to send the message to).
+ (unless (and noninteractive (eq file-notify--library 'w32notify))
+ (setq file-notify--test-tmpfile (file-name-as-directory
+ (file-notify--test-make-temp-name)))
+ (make-directory file-notify--test-tmpfile)
+ (setq file-notify--test-desc
+ (file-notify-add-watch
+ file-notify--test-tmpfile
+ '(change) #'file-notify--test-event-handler))
+ (should (file-notify-valid-p file-notify--test-desc))
+ ;; After deleting the directory, the descriptor must not be
+ ;; valid anymore.
+ (delete-directory file-notify--test-tmpfile t)
+ (file-notify--wait-for-events
+ (file-notify--test-timeout)
+ (not (file-notify-valid-p file-notify--test-desc)))
+ (should-not (file-notify-valid-p file-notify--test-desc)))
+
+ ;; Cleanup.
+ (file-notify--test-cleanup)))
+
+(file-notify--deftest-remote file-notify-test05-dir-validity
+ "Check `file-notify-valid-p' via file notification for remote directories.")
(defun file-notify-test-all (&optional interactive)
"Run all tests for \\[file-notify]."
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el
index c83044c719e..7e05d49883e 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -213,7 +213,7 @@ END:VTIMEZONE
(should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
(cdr result)))
(setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
-TZID:anothername\, with a comma
+TZID:anothername, with a comma
BEGIN:STANDARD
DTSTART:16010101T040000
TZOFFSETFROM:+0300
@@ -235,7 +235,7 @@ END:VTIMEZONE
(cdr result)))
;; offsetfrom = offsetto
(setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
-TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
+TZID:Kolkata, Chennai, Mumbai, New Delhi
X-MICROSOFT-CDO-TZID:23
BEGIN:STANDARD
DTSTART:16010101T000000
@@ -1327,7 +1327,7 @@ DTEND;VALUE=DATE-TIME:20030919T113000"
(icalendar-tests--test-import
"BEGIN:VCALENDAR
BEGIN:VTIMEZONE
-TZID:fictional\, nonexistent\, arbitrary
+TZID:fictional, nonexistent, arbitrary
BEGIN:STANDARD
DTSTART:20100101T000000
TZOFFSETFROM:+0200
@@ -1463,7 +1463,7 @@ METHOD:REQUEST
PRODID:Microsoft CDO for Microsoft Exchange
VERSION:2.0
BEGIN:VTIMEZONE
-TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
+TZID:Kolkata, Chennai, Mumbai, New Delhi
X-MICROSOFT-CDO-TZID:23
BEGIN:STANDARD
DTSTART:16010101T000000
@@ -2174,7 +2174,7 @@ METHOD:REQUEST
PRODID:Microsoft Exchange Server 2007
VERSION:2.0
BEGIN:VTIMEZONE
-TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna
+TZID:(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
diff --git a/test/automated/info-xref.el b/test/automated/info-xref.el
index 98d24e1f093..67f963beb00 100644
--- a/test/automated/info-xref.el
+++ b/test/automated/info-xref.el
@@ -64,7 +64,7 @@ RESULT is a list (NBAD NGOOD NUNAVAIL)."
"Write BODY to texi FILE."
(with-temp-buffer
(insert "\
-\input texinfo
+\\input texinfo
@setfilename "
(format "%s.info\n" (file-name-sans-extension file))
"\
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index 07a183d024e..7023c94c0c7 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -138,6 +138,16 @@ Evaluate BODY for each created sequence.
(should-not (seq-some #'test-sequences-oddp seq)))
(should (seq-some #'null '(1 nil 2))))
+(ert-deftest test-seq-find ()
+ (with-test-sequences (seq '(4 3 2 1))
+ (should (= 4 (seq-find #'test-sequences-evenp seq)))
+ (should (= 3 (seq-find #'test-sequences-oddp seq)))
+ (should-not (seq-find (lambda (elt) (> elt 10)) seq)))
+ (should-not (seq-find #'null '(1 nil 2)))
+ (should-not (seq-find #'null '(1 nil 2) t))
+ (should-not (seq-find #'null '(1 2 3)))
+ (should (seq-find #'null '(1 2 3) 'sentinel)))
+
(ert-deftest test-seq-contains ()
(with-test-sequences (seq '(3 4 5 6))
(should (seq-contains seq 3))
diff --git a/test/etags/el-src/emacs/lisp/progmodes/etags.el b/test/etags/el-src/emacs/lisp/progmodes/etags.el
index 6acafdbaba0..4e079200ee0 100644
--- a/test/etags/el-src/emacs/lisp/progmodes/etags.el
+++ b/test/etags/el-src/emacs/lisp/progmodes/etags.el
@@ -1766,7 +1766,7 @@ if the file was newly read in, the value is the filename."
"No \\[tags-search] or \\[tags-query-replace] in progress"))
"Form for `tags-loop-continue' to eval to scan one file.
If it returns non-nil, this file needs processing by evalling
-\`tags-loop-operate'. Otherwise, move on to the next file.")
+`tags-loop-operate'. Otherwise, move on to the next file.")
(defun tags-loop-eval (form)
"Evaluate FORM and return its result.
diff --git a/test/indent/prolog.prolog b/test/indent/prolog.prolog
index 5b5d272c579..6bf9437b883 100644
--- a/test/indent/prolog.prolog
+++ b/test/indent/prolog.prolog
@@ -1,5 +1,26 @@
%% -*- mode: prolog; coding: utf-8; fill-column: 78 -*-
+%% bug#21526
+test1 :-
+ ( a ->
+ ( a ->
+ b
+ ; c
+ )
+ ; c
+ ).
+
+test2 :-
+ ( a
+ -> ( a,
+ b
+ ; c
+ ),
+ b2
+ ; c1,
+ c2
+ )
+
%% Testing correct tokenizing.
foo(X) :- 0'= = X.
foo(X) :- 8'234 = X.
@@ -50,9 +71,9 @@ subst(X, V, FV, lambda(Y, Ti, Bi), lambda(Y1, To, Bo)) :-
%% Perform substitution on the body.
subst(X, V, FV, Bi1, Bo)),
( X = Y
- %% If X is equal to Y, X is shadowed, so no subst can take place.
- -> Y1 = Y, Bo = Bi
- ; (member((Y, _), FV)
+ %% If X is equal to Y, X is shadowed, so no subst can take place.
+ -> Y1 = Y, Bo = Bi
+ ; (member((Y, _), FV)
%% If Y appears in FV, it can appear in V, so we need to
%% rename it to avoid name capture.
-> new_atom(Y, Y1),