aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndrea Corallo2020-12-12 15:31:33 +0100
committerAndrea Corallo2020-12-12 15:31:33 +0100
commit0474fda62d79cb7eb250f34f19773c87f283c665 (patch)
treedf7418a6b22fbbfda725c56825ec0290f8e6be39 /test
parentbe907b0ba82c2a65e0468d50653cae8a7cf5f16b (diff)
parent4afef614cd6c93b4d4a57aa5bb211563649abc56 (diff)
downloademacs-0474fda62d79cb7eb250f34f19773c87f283c665.tar.gz
emacs-0474fda62d79cb7eb250f34f19773c87f283c665.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'test')
-rw-r--r--test/README3
-rw-r--r--test/lisp/abbrev-tests.el5
-rw-r--r--test/lisp/allout-tests.el6
-rw-r--r--test/lisp/emacs-lisp/edebug-tests.el5
-rw-r--r--test/lisp/emacs-lisp/ert-tests.el10
-rw-r--r--test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el4
-rw-r--r--test/lisp/emacs-lisp/gv-tests.el11
-rw-r--r--test/lisp/emacs-lisp/memory-report-tests.el57
-rw-r--r--test/lisp/epg-tests.el3
-rw-r--r--test/lisp/filenotify-tests.el80
-rw-r--r--test/lisp/net/rcirc-tests.el12
-rw-r--r--test/src/casefiddle-tests.el3
-rw-r--r--test/src/data-tests.el2
-rw-r--r--test/src/eval-tests.el17
-rw-r--r--test/src/fns-tests.el16
-rw-r--r--test/src/regex-emacs-tests.el64
16 files changed, 262 insertions, 36 deletions
diff --git a/test/README b/test/README
index d0da89d1c2c..3365f18cf7e 100644
--- a/test/README
+++ b/test/README
@@ -113,7 +113,8 @@ $EMACS_HYDRA_CI indicates the hydra environment, and $EMACS_EMBA_CI
113indicates the emba environment, respectively. 113indicates the emba environment, respectively.
114 114
115 115
116(Also, see etc/compilation.txt for compilation mode font lock tests.) 116(Also, see etc/compilation.txt for compilation mode font lock tests
117and etc/grep.txt for grep mode font lock tests.)
117 118
118 119
119This file is part of GNU Emacs. 120This file is part of GNU Emacs.
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index aaf1d4a5b5c..288ea1ae987 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -69,8 +69,9 @@
69 (define-abbrev ert-test-abbrevs "sys" "system abbrev" nil :system t) 69 (define-abbrev ert-test-abbrevs "sys" "system abbrev" nil :system t)
70 (should (equal (mapcar #'symbol-name (abbrev--table-symbols 'ert-test-abbrevs)) 70 (should (equal (mapcar #'symbol-name (abbrev--table-symbols 'ert-test-abbrevs))
71 '("a-e-t"))) 71 '("a-e-t")))
72 (should (equal (mapcar #'symbol-name (abbrev--table-symbols 'ert-test-abbrevs t)) 72 (let ((syms (abbrev--table-symbols 'ert-test-abbrevs t)))
73 '("a-e-t" "sys"))))) 73 (should (equal (sort (mapcar #'symbol-name syms) #'string<)
74 '("a-e-t" "sys"))))))
74 75
75(ert-deftest abbrev-table-get-put-test () 76(ert-deftest abbrev-table-get-put-test ()
76 (let ((table (make-abbrev-table))) 77 (let ((table (make-abbrev-table)))
diff --git a/test/lisp/allout-tests.el b/test/lisp/allout-tests.el
index f7cd6db9cd4..c979d085c89 100644
--- a/test/lisp/allout-tests.el
+++ b/test/lisp/allout-tests.el
@@ -74,7 +74,7 @@
74 "Ensure that prior local value is resumed." 74 "Ensure that prior local value is resumed."
75 (with-temp-buffer 75 (with-temp-buffer
76 (allout-tests-obliterate-variable 'allout-tests-locally-true) 76 (allout-tests-obliterate-variable 'allout-tests-locally-true)
77 (set (make-local-variable 'allout-tests-locally-true) t) 77 (setq-local allout-tests-locally-true t)
78 (cl-assert (not (default-boundp 'allout-tests-locally-true)) 78 (cl-assert (not (default-boundp 'allout-tests-locally-true))
79 nil (concat "Test setup mistake -- variable supposed to" 79 nil (concat "Test setup mistake -- variable supposed to"
80 " not have global binding, but it does.")) 80 " not have global binding, but it does."))
@@ -98,7 +98,7 @@
98 (allout-tests-obliterate-variable 'allout-tests-globally-true) 98 (allout-tests-obliterate-variable 'allout-tests-globally-true)
99 (setq allout-tests-globally-true t) 99 (setq allout-tests-globally-true t)
100 (allout-tests-obliterate-variable 'allout-tests-locally-true) 100 (allout-tests-obliterate-variable 'allout-tests-locally-true)
101 (set (make-local-variable 'allout-tests-locally-true) t) 101 (setq-local allout-tests-locally-true t)
102 (allout-add-resumptions '(allout-tests-globally-unbound t) 102 (allout-add-resumptions '(allout-tests-globally-unbound t)
103 '(allout-tests-globally-true nil) 103 '(allout-tests-globally-true nil)
104 '(allout-tests-locally-true nil)) 104 '(allout-tests-locally-true nil))
@@ -135,7 +135,7 @@
135 (allout-tests-obliterate-variable 'allout-tests-globally-true) 135 (allout-tests-obliterate-variable 'allout-tests-globally-true)
136 (setq allout-tests-globally-true t) 136 (setq allout-tests-globally-true t)
137 (allout-tests-obliterate-variable 'allout-tests-locally-true) 137 (allout-tests-obliterate-variable 'allout-tests-locally-true)
138 (set (make-local-variable 'allout-tests-locally-true) t) 138 (setq-local allout-tests-locally-true t)
139 (allout-add-resumptions '(allout-tests-globally-unbound t) 139 (allout-add-resumptions '(allout-tests-globally-unbound t)
140 '(allout-tests-globally-true nil) 140 '(allout-tests-globally-true nil)
141 '(allout-tests-locally-true nil)) 141 '(allout-tests-locally-true nil))
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el
index 8aae26a1aca..2c340c44408 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -97,7 +97,10 @@ back to the top level.")
97 97
98 ;; sit-on interferes with keyboard macros. 98 ;; sit-on interferes with keyboard macros.
99 (edebug-sit-on-break nil) 99 (edebug-sit-on-break nil)
100 (edebug-continue-kbd-macro t)) 100 (edebug-continue-kbd-macro t)
101
102 ;; don't print backtraces, otherwise error messages don't match
103 (backtrace-on-error-noninteractive nil))
101 ,@body)) 104 ,@body))
102 105
103(defmacro edebug-tests-with-normal-env (&rest body) 106(defmacro edebug-tests-with-normal-env (&rest body)
diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el
index 1f54c8d07e4..a0c56be0cb0 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -806,6 +806,16 @@ This macro is used to test if macroexpansion in `should' works."
806 :expected-result :failed ;; FIXME! Bug#11218 806 :expected-result :failed ;; FIXME! Bug#11218
807 (should-not (with-demoted-errors (error "Foo")))) 807 (should-not (with-demoted-errors (error "Foo"))))
808 808
809(ert-deftest ert-test-fail-inside-should ()
810 "Check that `ert-fail' inside `should' works correctly."
811 (let ((result (ert-run-test
812 (make-ert-test
813 :name 'test-1
814 :body (lambda () (should (integerp (ert-fail "Boo"))))))))
815 (should (ert-test-failed-p result))
816 (should (equal (ert-test-failed-condition result)
817 '(ert-test-failed ("Boo"))))))
818
809 819
810(provide 'ert-tests) 820(provide 'ert-tests)
811 821
diff --git a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
index c77f2dc4990..6e9d50fc38f 100644
--- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
+++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
@@ -67,8 +67,8 @@ If `prog-mode' is defined, inherit from it."
67 67
68(faceup-test-define-prog-mode faceup-test-mode "faceup-test" 68(faceup-test-define-prog-mode faceup-test-mode "faceup-test"
69 "Dummy major mode for testing `faceup', a test system for font-lock." 69 "Dummy major mode for testing `faceup', a test system for font-lock."
70 (set (make-local-variable 'syntax-propertize-function) 70 (setq-local syntax-propertize-function
71 #'faceup-test-syntax-propertize) 71 #'faceup-test-syntax-propertize)
72 (setq font-lock-defaults '(faceup-test-font-lock-keywords nil))) 72 (setq font-lock-defaults '(faceup-test-font-lock-keywords nil)))
73 73
74(provide 'faceup-test-mode) 74(provide 'faceup-test-mode)
diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el
index 29e4273b478..8fc6b514692 100644
--- a/test/lisp/emacs-lisp/gv-tests.el
+++ b/test/lisp/emacs-lisp/gv-tests.el
@@ -83,7 +83,10 @@
83 (with-temp-buffer 83 (with-temp-buffer
84 (call-process (concat invocation-directory invocation-name) 84 (call-process (concat invocation-directory invocation-name)
85 nil '(t t) nil 85 nil '(t t) nil
86 "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) 86 "-Q" "-batch"
87 "--eval" (prin1-to-string
88 `(let ((backtrace-on-error-noninteractive nil))
89 (byte-compile-file ,el)))
87 "-l" elc) 90 "-l" elc)
88 (should (equal (buffer-string) 91 (should (equal (buffer-string)
89 "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n"))))) 92 "Symbol's function definition is void: \\(setf\\ gv-test-foo\\)\n")))))
@@ -133,8 +136,10 @@
133 "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el)) 136 "-Q" "-batch" "--eval" (prin1-to-string `(byte-compile-file ,el))
134 "-l" elc 137 "-l" elc
135 "--eval" 138 "--eval"
136 (prin1-to-string '(progn (setf (gv-test-foo gv-test-pair) 99) 139 (prin1-to-string
137 (message "%d" (car gv-test-pair))))) 140 '(let ((backtrace-on-error-noninteractive nil))
141 (setf (gv-test-foo gv-test-pair) 99)
142 (message "%d" (car gv-test-pair)))))
138 (should (string-match 143 (should (string-match
139 "\\`Symbol.s function definition is void: \\\\(setf\\\\ gv-test-foo\\\\)\n\\'" 144 "\\`Symbol.s function definition is void: \\\\(setf\\\\ gv-test-foo\\\\)\n\\'"
140 (buffer-string)))))) 145 (buffer-string))))))
diff --git a/test/lisp/emacs-lisp/memory-report-tests.el b/test/lisp/emacs-lisp/memory-report-tests.el
new file mode 100644
index 00000000000..b67ec6c0103
--- /dev/null
+++ b/test/lisp/emacs-lisp/memory-report-tests.el
@@ -0,0 +1,57 @@
1;;; memory-report-tests.el --- tests for memory-report.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2020 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(require 'ert)
21(require 'memory-report)
22
23(defun setup-memory-report-tests ()
24 ;; Set the sizes on things based on a 64-bit architecture. (We're
25 ;; hard-coding this to be able to write simple tests that'll work on
26 ;; all architectures.)
27 (memory-report--set-size
28 '((conses 16 499173 99889)
29 (symbols 48 22244 3)
30 (strings 32 92719 4559)
31 (string-bytes 1 40402011)
32 (vectors 16 31919)
33 (vector-slots 8 385148 149240)
34 (floats 8 434 4519)
35 (intervals 56 24499 997)
36 (buffers 984 33))))
37
38(ert-deftest memory-report-sizes ()
39 (setup-memory-report-tests)
40 (should (equal (memory-report-object-size (cons nil nil)) 16))
41 (should (equal (memory-report-object-size (cons 1 2)) 16))
42
43 (should (equal (memory-report-object-size (list 1 2)) 32))
44 (should (equal (memory-report-object-size (list 1)) 16))
45
46 (should (equal (memory-report-object-size (list 'foo)) 16))
47
48 (should (equal (memory-report-object-size (vector 1 2 3 4)) 80))
49
50 (should (equal (memory-report-object-size "") 32))
51 (should (equal (memory-report-object-size "a") 33))
52 (should (equal (memory-report-object-size (propertize "a" 'face 'foo))
53 81)))
54
55(provide 'memory-report-tests)
56
57;;; memory-report-tests.el ends here
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index c9c92f529be..87d19e8b294 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -96,8 +96,7 @@
96 context 96 context
97 (ert-resource-file "seckey.asc"))) 97 (ert-resource-file "seckey.asc")))
98 (with-temp-buffer 98 (with-temp-buffer
99 (make-local-variable 'epg-tests-context) 99 (setq-local epg-tests-context context)
100 (setq epg-tests-context context)
101 ,@body)) 100 ,@body))
102 (when (file-directory-p epg-tests-home-directory) 101 (when (file-directory-p epg-tests-home-directory)
103 (delete-directory epg-tests-home-directory t))))) 102 (delete-directory epg-tests-home-directory t)))))
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 268c3185bc6..25017dd3261 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -108,11 +108,8 @@ There are different timeouts for local and remote file notification libraries."
108 ;; gio/gpollfilemonitor.c declares POLL_TIME_SECS 5. So we must 108 ;; gio/gpollfilemonitor.c declares POLL_TIME_SECS 5. So we must
109 ;; wait at least this time in the GPollFileMonitor case. A 109 ;; wait at least this time in the GPollFileMonitor case. A
110 ;; similar timeout seems to be needed in the GFamFileMonitor case, 110 ;; similar timeout seems to be needed in the GFamFileMonitor case,
111 ;; at least on Cygwin. 111 ;; at least on cygwin.
112 ((and (string-equal (file-notify--test-library) "gfilenotify") 112 ((memq (file-notify--test-monitor) '(GFamFileMonitor GPollFileMonitor)) 7)
113 (memq (file-notify--test-monitor)
114 '(GFamFileMonitor GPollFileMonitor)))
115 7)
116 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") 1) 113 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") 1)
117 ((file-remote-p temporary-file-directory) 0.1) 114 ((file-remote-p temporary-file-directory) 0.1)
118 (t 0.01)))) 115 (t 0.01))))
@@ -264,13 +261,19 @@ This returns only for the local case and gfilenotify; otherwise it is nil.
264 ;; We cache the result, because after `file-notify-rm-watch', 261 ;; We cache the result, because after `file-notify-rm-watch',
265 ;; `gfile-monitor-name' does not return a proper result anymore. 262 ;; `gfile-monitor-name' does not return a proper result anymore.
266 ;; But we still need this information. 263 ;; But we still need this information.
267 (unless (file-remote-p temporary-file-directory) 264 ;; So far, we know the monitors GFamFileMonitor, GFenFileMonitor,
268 (or (cdr (assq file-notify--test-desc file-notify--test-monitors)) 265 ;; GInotifyFileMonitor, GKqueueFileMonitor and GPollFileMonitor.
269 (when (functionp 'gfile-monitor-name) 266 (or (cdr (assq file-notify--test-desc file-notify--test-monitors))
270 (add-to-list 'file-notify--test-monitors 267 (progn
271 (cons file-notify--test-desc 268 (add-to-list
272 (gfile-monitor-name file-notify--test-desc))) 269 'file-notify--test-monitors
273 (cdr (assq file-notify--test-desc file-notify--test-monitors)))))) 270 (cons file-notify--test-desc
271 (if (file-remote-p temporary-file-directory)
272 (tramp-get-connection-property
273 file-notify--test-desc "gio-file-monitor" nil)
274 (and (functionp 'gfile-monitor-name)
275 (gfile-monitor-name file-notify--test-desc)))))
276 (cdr (assq file-notify--test-desc file-notify--test-monitors)))))
274 277
275(defmacro file-notify--deftest-remote (test docstring &optional unstable) 278(defmacro file-notify--deftest-remote (test docstring &optional unstable)
276 "Define ert `TEST-remote' for remote files. 279 "Define ert `TEST-remote' for remote files.
@@ -457,7 +460,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
457 460
458 (unwind-protect 461 (unwind-protect
459 ;; Check, that removing watch descriptors out of order do not 462 ;; Check, that removing watch descriptors out of order do not
460 ;; harm. This fails on Cygwin because of timing issues unless a 463 ;; harm. This fails on cygwin because of timing issues unless a
461 ;; long `sit-for' is added before the call to 464 ;; long `sit-for' is added before the call to
462 ;; `file-notify--test-read-event'. 465 ;; `file-notify--test-read-event'.
463 (unless (eq system-type 'cygwin) 466 (unless (eq system-type 'cygwin)
@@ -631,13 +634,15 @@ delivered."
631 (cond 634 (cond
632 ;; gvfs-monitor-dir on cygwin does not detect the 635 ;; gvfs-monitor-dir on cygwin does not detect the
633 ;; `created' event reliably. 636 ;; `created' event reliably.
634 ((string-equal 637 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
635 (file-notify--test-library) "gvfs-monitor-dir.exe")
636 '((deleted stopped) 638 '((deleted stopped)
637 (created deleted stopped))) 639 (created deleted stopped)))
638 ;; cygwin does not raise a `changed' event. 640 ;; cygwin does not raise a `changed' event.
639 ((eq system-type 'cygwin) 641 ((eq system-type 'cygwin)
640 '(created deleted stopped)) 642 '(created deleted stopped))
643 ;; GKqueueFileMonitor does not report the `changed' event.
644 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
645 '(created deleted stopped))
641 (t '(created changed deleted stopped))) 646 (t '(created changed deleted stopped)))
642 (write-region 647 (write-region
643 "another text" nil file-notify--test-tmpfile nil 'no-message) 648 "another text" nil file-notify--test-tmpfile nil 'no-message)
@@ -668,6 +673,9 @@ delivered."
668 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") 673 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
669 '((deleted stopped) 674 '((deleted stopped)
670 (changed deleted stopped))) 675 (changed deleted stopped)))
676 ;; GKqueueFileMonitor does not report the `changed' event.
677 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
678 '(deleted stopped))
671 ;; There could be one or two `changed' events. 679 ;; There could be one or two `changed' events.
672 (t '((changed deleted stopped) 680 (t '((changed deleted stopped)
673 (changed changed deleted stopped)))) 681 (changed changed deleted stopped))))
@@ -718,6 +726,9 @@ delivered."
718 '(created deleted stopped)) 726 '(created deleted stopped))
719 ((string-equal (file-notify--test-library) "kqueue") 727 ((string-equal (file-notify--test-library) "kqueue")
720 '(created changed deleted stopped)) 728 '(created changed deleted stopped))
729 ;; GKqueueFileMonitor does not report the `changed' event.
730 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
731 '(created deleted deleted stopped))
721 (t '(created changed deleted deleted stopped))) 732 (t '(created changed deleted deleted stopped)))
722 (write-region 733 (write-region
723 "any text" nil file-notify--test-tmpfile nil 'no-message) 734 "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -767,6 +778,9 @@ delivered."
767 ;; directory are not detected. 778 ;; directory are not detected.
768 ((getenv "EMACS_EMBA_CI") 779 ((getenv "EMACS_EMBA_CI")
769 '(created changed created changed deleted deleted)) 780 '(created changed created changed deleted deleted))
781 ;; GKqueueFileMonitor does not report the `changed' event.
782 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
783 '(created created deleted deleted deleted stopped))
770 (t '(created changed created changed 784 (t '(created changed created changed
771 deleted deleted deleted stopped))) 785 deleted deleted deleted stopped)))
772 (write-region 786 (write-region
@@ -823,6 +837,9 @@ delivered."
823 '(created created deleted deleted stopped)) 837 '(created created deleted deleted stopped))
824 ((string-equal (file-notify--test-library) "kqueue") 838 ((string-equal (file-notify--test-library) "kqueue")
825 '(created changed renamed deleted stopped)) 839 '(created changed renamed deleted stopped))
840 ;; GKqueueFileMonitor does not report the `changed' event.
841 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
842 '(created renamed deleted deleted stopped))
826 (t '(created changed renamed deleted deleted stopped))) 843 (t '(created changed renamed deleted deleted stopped)))
827 (write-region 844 (write-region
828 "any text" nil file-notify--test-tmpfile nil 'no-message) 845 "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -859,6 +876,8 @@ delivered."
859 ((string-equal (file-notify--test-library) "w32notify") 876 ((string-equal (file-notify--test-library) "w32notify")
860 '((changed changed) 877 '((changed changed)
861 (changed changed changed changed))) 878 (changed changed changed changed)))
879 ;; GKqueueFileMonitor does not report the `attribute-changed' event.
880 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor) nil)
862 ;; For kqueue and in the remote case, `write-region' 881 ;; For kqueue and in the remote case, `write-region'
863 ;; raises also an `attribute-changed' event. 882 ;; raises also an `attribute-changed' event.
864 ((or (string-equal (file-notify--test-library) "kqueue") 883 ((or (string-equal (file-notify--test-library) "kqueue")
@@ -925,6 +944,10 @@ delivered."
925 ;; timeouts. 944 ;; timeouts.
926 (setq file-notify--test-desc auto-revert-notify-watch-descriptor) 945 (setq file-notify--test-desc auto-revert-notify-watch-descriptor)
927 946
947 ;; GKqueueFileMonitor does not report the `changed' event.
948 (skip-unless
949 (not (equal (file-notify--test-monitor) 'GKqueueFileMonitor)))
950
928 ;; Check, that file notification has been used. 951 ;; Check, that file notification has been used.
929 (should auto-revert-mode) 952 (should auto-revert-mode)
930 (should auto-revert-use-notify) 953 (should auto-revert-use-notify)
@@ -956,7 +979,7 @@ delivered."
956 979
957 ;; Modify file. We wait for two seconds, in order to 980 ;; Modify file. We wait for two seconds, in order to
958 ;; have another timestamp. One second seems to be too 981 ;; have another timestamp. One second seems to be too
959 ;; short. And Cygwin sporadically requires more than two. 982 ;; short. And cygwin sporadically requires more than two.
960 (ert-with-message-capture captured-messages 983 (ert-with-message-capture captured-messages
961 (let ((inhibit-message t)) 984 (let ((inhibit-message t))
962 (sleep-for (if (eq system-type 'cygwin) 3 2)) 985 (sleep-for (if (eq system-type 'cygwin) 3 2))
@@ -1028,6 +1051,9 @@ delivered."
1028 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") 1051 ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
1029 '((deleted stopped) 1052 '((deleted stopped)
1030 (changed deleted stopped))) 1053 (changed deleted stopped)))
1054 ;; GKqueueFileMonitor does not report the `changed' event.
1055 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
1056 '(deleted stopped))
1031 ;; There could be one or two `changed' events. 1057 ;; There could be one or two `changed' events.
1032 (t '((changed deleted stopped) 1058 (t '((changed deleted stopped)
1033 (changed changed deleted stopped)))) 1059 (changed changed deleted stopped))))
@@ -1077,6 +1103,9 @@ delivered."
1077 '(created deleted stopped)) 1103 '(created deleted stopped))
1078 ((string-equal (file-notify--test-library) "kqueue") 1104 ((string-equal (file-notify--test-library) "kqueue")
1079 '(created changed deleted stopped)) 1105 '(created changed deleted stopped))
1106 ;; GKqueueFileMonitor does not report the `changed' event.
1107 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
1108 '(created deleted deleted stopped))
1080 (t '(created changed deleted deleted stopped))) 1109 (t '(created changed deleted deleted stopped)))
1081 (write-region 1110 (write-region
1082 "any text" nil file-notify--test-tmpfile nil 'no-message) 1111 "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -1254,9 +1283,12 @@ delivered."
1254 '(change) #'file-notify--test-event-handler))) 1283 '(change) #'file-notify--test-event-handler)))
1255 (should (file-notify-valid-p file-notify--test-desc)) 1284 (should (file-notify-valid-p file-notify--test-desc))
1256 (file-notify--test-with-actions 1285 (file-notify--test-with-actions
1257 ;; There could be one or two `changed' events. 1286 (cond
1258 '((changed) 1287 ;; GKqueueFileMonitor does not report the `changed' event.
1259 (changed changed)) 1288 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor) nil)
1289 ;; There could be one or two `changed' events.
1290 (t '((changed)
1291 (changed changed))))
1260 ;; There shouldn't be any problem, because the file is kept. 1292 ;; There shouldn't be any problem, because the file is kept.
1261 (with-temp-buffer 1293 (with-temp-buffer
1262 (let ((buffer-file-name file-notify--test-tmpfile) 1294 (let ((buffer-file-name file-notify--test-tmpfile)
@@ -1294,6 +1326,9 @@ delivered."
1294 ;; On cygwin we only get the `changed' event. 1326 ;; On cygwin we only get the `changed' event.
1295 ((eq system-type 'cygwin) 1327 ((eq system-type 'cygwin)
1296 '(changed)) 1328 '(changed))
1329 ;; GKqueueFileMonitor does not report the `changed' event.
1330 ((equal (file-notify--test-monitor) 'GKqueueFileMonitor)
1331 '(renamed created))
1297 (t '(renamed created changed))) 1332 (t '(renamed created changed)))
1298 ;; The file is renamed when creating a backup. It shall 1333 ;; The file is renamed when creating a backup. It shall
1299 ;; still be watched. 1334 ;; still be watched.
@@ -1391,7 +1426,12 @@ the file watch."
1391 (make-list (/ n 2) 'changed) 1426 (make-list (/ n 2) 'changed)
1392 ;; Just the directory monitor. 1427 ;; Just the directory monitor.
1393 (make-list (/ n 2) 'created) 1428 (make-list (/ n 2) 'created)
1394 (make-list (/ n 2) 'changed))) 1429 (make-list (/ n 2) 'changed))
1430 (append
1431 '(:random)
1432 ;; Just the directory monitor. GKqueueFileMonitor
1433 ;; does not report the `changed' event.
1434 (make-list (/ n 2) 'created)))
1395 (dotimes (i n) 1435 (dotimes (i n)
1396 (file-notify--test-read-event) 1436 (file-notify--test-read-event)
1397 (if (zerop (mod i 2)) 1437 (if (zerop (mod i 2))
diff --git a/test/lisp/net/rcirc-tests.el b/test/lisp/net/rcirc-tests.el
index 285926af9d2..cbd1c2be830 100644
--- a/test/lisp/net/rcirc-tests.el
+++ b/test/lisp/net/rcirc-tests.el
@@ -51,4 +51,16 @@
51 "MODE #cchan +kl :a:b" 51 "MODE #cchan +kl :a:b"
52 nil "MODE" '("#cchan" "+kl" "a:b"))) 52 nil "MODE" '("#cchan" "+kl" "a:b")))
53 53
54(ert-deftest rcirc-rename-nicks ()
55 (should (equal (rcirc--make-new-nick "foo" 16)
56 "foo`"))
57 (should (equal (rcirc--make-new-nick "123456789012345" 16)
58 "123456789012345`"))
59 (should (equal (rcirc--make-new-nick "1234567890123456" 16)
60 "123456789012345`"))
61 (should (equal (rcirc--make-new-nick "123456789012345`" 16)
62 "12345678901234``"))
63 (should (equal (rcirc--make-new-nick "123456789012````" 16)
64 "12345678901`````")))
65
54;;; rcirc-tests.el ends here 66;;; rcirc-tests.el ends here
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el
index 7abb79eadde..3eba4cfd78b 100644
--- a/test/src/casefiddle-tests.el
+++ b/test/src/casefiddle-tests.el
@@ -247,7 +247,8 @@
247 ;; input upcase downcase [titlecase] 247 ;; input upcase downcase [titlecase]
248 (dolist (test '((?a ?A ?a) (?A ?A ?a) 248 (dolist (test '((?a ?A ?a) (?A ?A ?a)
249 (?ł ?Ł ?ł) (?Ł ?Ł ?ł) 249 (?ł ?Ł ?ł) (?Ł ?Ł ?ł)
250 (?ß ?ß ?ß) (?ẞ ?ẞ ?ß) 250 ;; We char-upcase ß to ẞ; see bug #11309.
251 (?ß ?ẞ ?ß) (?ẞ ?ẞ ?ß)
251 (?ⅷ ?Ⅷ ?ⅷ) (?Ⅷ ?Ⅷ ?ⅷ) 252 (?ⅷ ?Ⅷ ?ⅷ) (?Ⅷ ?Ⅷ ?ⅷ)
252 (?DŽ ?DŽ ?dž ?Dž) (?Dž ?DŽ ?dž ?Dž) (?dž ?DŽ ?dž ?Dž))) 253 (?DŽ ?DŽ ?dž ?Dž) (?Dž ?DŽ ?dž ?Dž) (?dž ?DŽ ?dž ?Dž)))
253 (let ((ch (car test)) 254 (let ((ch (car test))
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 1312683c848..c5fc3eaa11a 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -324,7 +324,7 @@ comparing the subr with a much slower lisp implementation."
324 324
325(defvar binding-test-some-local 'some) 325(defvar binding-test-some-local 'some)
326(with-current-buffer binding-test-buffer-A 326(with-current-buffer binding-test-buffer-A
327 (set (make-local-variable 'binding-test-some-local) 'local)) 327 (setq-local binding-test-some-local 'local))
328 328
329(ert-deftest binding-test-manual () 329(ert-deftest binding-test-manual ()
330 "A test case from the elisp manual." 330 "A test case from the elisp manual."
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el
index 4125573dc6a..297db81f5ab 100644
--- a/test/src/eval-tests.el
+++ b/test/src/eval-tests.el
@@ -195,6 +195,23 @@ expressions works for identifiers starting with period."
195 (search-forward " foo()") 195 (search-forward " foo()")
196 (search-forward " normal-top-level()"))))) 196 (search-forward " normal-top-level()")))))
197 197
198(ert-deftest eval-tests/backtrace-in-batch-mode/inhibit ()
199 (let ((emacs (expand-file-name invocation-name invocation-directory)))
200 (skip-unless (file-executable-p emacs))
201 (with-temp-buffer
202 (let ((status (call-process
203 emacs nil t nil
204 "--quick" "--batch"
205 (concat "--eval="
206 (prin1-to-string
207 '(progn
208 (defun foo () (error "Boo"))
209 (let ((backtrace-on-error-noninteractive nil))
210 (foo))))))))
211 (should (natnump status))
212 (should-not (eql status 0)))
213 (should (equal (string-trim (buffer-string)) "Boo")))))
214
198(ert-deftest eval-tests/backtrace-in-batch-mode/demoted-errors () 215(ert-deftest eval-tests/backtrace-in-batch-mode/demoted-errors ()
199 (let ((emacs (expand-file-name invocation-name invocation-directory))) 216 (let ((emacs (expand-file-name invocation-name invocation-directory)))
200 (skip-unless (file-executable-p emacs)) 217 (skip-unless (file-executable-p emacs))
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 86b8d655d26..eaa569e0d95 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -983,3 +983,19 @@
983 (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270") 983 (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270")
984 2)) 984 2))
985 (should (equal (string-search "\303\270" "foo\303\270") 3))) 985 (should (equal (string-search "\303\270" "foo\303\270") 3)))
986
987(ert-deftest object-intervals ()
988 (should (equal (object-intervals (propertize "foo" 'bar 'zot))
989 '((0 3 (bar zot)))))
990 (should (equal (object-intervals (concat (propertize "foo" 'bar 'zot)
991 (propertize "foo" 'gazonk "gazonk")))
992 '((0 3 (bar zot)) (3 6 (gazonk "gazonk")))))
993 (should (equal
994 (with-temp-buffer
995 (insert "foobar")
996 (put-text-property 1 3 'foo 1)
997 (put-text-property 3 6 'bar 2)
998 (put-text-property 2 5 'zot 3)
999 (object-intervals (current-buffer)))
1000 '((0 1 (foo 1)) (1 2 (zot 3 foo 1)) (2 4 (zot 3 bar 2))
1001 (4 5 (bar 2)) (5 6 nil)))))
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index f9372e37b11..34d4067db47 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -803,4 +803,68 @@ This evaluates the TESTS test cases from glibc."
803 (should-not (string-match "å" "\xe5")) 803 (should-not (string-match "å" "\xe5"))
804 (should-not (string-match "[å]" "\xe5"))) 804 (should-not (string-match "[å]" "\xe5")))
805 805
806(ert-deftest regexp-case-fold ()
807 "Test case-sensitive and case-insensitive matching."
808 (let ((case-fold-search nil))
809 (should (equal (string-match "aB" "ABaB") 2))
810 (should (equal (string-match "åÄ" "ÅäåäÅÄåÄ") 6))
811 (should (equal (string-match "λΛ" "lΛλλΛ") 3))
812 (should (equal (string-match "шШ" "zШшшШ") 3))
813 (should (equal (string-match "[[:alpha:]]+" ".3aBåÄßλΛшШ中﷽") 2))
814 (should (equal (match-end 0) 12))
815 (should (equal (string-match "[[:alnum:]]+" ".3aBåÄßλΛшШ中﷽") 1))
816 (should (equal (match-end 0) 12))
817 (should (equal (string-match "[[:upper:]]+" ".3aåλшBÄΛШ中﷽") 6))
818 (should (equal (match-end 0) 10))
819 (should (equal (string-match "[[:lower:]]+" ".3BÄΛШaåλш中﷽") 6))
820 (should (equal (match-end 0) 10)))
821 (let ((case-fold-search t))
822 (should (equal (string-match "aB" "ABaB") 0))
823 (should (equal (string-match "åÄ" "ÅäåäÅÄåÄ") 0))
824 (should (equal (string-match "λΛ" "lΛλλΛ") 1))
825 (should (equal (string-match "шШ" "zШшшШ") 1))
826 (should (equal (string-match "[[:alpha:]]+" ".3aBåÄßλΛшШ中﷽") 2))
827 (should (equal (match-end 0) 12))
828 (should (equal (string-match "[[:alnum:]]+" ".3aBåÄßλΛшШ中﷽") 1))
829 (should (equal (match-end 0) 12))
830 (should (equal (string-match "[[:upper:]]+" ".3aåλшBÄΛШ中﷽") 2))
831 (should (equal (match-end 0) 10))
832 (should (equal (string-match "[[:lower:]]+" ".3BÄΛШaåλш中﷽") 2))
833 (should (equal (match-end 0) 10))))
834
835(ert-deftest regexp-eszett ()
836 "Test matching of ß and ẞ."
837 ;; Sanity checks.
838 (should (equal (upcase "ß") "SS"))
839 (should (equal (downcase "ß") "ß"))
840 (should (equal (capitalize "ß") "Ss")) ; undeutsch...
841 (should (equal (upcase "ẞ") "ẞ"))
842 (should (equal (downcase "ẞ") "ß"))
843 (should (equal (capitalize "ẞ") "ẞ"))
844 ;; ß is a lower-case letter (Ll); ẞ is an upper-case letter (Lu).
845 (let ((case-fold-search nil))
846 (should (equal (string-match "ß" "ß") 0))
847 (should (equal (string-match "ß" "ẞ") nil))
848 (should (equal (string-match "ẞ" "ß") nil))
849 (should (equal (string-match "ẞ" "ẞ") 0))
850 (should (equal (string-match "[[:alpha:]]" "ß") 0))
851 ;; bug#11309
852 (should (equal (string-match "[[:lower:]]" "ß") 0))
853 (should (equal (string-match "[[:upper:]]" "ß") nil))
854 (should (equal (string-match "[[:alpha:]]" "ẞ") 0))
855 (should (equal (string-match "[[:lower:]]" "ẞ") nil))
856 (should (equal (string-match "[[:upper:]]" "ẞ") 0)))
857 (let ((case-fold-search t))
858 (should (equal (string-match "ß" "ß") 0))
859 (should (equal (string-match "ß" "ẞ") 0))
860 (should (equal (string-match "ẞ" "ß") 0))
861 (should (equal (string-match "ẞ" "ẞ") 0))
862 (should (equal (string-match "[[:alpha:]]" "ß") 0))
863 ;; bug#11309
864 (should (equal (string-match "[[:lower:]]" "ß") 0))
865 (should (equal (string-match "[[:upper:]]" "ß") 0))
866 (should (equal (string-match "[[:alpha:]]" "ẞ") 0))
867 (should (equal (string-match "[[:lower:]]" "ẞ") 0))
868 (should (equal (string-match "[[:upper:]]" "ẞ") 0))))
869
806;;; regex-emacs-tests.el ends here 870;;; regex-emacs-tests.el ends here