aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorK. Handa2015-09-27 17:06:12 +0900
committerK. Handa2015-09-27 17:06:12 +0900
commit52beda922d2cb523a03661bf74b8678c8b45e440 (patch)
tree04617b37298746a61d5324a5b35c9b71f439d762 /test
parent94ed5167557112fb00eeca05e62589db744206de (diff)
parent1ac5a9c20cb22efb398fa18781c6b932dd4e54df (diff)
downloademacs-52beda922d2cb523a03661bf74b8678c8b45e440.tar.gz
emacs-52beda922d2cb523a03661bf74b8678c8b45e440.zip
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: $@
86## -l ./basename treats basename as a literal file (it would be nice 86## -l ./basename treats basename as a literal file (it would be nice
87## to change this; bug#17848 - if that gets done, this can be simplified). 87## to change this; bug#17848 - if that gets done, this can be simplified).
88## 88##
89## Beware: it approximates `no-byte-compile', so watch out for false-positives! 89## Beware: it approximates 'no-byte-compile', so watch out for false-positives!
90%.log: ${srcdir}/%.el 90%.log: ${srcdir}/%.el
91 @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \ 91 @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
92 loadfile=$<; \ 92 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 @@
28(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" 28(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded"
29 auto-revert-stop-on-user-input nil) 29 auto-revert-stop-on-user-input nil)
30 30
31(defvar auto-revert--timeout 10) 31(defconst auto-revert--timeout 10
32 "Time to wait until a message appears in the *Messages* buffer.")
33
34(defun auto-revert--wait-for-revert (buffer)
35 "Wait until the *Messages* buffer reports reversion of BUFFER."
36 (with-timeout (auto-revert--timeout nil)
37 (with-current-buffer "*Messages*"
38 (while
39 (null (string-match
40 (format-message "Reverting buffer `%s'." (buffer-name buffer))
41 (buffer-string)))
42 (read-event nil nil 0.1)))))
32 43
33(ert-deftest auto-revert-test00-auto-revert-mode () 44(ert-deftest auto-revert-test00-auto-revert-mode ()
34 "Check autorevert for a file." 45 "Check autorevert for a file."
@@ -57,13 +68,7 @@
57 (write-region "another text" nil tmpfile nil 'no-message) 68 (write-region "another text" nil tmpfile nil 'no-message)
58 69
59 ;; Check, that the buffer has been reverted. 70 ;; Check, that the buffer has been reverted.
60 (with-timeout (auto-revert--timeout nil) 71 (auto-revert--wait-for-revert buf)
61 (with-current-buffer "*Messages*"
62 (while
63 (null (string-match
64 (format "Reverting buffer `%s'." (buffer-name buf))
65 (buffer-string)))
66 (read-event nil nil 0.1))))
67 (should (string-match "another text" (buffer-string))) 72 (should (string-match "another text" (buffer-string)))
68 73
69 ;; When the buffer is modified, it shall not be reverted. 74 ;; When the buffer is modified, it shall not be reverted.
@@ -73,14 +78,8 @@
73 (sleep-for 1) 78 (sleep-for 1)
74 (write-region "any text" nil tmpfile nil 'no-message) 79 (write-region "any text" nil tmpfile nil 'no-message)
75 80
76 ;; Check, whether the buffer has been reverted. 81 ;; Check, that the buffer hasn't been reverted.
77 (with-timeout (auto-revert--timeout nil) 82 (auto-revert--wait-for-revert buf)
78 (with-current-buffer "*Messages*"
79 (while
80 (null (string-match
81 (format "Reverting buffer `%s'." (buffer-name buf))
82 (buffer-string)))
83 (read-event nil nil 0.1))))
84 (should-not (string-match "any text" (buffer-string))))) 83 (should-not (string-match "any text" (buffer-string)))))
85 84
86 ;; Exit. 85 ;; Exit.
@@ -119,13 +118,7 @@
119 (write-region "another text" nil tmpfile 'append 'no-message) 118 (write-region "another text" nil tmpfile 'append 'no-message)
120 119
121 ;; Check, that the buffer has been reverted. 120 ;; Check, that the buffer has been reverted.
122 (with-timeout (auto-revert--timeout nil) 121 (auto-revert--wait-for-revert buf)
123 (with-current-buffer "*Messages*"
124 (while
125 (null (string-match
126 (format "Reverting buffer `%s'." (buffer-name buf))
127 (buffer-string)))
128 (read-event nil nil 0.1))))
129 (should 122 (should
130 (string-match "modified text\nanother text" (buffer-string))))) 123 (string-match "modified text\nanother text" (buffer-string)))))
131 124
@@ -162,16 +155,9 @@
162 (delete-file tmpfile) 155 (delete-file tmpfile)
163 156
164 ;; Check, that the buffer has been reverted. 157 ;; Check, that the buffer has been reverted.
165 (with-timeout (auto-revert--timeout nil) 158 (auto-revert--wait-for-revert buf)
166 (with-current-buffer "*Messages*" 159 (should-not
167 (while 160 (string-match name (substring-no-properties (buffer-string))))
168 (null (string-match
169 (format "Reverting buffer `%s'." (buffer-name buf))
170 (buffer-string)))
171 (read-event nil nil 0.1))))
172 (should
173 (null
174 (string-match name (substring-no-properties (buffer-string)))))
175 161
176 ;; Make dired buffer modified. Check, that the buffer has 162 ;; Make dired buffer modified. Check, that the buffer has
177 ;; been still reverted. 163 ;; been still reverted.
@@ -181,14 +167,8 @@
181 (sleep-for 1) 167 (sleep-for 1)
182 (write-region "any text" nil tmpfile nil 'no-message) 168 (write-region "any text" nil tmpfile nil 'no-message)
183 169
184 ;; Check, that the buffer hasn't been reverted. 170 ;; Check, that the buffer has been reverted.
185 (with-timeout (auto-revert--timeout nil) 171 (auto-revert--wait-for-revert buf)
186 (with-current-buffer "*Messages*"
187 (while
188 (null (string-match
189 (format "Reverting buffer `%s'." (buffer-name buf))
190 (buffer-string)))
191 (read-event nil nil 0.1))))
192 (should 172 (should
193 (string-match name (substring-no-properties (buffer-string)))))) 173 (string-match name (substring-no-properties (buffer-string))))))
194 174
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 @@
228 ("1>test_main.cpp(29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int" 228 ("1>test_main.cpp(29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int"
229 3 nil 29 "test_main.cpp") 229 3 nil 29 "test_main.cpp")
230 ;; watcom 230 ;; watcom
231 ("..\src\ctrl\lister.c(109): Error! E1009: Expecting ';' but found '{'" 231 ("..\\src\\ctrl\\lister.c(109): Error! E1009: Expecting ';' but found '{'"
232 1 nil 109 "..\src\ctrl\lister.c") 232 1 nil 109 "..\\src\\ctrl\\lister.c")
233 ("..\src\ctrl\lister.c(120): Warning! W201: Unreachable code" 233 ("..\\src\\ctrl\\lister.c(120): Warning! W201: Unreachable code"
234 1 nil 120 "..\src\ctrl\lister.c") 234 1 nil 120 "..\\src\\ctrl\\lister.c")
235 ;; oracle 235 ;; oracle
236 ("Semantic error at line 528, column 5, file erosacqdb.pc:" 236 ("Semantic error at line 528, column 5, file erosacqdb.pc:"
237 1 5 528 "erosacqdb.pc") 237 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)."
258(cl-defstruct (xref-elisp-root-type) 258(cl-defstruct (xref-elisp-root-type)
259 slot-1) 259 slot-1)
260 260
261(cl-defgeneric xref-elisp-generic-no-methods () 261(cl-defgeneric xref-elisp-generic-no-methods (arg1 arg2)
262 "doc string generic no-methods" 262 "doc string generic no-methods"
263 ;; No default implementation, no methods, but fboundp is true for 263 ;; No default implementation, no methods, but fboundp is true for
264 ;; this symbol; it calls cl-no-applicable-method 264 ;; this symbol; it calls cl-no-applicable-method
@@ -269,44 +269,44 @@ to (xref-elisp-test-descr-to-target xref)."
269;; causes the batch mode test to fail; the symbol shows up as 269;; causes the batch mode test to fail; the symbol shows up as
270;; ‘this’. It passes in interactive tests, so I haven't been able to 270;; ‘this’. It passes in interactive tests, so I haven't been able to
271;; track down the problem. 271;; track down the problem.
272(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type)) 272(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2)
273 "doc string generic no-default xref-elisp-root-type" 273 "doc string generic no-default xref-elisp-root-type"
274 "non-default for no-default") 274 "non-default for no-default")
275 275
276;; defgeneric after defmethod in file to ensure the fallback search 276;; defgeneric after defmethod in file to ensure the fallback search
277;; method of just looking for the function name will fail. 277;; method of just looking for the function name will fail.
278(cl-defgeneric xref-elisp-generic-no-default () 278(cl-defgeneric xref-elisp-generic-no-default (arg1 arg2)
279 "doc string generic no-default generic" 279 "doc string generic no-default generic"
280 ;; No default implementation; this function calls the cl-generic 280 ;; No default implementation; this function calls the cl-generic
281 ;; dispatching code. 281 ;; dispatching code.
282 ) 282 )
283 283
284(cl-defgeneric xref-elisp-generic-co-located-default () 284(cl-defgeneric xref-elisp-generic-co-located-default (arg1 arg2)
285 "doc string generic co-located-default" 285 "doc string generic co-located-default"
286 "co-located default") 286 "co-located default")
287 287
288(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type)) 288(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2)
289 "doc string generic co-located-default xref-elisp-root-type" 289 "doc string generic co-located-default xref-elisp-root-type"
290 "non-default for co-located-default") 290 "non-default for co-located-default")
291 291
292(cl-defgeneric xref-elisp-generic-separate-default () 292(cl-defgeneric xref-elisp-generic-separate-default (arg1 arg2)
293 "doc string generic separate-default" 293 "doc string generic separate-default"
294 ;; default implementation provided separately 294 ;; default implementation provided separately
295 ) 295 )
296 296
297(cl-defmethod xref-elisp-generic-separate-default () 297(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2)
298 "doc string generic separate-default default" 298 "doc string generic separate-default default"
299 "separate default") 299 "separate default")
300 300
301(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type)) 301(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2)
302 "doc string generic separate-default xref-elisp-root-type" 302 "doc string generic separate-default xref-elisp-root-type"
303 "non-default for separate-default") 303 "non-default for separate-default")
304 304
305(cl-defmethod xref-elisp-generic-implicit-generic () 305(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2)
306 "doc string generic implicit-generic default" 306 "doc string generic implicit-generic default"
307 "default for implicit generic") 307 "default for implicit generic")
308 308
309(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type)) 309(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2)
310 "doc string generic implicit-generic xref-elisp-root-type" 310 "doc string generic implicit-generic xref-elisp-root-type"
311 "non-default for implicit generic") 311 "non-default for implicit generic")
312 312
@@ -327,9 +327,9 @@ to (xref-elisp-test-descr-to-target xref)."
327 (xref-make-elisp-location 327 (xref-make-elisp-location
328 'xref-elisp-generic-no-default 'cl-defgeneric 328 'xref-elisp-generic-no-default 'cl-defgeneric
329 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 329 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
330 (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type)))" 330 (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2))"
331 (xref-make-elisp-location 331 (xref-make-elisp-location
332 '(xref-elisp-generic-no-default xref-elisp-root-type) 'cl-defmethod 332 '(xref-elisp-generic-no-default xref-elisp-root-type t) 'cl-defmethod
333 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 333 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
334 )) 334 ))
335 335
@@ -340,9 +340,9 @@ to (xref-elisp-test-descr-to-target xref)."
340 (xref-make-elisp-location 340 (xref-make-elisp-location
341 'xref-elisp-generic-co-located-default 'cl-defgeneric 341 'xref-elisp-generic-co-located-default 'cl-defgeneric
342 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 342 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
343 (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type)))" 343 (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2))"
344 (xref-make-elisp-location 344 (xref-make-elisp-location
345 '(xref-elisp-generic-co-located-default xref-elisp-root-type) 'cl-defmethod 345 '(xref-elisp-generic-co-located-default xref-elisp-root-type t) 'cl-defmethod
346 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 346 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
347 )) 347 ))
348 348
@@ -353,26 +353,26 @@ to (xref-elisp-test-descr-to-target xref)."
353 (xref-make-elisp-location 353 (xref-make-elisp-location
354 'xref-elisp-generic-separate-default 'cl-defgeneric 354 'xref-elisp-generic-separate-default 'cl-defgeneric
355 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 355 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
356 (xref-make "(cl-defmethod xref-elisp-generic-separate-default ())" 356 (xref-make "(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2))"
357 (xref-make-elisp-location 357 (xref-make-elisp-location
358 '(xref-elisp-generic-separate-default) 'cl-defmethod 358 '(xref-elisp-generic-separate-default t t) 'cl-defmethod
359 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 359 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
360 (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type)))" 360 (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2))"
361 (xref-make-elisp-location 361 (xref-make-elisp-location
362 '(xref-elisp-generic-separate-default xref-elisp-root-type) 'cl-defmethod 362 '(xref-elisp-generic-separate-default xref-elisp-root-type t) 'cl-defmethod
363 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 363 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
364 )) 364 ))
365 365
366(xref-elisp-deftest find-defs-defgeneric-implicit-generic 366(xref-elisp-deftest find-defs-defgeneric-implicit-generic
367 (elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic) 367 (elisp--xref-find-definitions 'xref-elisp-generic-implicit-generic)
368 (list 368 (list
369 (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ())" 369 (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2))"
370 (xref-make-elisp-location 370 (xref-make-elisp-location
371 '(xref-elisp-generic-implicit-generic) 'cl-defmethod 371 '(xref-elisp-generic-implicit-generic t t) 'cl-defmethod
372 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 372 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
373 (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type)))" 373 (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2))"
374 (xref-make-elisp-location 374 (xref-make-elisp-location
375 '(xref-elisp-generic-implicit-generic xref-elisp-root-type) 'cl-defmethod 375 '(xref-elisp-generic-implicit-generic xref-elisp-root-type t) 'cl-defmethod
376 (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) 376 (expand-file-name "elisp-mode-tests.el" emacs-test-dir)))
377 )) 377 ))
378 378
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 @@
224 "This test attempts to demonstrate that there is no way to 224 "This test attempts to demonstrate that there is no way to
225force immediate truncation of the *Messages* buffer from Lisp 225force immediate truncation of the *Messages* buffer from Lisp
226\(and hence justifies the existence of 226\(and hence justifies the existence of
227`ert--force-message-log-buffer-truncation'\): The only way that 227`ert--force-message-log-buffer-truncation'): The only way that
228came to my mind was \(message \"\"\), which doesn't have the 228came to my mind was \(message \"\"), which doesn't have the
229desired effect." 229desired effect."
230 :tags '(:causes-redisplay) 230 :tags '(:causes-redisplay)
231 (ert-with-buffer-renamed ("*Messages*") 231 (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 @@
1;;; file-notify-tests.el --- Tests of file notifications 1;;; file-notify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2013-2015 Free Software Foundation, Inc. 3;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
4 4
@@ -60,6 +60,35 @@
60(defvar file-notify--test-desc nil) 60(defvar file-notify--test-desc nil)
61(defvar file-notify--test-results nil) 61(defvar file-notify--test-results nil)
62(defvar file-notify--test-event nil) 62(defvar file-notify--test-event nil)
63(defvar file-notify--test-events nil)
64(defun file-notify--test-timeout ()
65 (if (file-remote-p temporary-file-directory) 6 3))
66
67(defun file-notify--test-cleanup ()
68 "Cleanup after a test."
69 (file-notify-rm-watch file-notify--test-desc)
70
71 (when (and file-notify--test-tmpfile
72 (file-exists-p file-notify--test-tmpfile))
73 (if (directory-name-p file-notify--test-tmpfile)
74 (delete-directory file-notify--test-tmpfile 'recursive)
75 (delete-file file-notify--test-tmpfile)))
76 (when (and file-notify--test-tmpfile1
77 (file-exists-p file-notify--test-tmpfile1))
78 (if (directory-name-p file-notify--test-tmpfile1)
79 (delete-directory file-notify--test-tmpfile1 'recursive)
80 (delete-file file-notify--test-tmpfile1)))
81 (when (file-remote-p temporary-file-directory)
82 (tramp-cleanup-connection
83 (tramp-dissect-file-name temporary-file-directory) nil 'keep-password))
84
85 (setq file-notify--test-tmpfile nil)
86 (setq file-notify--test-tmpfile1 nil)
87 (setq file-notify--test-desc nil)
88 (setq file-notify--test-results nil)
89 (setq file-notify--test-events nil)
90 (when file-notify--test-event
91 (error "file-notify--test-event should not be set but bound dynamically")))
63 92
64(setq password-cache-expiry nil 93(setq password-cache-expiry nil
65 tramp-verbose 0 94 tramp-verbose 0
@@ -116,10 +145,19 @@ being the result.")
116(ert-deftest file-notify-test00-availability () 145(ert-deftest file-notify-test00-availability ()
117 "Test availability of `file-notify'." 146 "Test availability of `file-notify'."
118 (skip-unless (file-notify--test-local-enabled)) 147 (skip-unless (file-notify--test-local-enabled))
148 ;; Report the native library which has been used.
149 (if (null (file-remote-p temporary-file-directory))
150 (message "Local library: `%s'" file-notify--library)
151 (message "Remote command: `%s'"
152 (replace-regexp-in-string
153 "<[[:digit:]]+>\\'" ""
154 (process-name (cdr file-notify--test-remote-enabled-checked)))))
119 (should 155 (should
120 (setq file-notify--test-desc 156 (setq file-notify--test-desc
121 (file-notify-add-watch temporary-file-directory '(change) 'ignore))) 157 (file-notify-add-watch temporary-file-directory '(change) 'ignore)))
122 (file-notify-rm-watch file-notify--test-desc)) 158
159 ;; Cleanup.
160 (file-notify--test-cleanup))
123 161
124(file-notify--deftest-remote file-notify-test00-availability 162(file-notify--deftest-remote file-notify-test00-availability
125 "Test availability of `file-notify' for remote files.") 163 "Test availability of `file-notify' for remote files.")
@@ -157,7 +195,10 @@ being the result.")
157 (should 195 (should
158 (equal (should-error 196 (equal (should-error
159 (file-notify-add-watch temporary-file-directory '(change) 3)) 197 (file-notify-add-watch temporary-file-directory '(change) 3))
160 '(wrong-type-argument 3)))) 198 '(wrong-type-argument 3)))
199
200 ;; Cleanup.
201 (file-notify--test-cleanup))
161 202
162(file-notify--deftest-remote file-notify-test01-add-watch 203(file-notify--deftest-remote file-notify-test01-add-watch
163 "Check `file-notify-add-watch' for remote files.") 204 "Check `file-notify-add-watch' for remote files.")
@@ -166,7 +207,7 @@ being the result.")
166 "Ert test function to be called by `file-notify--test-event-handler'. 207 "Ert test function to be called by `file-notify--test-event-handler'.
167We cannot pass arguments, so we assume that `file-notify--test-event' 208We cannot pass arguments, so we assume that `file-notify--test-event'
168is bound somewhere." 209is bound somewhere."
169 ;(message "Event %S" file-notify--test-event) 210 ;;(message "Event %S" file-notify--test-event)
170 ;; Check the descriptor. 211 ;; Check the descriptor.
171 (should (equal (car file-notify--test-event) file-notify--test-desc)) 212 (should (equal (car file-notify--test-event) file-notify--test-desc))
172 ;; Check the file name. 213 ;; Check the file name.
@@ -180,11 +221,15 @@ is bound somewhere."
180 (file-notify--event-file1-name file-notify--test-event) 221 (file-notify--event-file1-name file-notify--test-event)
181 file-notify--test-tmpfile1)))) 222 file-notify--test-tmpfile1))))
182 223
183(defun file-notify--test-event-handler (file-notify--test-event) 224(defun file-notify--test-event-handler (event)
184 "Run a test over FILE-NOTIFY--TEST-EVENT. 225 "Run a test over FILE-NOTIFY--TEST-EVENT.
185Save the result in `file-notify--test-results', for later analysis." 226For later analysis, append the test result to `file-notify--test-results'
186 (let ((result 227and the event to `file-notify--test-events'."
187 (ert-run-test (make-ert-test :body 'file-notify--test-event-test)))) 228 (let* ((file-notify--test-event event)
229 (result
230 (ert-run-test (make-ert-test :body 'file-notify--test-event-test))))
231 (setq file-notify--test-events
232 (append file-notify--test-events `(,file-notify--test-event)))
188 (setq file-notify--test-results 233 (setq file-notify--test-results
189 (append file-notify--test-results `(,result))))) 234 (append file-notify--test-results `(,result)))))
190 235
@@ -194,60 +239,123 @@ Save the result in `file-notify--test-results', for later analysis."
194 (make-temp-name "file-notify-test") temporary-file-directory)) 239 (make-temp-name "file-notify-test") temporary-file-directory))
195 240
196(defmacro file-notify--wait-for-events (timeout until) 241(defmacro file-notify--wait-for-events (timeout until)
197 "Wait for file notification events until form UNTIL is true. 242 "Wait for and return file notification events until form UNTIL is true.
198TIMEOUT is the maximum time to wait for, in seconds." 243TIMEOUT is the maximum time to wait for, in seconds."
199 `(with-timeout (,timeout (ignore)) 244 `(with-timeout (,timeout (ignore))
200 (while (null ,until) 245 (while (null ,until)
201 (read-event nil nil 0.1)))) 246 (read-event nil nil 0.1))))
202 247
248(defmacro file-notify--test-with-events (timeout events &rest body)
249 "Run BODY collecting events and then compare with EVENTS.
250Don't wait longer than TIMEOUT seconds for the events to be delivered."
251 (declare (indent 2))
252 (let ((outer (make-symbol "outer")))
253 `(let ((,outer file-notify--test-events))
254 (let (file-notify--test-events)
255 ,@body
256 (file-notify--wait-for-events
257 ,timeout (= (length ,events) (length file-notify--test-events)))
258 (should (equal ,events (mapcar #'cadr file-notify--test-events)))
259 (setq ,outer (append ,outer file-notify--test-events)))
260 (setq file-notify--test-events ,outer))))
261
203(ert-deftest file-notify-test02-events () 262(ert-deftest file-notify-test02-events ()
204 "Check file creation/removal notifications." 263 "Check file creation/change/removal notifications."
205 (skip-unless (file-notify--test-local-enabled)) 264 (skip-unless (file-notify--test-local-enabled))
206 (unwind-protect 265 (unwind-protect
207 (progn 266 (progn
208 (setq file-notify--test-results nil 267 ;; Check creation, change, and deletion.
209 file-notify--test-tmpfile (file-notify--test-make-temp-name) 268 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
210 file-notify--test-tmpfile1 (file-notify--test-make-temp-name) 269 file-notify--test-tmpfile1 (file-notify--test-make-temp-name)
211 file-notify--test-desc 270 file-notify--test-desc
212 (file-notify-add-watch 271 (file-notify-add-watch
213 file-notify--test-tmpfile 272 file-notify--test-tmpfile
214 '(change) 'file-notify--test-event-handler)) 273 '(change) 'file-notify--test-event-handler))
274 (file-notify--test-with-events
275 (file-notify--test-timeout) '(created changed deleted)
276 (write-region
277 "any text" nil file-notify--test-tmpfile nil 'no-message)
278 (delete-file file-notify--test-tmpfile))
279 (file-notify-rm-watch file-notify--test-desc)
280
281 ;; Check copy.
282 (setq file-notify--test-desc
283 (file-notify-add-watch
284 file-notify--test-tmpfile
285 '(change) 'file-notify--test-event-handler))
215 (should file-notify--test-desc) 286 (should file-notify--test-desc)
216 287 (file-notify--test-with-events
217 ;; Check creation and removal. 288 (file-notify--test-timeout)
218 (write-region 289 ;; w32notify does not distinguish between `changed' and
219 "any text" nil file-notify--test-tmpfile nil 'no-message) 290 ;; `attribute-changed'.
220 (delete-file file-notify--test-tmpfile) 291 (if (eq file-notify--library 'w32notify)
221 (sleep-for 0.1) 292 '(created changed changed deleted)
222 293 '(created changed deleted))
223 ;; Check copy and rename. 294 (write-region
224 (write-region 295 "any text" nil file-notify--test-tmpfile nil 'no-message)
225 "any text" nil file-notify--test-tmpfile nil 'no-message) 296 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
226 (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) 297 ;; The next two events shall not be visible.
227 (delete-file file-notify--test-tmpfile) 298 (set-file-modes file-notify--test-tmpfile 000)
228 (delete-file file-notify--test-tmpfile1) 299 (read-event nil nil 0.1) ; In order to distinguish the events.
229 (sleep-for 0.1) 300 (set-file-times file-notify--test-tmpfile '(0 0))
230 301 (delete-file file-notify--test-tmpfile)
231 (write-region 302 (delete-file file-notify--test-tmpfile1))
232 "any text" nil file-notify--test-tmpfile nil 'no-message) 303 (file-notify-rm-watch file-notify--test-desc)
233 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) 304
234 (delete-file file-notify--test-tmpfile1) 305 ;; Check rename.
235 (sleep-for 0.1)) 306 (setq file-notify--test-desc
236 307 (file-notify-add-watch
237 ;; Wait for events, and exit. 308 file-notify--test-tmpfile
238 (file-notify--wait-for-events 5 file-notify--test-results) 309 '(change) 'file-notify--test-event-handler))
239 (file-notify-rm-watch file-notify--test-desc) 310 (should file-notify--test-desc)
240 (ignore-errors (delete-file file-notify--test-tmpfile)) 311 (file-notify--test-with-events
241 (ignore-errors (delete-file file-notify--test-tmpfile1))) 312 (file-notify--test-timeout) '(created changed renamed)
242 313 (write-region
243 (should file-notify--test-results) 314 "any text" nil file-notify--test-tmpfile nil 'no-message)
244 (dolist (result file-notify--test-results) 315 (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
245 ;(message "%s" (ert-test-result-messages result)) 316 ;; After the rename, we won't get events anymore.
246 (when (ert-test-failed-p result) 317 (delete-file file-notify--test-tmpfile1))
247 (ert-fail (cadr (ert-test-result-with-condition-condition result)))))) 318 (file-notify-rm-watch file-notify--test-desc)
319
320 ;; Check attribute change. It doesn't work for w32notify.
321 (unless (eq file-notify--library 'w32notify)
322 (setq file-notify--test-desc
323 (file-notify-add-watch
324 file-notify--test-tmpfile
325 '(attribute-change) 'file-notify--test-event-handler))
326 (file-notify--test-with-events
327 (file-notify--test-timeout) '(attribute-changed attribute-changed)
328 (write-region
329 "any text" nil file-notify--test-tmpfile nil 'no-message)
330 (set-file-modes file-notify--test-tmpfile 000)
331 (read-event nil nil 0.1) ; In order to distinguish the events.
332 (set-file-times file-notify--test-tmpfile '(0 0))
333 (delete-file file-notify--test-tmpfile))
334 (file-notify-rm-watch file-notify--test-desc))
335
336 ;; Check the global sequence again just to make sure that
337 ;; `file-notify--test-events' has been set correctly.
338 (should (equal (mapcar #'cadr file-notify--test-events)
339 (if (eq file-notify--library 'w32notify)
340 '(created changed deleted
341 created changed changed deleted
342 created changed renamed)
343 '(created changed deleted
344 created changed deleted
345 created changed renamed
346 attribute-changed attribute-changed))))
347 (should file-notify--test-results)
348 (dolist (result file-notify--test-results)
349 ;;(message "%s" (ert-test-result-messages result))
350 (when (ert-test-failed-p result)
351 (ert-fail
352 (cadr (ert-test-result-with-condition-condition result))))))
353
354 ;; Cleanup.
355 (file-notify--test-cleanup)))
248 356
249(file-notify--deftest-remote file-notify-test02-events 357(file-notify--deftest-remote file-notify-test02-events
250 "Check file creation/removal notifications for remote files.") 358 "Check file creation/change/removal notifications for remote files.")
251 359
252(require 'autorevert) 360(require 'autorevert)
253(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" 361(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."
255 auto-revert-stop-on-user-input nil) 363 auto-revert-stop-on-user-input nil)
256 364
257(ert-deftest file-notify-test03-autorevert () 365(ert-deftest file-notify-test03-autorevert ()
258 "Check autorevert via file notification. 366 "Check autorevert via file notification."
259This test is skipped in batch mode."
260 (skip-unless (file-notify--test-local-enabled)) 367 (skip-unless (file-notify--test-local-enabled))
261 ;; `auto-revert-buffers' runs every 5". And we must wait, until the 368 ;; `auto-revert-buffers' runs every 5". And we must wait, until the
262 ;; file has been reverted. 369 ;; file has been reverted.
@@ -297,17 +404,121 @@ This test is skipped in batch mode."
297 (with-current-buffer (get-buffer-create "*Messages*") 404 (with-current-buffer (get-buffer-create "*Messages*")
298 (file-notify--wait-for-events 405 (file-notify--wait-for-events
299 timeout 406 timeout
300 (string-match (format "Reverting buffer `%s'." (buffer-name buf)) 407 (string-match
301 (buffer-string)))) 408 (format-message "Reverting buffer `%s'." (buffer-name buf))
409 (buffer-string))))
302 (should (string-match "another text" (buffer-string))))) 410 (should (string-match "another text" (buffer-string)))))
303 411
304 ;; Exit. 412 ;; Cleanup.
305 (ignore-errors (kill-buffer buf)) 413 (ignore-errors (kill-buffer buf))
306 (ignore-errors (delete-file file-notify--test-tmpfile))))) 414 (file-notify--test-cleanup))))
307 415
308(file-notify--deftest-remote file-notify-test03-autorevert 416(file-notify--deftest-remote file-notify-test03-autorevert
309 "Check autorevert via file notification for remote files. 417 "Check autorevert via file notification for remote files.")
310This test is skipped in batch mode.") 418
419(ert-deftest file-notify-test04-file-validity ()
420 "Check `file-notify-valid-p' for files."
421 (skip-unless (file-notify--test-local-enabled))
422
423 (unwind-protect
424 (progn
425 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
426 (setq file-notify--test-desc
427 (file-notify-add-watch
428 file-notify--test-tmpfile
429 '(change) #'file-notify--test-event-handler))
430 (file-notify--test-with-events
431 (file-notify--test-timeout) '(created changed)
432 (should (file-notify-valid-p file-notify--test-desc))
433 (write-region
434 "any text" nil file-notify--test-tmpfile nil 'no-message)
435 (should (file-notify-valid-p file-notify--test-desc)))
436 ;; After removing the watch, the descriptor must not be valid
437 ;; anymore.
438 (file-notify-rm-watch file-notify--test-desc)
439 (should-not (file-notify-valid-p file-notify--test-desc)))
440
441 ;; Cleanup.
442 (file-notify--test-cleanup))
443
444 (unwind-protect
445 ;; The batch-mode operation of w32notify is fragile (there's no
446 ;; input threads to send the message to).
447 (unless (and noninteractive (eq file-notify--library 'w32notify))
448 (let ((temporary-file-directory (make-temp-file
449 "file-notify-test-parent" t)))
450 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
451 (setq file-notify--test-desc
452 (file-notify-add-watch
453 file-notify--test-tmpfile
454 '(change) #'file-notify--test-event-handler))
455 (file-notify--test-with-events
456 (file-notify--test-timeout) '(created changed)
457 (should (file-notify-valid-p file-notify--test-desc))
458 (write-region
459 "any text" nil file-notify--test-tmpfile nil 'no-message)
460 (should (file-notify-valid-p file-notify--test-desc)))
461 ;; After deleting the parent, the descriptor must not be valid
462 ;; anymore.
463 (delete-directory temporary-file-directory t)
464 (file-notify--wait-for-events
465 (file-notify--test-timeout)
466 (not (file-notify-valid-p file-notify--test-desc)))
467 (should-not (file-notify-valid-p file-notify--test-desc))))
468
469 ;; Cleanup.
470 (file-notify--test-cleanup)))
471
472(file-notify--deftest-remote file-notify-test04-file-validity
473 "Check `file-notify-valid-p' via file notification for remote files.")
474
475(ert-deftest file-notify-test05-dir-validity ()
476 "Check `file-notify-valid-p' for directories."
477 (skip-unless (file-notify--test-local-enabled))
478
479 (unwind-protect
480 (progn
481 (setq file-notify--test-tmpfile (file-name-as-directory
482 (file-notify--test-make-temp-name)))
483 (make-directory file-notify--test-tmpfile)
484 (setq file-notify--test-desc
485 (file-notify-add-watch
486 file-notify--test-tmpfile
487 '(change) #'file-notify--test-event-handler))
488 (should (file-notify-valid-p file-notify--test-desc))
489 ;; After removing the watch, the descriptor must not be valid
490 ;; anymore.
491 (file-notify-rm-watch file-notify--test-desc)
492 (should-not (file-notify-valid-p file-notify--test-desc)))
493
494 ;; Cleanup.
495 (file-notify--test-cleanup))
496
497 (unwind-protect
498 ;; The batch-mode operation of w32notify is fragile (there's no
499 ;; input threads to send the message to).
500 (unless (and noninteractive (eq file-notify--library 'w32notify))
501 (setq file-notify--test-tmpfile (file-name-as-directory
502 (file-notify--test-make-temp-name)))
503 (make-directory file-notify--test-tmpfile)
504 (setq file-notify--test-desc
505 (file-notify-add-watch
506 file-notify--test-tmpfile
507 '(change) #'file-notify--test-event-handler))
508 (should (file-notify-valid-p file-notify--test-desc))
509 ;; After deleting the directory, the descriptor must not be
510 ;; valid anymore.
511 (delete-directory file-notify--test-tmpfile t)
512 (file-notify--wait-for-events
513 (file-notify--test-timeout)
514 (not (file-notify-valid-p file-notify--test-desc)))
515 (should-not (file-notify-valid-p file-notify--test-desc)))
516
517 ;; Cleanup.
518 (file-notify--test-cleanup)))
519
520(file-notify--deftest-remote file-notify-test05-dir-validity
521 "Check `file-notify-valid-p' via file notification for remote directories.")
311 522
312(defun file-notify-test-all (&optional interactive) 523(defun file-notify-test-all (&optional interactive)
313 "Run all tests for \\[file-notify]." 524 "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
213 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" 213 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
214 (cdr result))) 214 (cdr result)))
215 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE 215 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
216TZID:anothername\, with a comma 216TZID:anothername, with a comma
217BEGIN:STANDARD 217BEGIN:STANDARD
218DTSTART:16010101T040000 218DTSTART:16010101T040000
219TZOFFSETFROM:+0300 219TZOFFSETFROM:+0300
@@ -235,7 +235,7 @@ END:VTIMEZONE
235 (cdr result))) 235 (cdr result)))
236 ;; offsetfrom = offsetto 236 ;; offsetfrom = offsetto
237 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE 237 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
238TZID:Kolkata\, Chennai\, Mumbai\, New Delhi 238TZID:Kolkata, Chennai, Mumbai, New Delhi
239X-MICROSOFT-CDO-TZID:23 239X-MICROSOFT-CDO-TZID:23
240BEGIN:STANDARD 240BEGIN:STANDARD
241DTSTART:16010101T000000 241DTSTART:16010101T000000
@@ -1327,7 +1327,7 @@ DTEND;VALUE=DATE-TIME:20030919T113000"
1327 (icalendar-tests--test-import 1327 (icalendar-tests--test-import
1328 "BEGIN:VCALENDAR 1328 "BEGIN:VCALENDAR
1329BEGIN:VTIMEZONE 1329BEGIN:VTIMEZONE
1330TZID:fictional\, nonexistent\, arbitrary 1330TZID:fictional, nonexistent, arbitrary
1331BEGIN:STANDARD 1331BEGIN:STANDARD
1332DTSTART:20100101T000000 1332DTSTART:20100101T000000
1333TZOFFSETFROM:+0200 1333TZOFFSETFROM:+0200
@@ -1463,7 +1463,7 @@ METHOD:REQUEST
1463PRODID:Microsoft CDO for Microsoft Exchange 1463PRODID:Microsoft CDO for Microsoft Exchange
1464VERSION:2.0 1464VERSION:2.0
1465BEGIN:VTIMEZONE 1465BEGIN:VTIMEZONE
1466TZID:Kolkata\, Chennai\, Mumbai\, New Delhi 1466TZID:Kolkata, Chennai, Mumbai, New Delhi
1467X-MICROSOFT-CDO-TZID:23 1467X-MICROSOFT-CDO-TZID:23
1468BEGIN:STANDARD 1468BEGIN:STANDARD
1469DTSTART:16010101T000000 1469DTSTART:16010101T000000
@@ -2174,7 +2174,7 @@ METHOD:REQUEST
2174PRODID:Microsoft Exchange Server 2007 2174PRODID:Microsoft Exchange Server 2007
2175VERSION:2.0 2175VERSION:2.0
2176BEGIN:VTIMEZONE 2176BEGIN:VTIMEZONE
2177TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna 2177TZID:(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
2178BEGIN:STANDARD 2178BEGIN:STANDARD
2179DTSTART:16010101T030000 2179DTSTART:16010101T030000
2180TZOFFSETFROM:+0200 2180TZOFFSETFROM:+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)."
64 "Write BODY to texi FILE." 64 "Write BODY to texi FILE."
65 (with-temp-buffer 65 (with-temp-buffer
66 (insert "\ 66 (insert "\
67\input texinfo 67\\input texinfo
68@setfilename " 68@setfilename "
69 (format "%s.info\n" (file-name-sans-extension file)) 69 (format "%s.info\n" (file-name-sans-extension file))
70 "\ 70 "\
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.
138 (should-not (seq-some #'test-sequences-oddp seq))) 138 (should-not (seq-some #'test-sequences-oddp seq)))
139 (should (seq-some #'null '(1 nil 2)))) 139 (should (seq-some #'null '(1 nil 2))))
140 140
141(ert-deftest test-seq-find ()
142 (with-test-sequences (seq '(4 3 2 1))
143 (should (= 4 (seq-find #'test-sequences-evenp seq)))
144 (should (= 3 (seq-find #'test-sequences-oddp seq)))
145 (should-not (seq-find (lambda (elt) (> elt 10)) seq)))
146 (should-not (seq-find #'null '(1 nil 2)))
147 (should-not (seq-find #'null '(1 nil 2) t))
148 (should-not (seq-find #'null '(1 2 3)))
149 (should (seq-find #'null '(1 2 3) 'sentinel)))
150
141(ert-deftest test-seq-contains () 151(ert-deftest test-seq-contains ()
142 (with-test-sequences (seq '(3 4 5 6)) 152 (with-test-sequences (seq '(3 4 5 6))
143 (should (seq-contains seq 3)) 153 (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."
1766 "No \\[tags-search] or \\[tags-query-replace] in progress")) 1766 "No \\[tags-search] or \\[tags-query-replace] in progress"))
1767 "Form for `tags-loop-continue' to eval to scan one file. 1767 "Form for `tags-loop-continue' to eval to scan one file.
1768If it returns non-nil, this file needs processing by evalling 1768If it returns non-nil, this file needs processing by evalling
1769\`tags-loop-operate'. Otherwise, move on to the next file.") 1769`tags-loop-operate'. Otherwise, move on to the next file.")
1770 1770
1771(defun tags-loop-eval (form) 1771(defun tags-loop-eval (form)
1772 "Evaluate FORM and return its result. 1772 "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 @@
1%% -*- mode: prolog; coding: utf-8; fill-column: 78 -*- 1%% -*- mode: prolog; coding: utf-8; fill-column: 78 -*-
2 2
3%% bug#21526
4test1 :-
5 ( a ->
6 ( a ->
7 b
8 ; c
9 )
10 ; c
11 ).
12
13test2 :-
14 ( a
15 -> ( a,
16 b
17 ; c
18 ),
19 b2
20 ; c1,
21 c2
22 )
23
3%% Testing correct tokenizing. 24%% Testing correct tokenizing.
4foo(X) :- 0'= = X. 25foo(X) :- 0'= = X.
5foo(X) :- 8'234 = X. 26foo(X) :- 8'234 = X.
@@ -50,9 +71,9 @@ subst(X, V, FV, lambda(Y, Ti, Bi), lambda(Y1, To, Bo)) :-
50 %% Perform substitution on the body. 71 %% Perform substitution on the body.
51 subst(X, V, FV, Bi1, Bo)), 72 subst(X, V, FV, Bi1, Bo)),
52 ( X = Y 73 ( X = Y
53 %% If X is equal to Y, X is shadowed, so no subst can take place. 74 %% If X is equal to Y, X is shadowed, so no subst can take place.
54 -> Y1 = Y, Bo = Bi 75 -> Y1 = Y, Bo = Bi
55 ; (member((Y, _), FV) 76 ; (member((Y, _), FV)
56 %% If Y appears in FV, it can appear in V, so we need to 77 %% If Y appears in FV, it can appear in V, so we need to
57 %% rename it to avoid name capture. 78 %% rename it to avoid name capture.
58 -> new_atom(Y, Y1), 79 -> new_atom(Y, Y1),