aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndrea Corallo2021-02-10 21:56:55 +0100
committerAndrea Corallo2021-02-10 21:56:55 +0100
commit2fcb85c3e780f1f2871ce0f300cfaffce9836eb0 (patch)
treea8857ccad8bff12080062a3edaad1a55a3eb8171 /test
parent1f626e9662d8120acd5a937f847123cc2b8c6e31 (diff)
parent6bfdfeed36fab4680c8db90c22da8f6611694186 (diff)
downloademacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.tar.gz
emacs-2fcb85c3e780f1f2871ce0f300cfaffce9836eb0.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'test')
-rw-r--r--test/lisp/cedet/cedet-files-tests.el54
-rw-r--r--test/lisp/cedet/inversion-tests.el81
-rw-r--r--test/lisp/cedet/semantic-utest-fmt.el127
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/test.mk (renamed from test/manual/cedet/tests/test.mk)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/test.srt (renamed from test/manual/cedet/tests/test.srt)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/test.texi (renamed from test/manual/cedet/tests/test.texi)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp (renamed from test/manual/cedet/tests/testdoublens.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp (renamed from test/manual/cedet/tests/testdoublens.hpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testfriends.cpp (renamed from test/manual/cedet/tests/testfriends.cpp)1
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java (renamed from test/manual/cedet/tests/testjavacomp.java)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp (renamed from test/manual/cedet/tests/testlocalvars.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp (renamed from test/manual/cedet/tests/testnsp.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c (renamed from test/manual/cedet/tests/testsppcomplete.c)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp (renamed from test/manual/cedet/tests/teststruct.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp (renamed from test/manual/cedet/tests/testsubclass.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh (renamed from test/manual/cedet/tests/testsubclass.hh)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp (renamed from test/manual/cedet/tests/testtemplates.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp (renamed from test/manual/cedet/tests/testtypedefs.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp (renamed from test/manual/cedet/tests/testusing.cpp)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testusing.hh (renamed from test/manual/cedet/tests/testusing.hh)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c (renamed from test/manual/cedet/tests/testvarnames.c)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java (renamed from test/manual/cedet/tests/testvarnames.java)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy (renamed from test/manual/cedet/tests/testwisent.wy)0
-rw-r--r--test/lisp/cedet/semantic-utest-ia.el71
-rw-r--r--test/lisp/cedet/semantic/bovine/gcc-tests.el129
-rw-r--r--test/lisp/cedet/semantic/format-resources/test-fmt.cpp (renamed from test/manual/cedet/tests/test-fmt.cpp)0
-rw-r--r--test/lisp/cedet/semantic/format-resources/test-fmt.el (renamed from test/manual/cedet/tests/test-fmt.el)2
-rw-r--r--test/lisp/cedet/semantic/format-tests.el95
-rw-r--r--test/lisp/cedet/semantic/fw-tests.el45
-rw-r--r--test/lisp/cedet/srecode/document-tests.el80
-rw-r--r--test/lisp/cedet/srecode/fields-tests.el (renamed from test/manual/cedet/srecode-tests.el)94
-rw-r--r--test/lisp/cus-edit-tests.el4
-rw-r--r--test/lisp/dom-tests.el2
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el92
-rw-r--r--test/lisp/emacs-lisp/cl-extra-tests.el22
-rw-r--r--test/lisp/emacs-lisp/cl-lib-tests.el22
-rw-r--r--test/lisp/emacs-lisp/cl-macs-tests.el22
-rw-r--r--test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el22
-rw-r--r--test/lisp/emacs-lisp/edebug-tests.el22
-rw-r--r--test/lisp/emacs-lisp/ert-tests.el22
-rw-r--r--test/lisp/emacs-lisp/ert-x-tests.el22
-rw-r--r--test/lisp/emacs-lisp/lisp-mode-tests.el2
-rw-r--r--test/lisp/emacs-lisp/lisp-tests.el2
-rw-r--r--test/lisp/emacs-lisp/testcover-resources/testcases.el22
-rw-r--r--test/lisp/emacs-lisp/testcover-tests.el22
-rw-r--r--test/lisp/gnus/gnus-search-tests.el8
-rw-r--r--test/lisp/gnus/gnus-util-tests.el8
-rw-r--r--test/lisp/gnus/mm-decode-tests.el6
-rw-r--r--test/lisp/gnus/mml-sec-tests.el9
-rw-r--r--test/lisp/mail/mail-utils-tests.el104
-rw-r--r--test/lisp/minibuffer-tests.el24
-rw-r--r--test/lisp/net/dbus-tests.el8
-rw-r--r--test/lisp/net/sasl-scram-rfc-tests.el2
-rw-r--r--test/lisp/net/tramp-tests.el14
-rw-r--r--test/lisp/nxml/nxml-mode-tests.el2
-rw-r--r--test/lisp/nxml/xsd-regexp-tests.el2
-rw-r--r--test/lisp/obsolete/cl-tests.el22
-rw-r--r--test/lisp/play/cookie1-resources/cookies8
-rw-r--r--test/lisp/play/cookie1-tests.el40
-rw-r--r--test/lisp/progmodes/ruby-mode-resources/ruby.rb2
-rw-r--r--test/lisp/progmodes/tcl-tests.el1
-rw-r--r--test/lisp/simple-tests.el25
-rw-r--r--test/lisp/textmodes/dns-mode-tests.el21
-rw-r--r--test/manual/cedet/cedet-utests.el105
-rw-r--r--test/manual/cedet/ede-tests.el14
-rw-r--r--test/manual/cedet/semantic-tests.el122
-rw-r--r--test/manual/cedet/tests/test.el2
-rw-r--r--test/manual/etags/ETAGS.good_110
-rw-r--r--test/manual/etags/el-src/TAGTEST.EL2
-rw-r--r--test/src/editfns-tests.el22
-rw-r--r--test/src/fns-tests.el30
-rw-r--r--test/src/indent-tests.el22
-rw-r--r--test/src/minibuf-tests.el8
-rw-r--r--test/src/process-tests.el28
74 files changed, 1093 insertions, 657 deletions
diff --git a/test/lisp/cedet/cedet-files-tests.el b/test/lisp/cedet/cedet-files-tests.el
new file mode 100644
index 00000000000..5502d424314
--- /dev/null
+++ b/test/lisp/cedet/cedet-files-tests.el
@@ -0,0 +1,54 @@
1;;; cedet-files-tests.el --- Tests for cedet-files.el -*- lexical-binding:t -*-
2
3;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Moved here from test/manual/cedet/cedet-utests.el
25
26;;; Code:
27
28(require 'ert)
29(require 'cedet-files)
30
31(defvar cedet-files-utest-list
32 '(
33 ( "/home/me/src/myproj/src/foo.c" . "!home!me!src!myproj!src!foo.c" )
34 ( "c:/work/myproj/foo.el" . "!drive_c!work!myproj!foo.el" )
35 ( "//windows/proj/foo.java" . "!!windows!proj!foo.java" )
36 ( "/home/me/proj!bang/foo.c" . "!home!me!proj!!bang!foo.c" )
37 )
38 "List of different file names to test.
39Each entry is a cons cell of ( FNAME . CONVERTED )
40where FNAME is some file name, and CONVERTED is what it should be
41converted into.")
42
43(ert-deftest cedet-files-utest ()
44 "Test out some file name conversions."
45 (interactive)
46 (dolist (FT cedet-files-utest-list)
47 (let ((dir->file (cedet-directory-name-to-file-name (car FT) t))
48 (file->dir (cedet-file-name-to-directory-name (cdr FT) t)))
49 (should (string= (cdr FT) dir->file))
50 (should (string= file->dir (car FT))))))
51
52(provide 'cedet-files-tests)
53
54;;; cedet-files-tests.el ends here
diff --git a/test/lisp/cedet/inversion-tests.el b/test/lisp/cedet/inversion-tests.el
new file mode 100644
index 00000000000..c8b45d67ea1
--- /dev/null
+++ b/test/lisp/cedet/inversion-tests.el
@@ -0,0 +1,81 @@
1;;; inversion-tests.el --- Tests for inversion.el -*- lexical-binding:t -*-
2
3;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Moved here from test/manual/cedet/cedet-utests.el
25
26;;; Code:
27
28(require 'inversion)
29(require 'ert)
30
31(ert-deftest inversion-unit-test ()
32 "Test inversion to make sure it can identify different version strings."
33 (interactive)
34 (let ((c1 (inversion-package-version 'inversion))
35 (c1i (inversion-package-incompatibility-version 'inversion))
36 (c2 (inversion-decode-version "1.3alpha2"))
37 (c3 (inversion-decode-version "1.3beta4"))
38 (c4 (inversion-decode-version "1.3 beta5"))
39 (c5 (inversion-decode-version "1.3.4"))
40 (c6 (inversion-decode-version "2.3alpha"))
41 (c7 (inversion-decode-version "1.3"))
42 (c8 (inversion-decode-version "1.3pre1"))
43 (c9 (inversion-decode-version "2.4 (patch 2)"))
44 (c10 (inversion-decode-version "2.4 (patch 3)"))
45 (c11 (inversion-decode-version "2.4.2.1"))
46 (c12 (inversion-decode-version "2.4.2.2")))
47 (should (inversion-= c1 c1))
48 (should (inversion-< c1i c1))
49 (should (inversion-< c2 c3))
50 (should (inversion-< c3 c4))
51 (should (inversion-< c4 c5))
52 (should (inversion-< c5 c6))
53 (should (inversion-< c2 c4))
54 (should (inversion-< c2 c5))
55 (should (inversion-< c2 c6))
56 (should (inversion-< c3 c5))
57 (should (inversion-< c3 c6))
58 (should (inversion-< c7 c6))
59 (should (inversion-< c4 c7))
60 (should (inversion-< c2 c7))
61 (should (inversion-< c8 c6))
62 (should (inversion-< c8 c7))
63 (should (inversion-< c4 c8))
64 (should (inversion-< c2 c8))
65 (should (inversion-< c9 c10))
66 (should (inversion-< c10 c11))
67 (should (inversion-< c11 c12))
68 ;; Negatives
69 (should-not (inversion-< c3 c2))
70 (should-not (inversion-< c4 c3))
71 (should-not (inversion-< c5 c4))
72 (should-not (inversion-< c6 c5))
73 (should-not (inversion-< c7 c2))
74 (should-not (inversion-< c7 c8))
75 (should-not (inversion-< c12 c11))
76 ;; Test the tester on inversion
77 (should-not (inversion-test 'inversion inversion-version))
78 (should (stringp (inversion-test 'inversion "0.0.0")))
79 (should (stringp (inversion-test 'inversion "1000.0")))))
80
81;;; inversion-tests.el ends here
diff --git a/test/lisp/cedet/semantic-utest-fmt.el b/test/lisp/cedet/semantic-utest-fmt.el
deleted file mode 100644
index d6e5ce7a0fd..00000000000
--- a/test/lisp/cedet/semantic-utest-fmt.el
+++ /dev/null
@@ -1,127 +0,0 @@
1;;; cedet/semantic-utest-fmt.el --- Parsing / Formatting tests -*- lexical-binding:t -*-
2
3;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23;;
24;; Unit tests for the formatting feature.
25;;
26;; Using test code from the tests source directory, parse the source
27;; file. After parsing, read the comments for each signature, and
28;; make sure that the semantic-tag-format-* functions in question
29;; created the desired output.
30
31(require 'semantic)
32(require 'semantic/format)
33
34;;; Code:
35
36(defvar cedet-utest-directory
37 (let* ((C (file-name-directory (locate-library "cedet")))
38 (D (expand-file-name "../../test/manual/cedet/" C)))
39 D)
40 "Location of test files for this test suite.")
41
42(defvar semantic-fmt-utest-file-list
43 '("tests/test-fmt.cpp"
44 ;; "tests/test-fmt.el" - add this when elisp is support by dflt in Emacs
45 )
46 "List of files to run unit tests in.")
47
48(defvar semantic-fmt-utest-error-log-list nil
49 "Log errors during testing in this variable.")
50
51(ert-deftest semantic-fmt-utest ()
52 "Visit all file entries, and run formatting test.
53Files to visit are in `semantic-fmt-utest-file-list'."
54 (save-current-buffer
55 (semantic-mode 1)
56 (let ((fl semantic-fmt-utest-file-list)
57 (fname nil)
58 )
59
60 (dolist (FILE fl)
61
62 (save-current-buffer
63 (setq fname (expand-file-name FILE cedet-utest-directory))
64
65 ;; Make sure we have the files we think we have.
66 (should (file-exists-p fname))
67 ;; (error "Cannot find unit test file: %s" fname))
68
69 ;; Run the tests.
70 (let ((fb (find-buffer-visiting fname))
71 (b (semantic-find-file-noselect fname))
72 (tags nil))
73
74 (save-current-buffer
75 (set-buffer b)
76 (should (semantic-active-p))
77 ;;(error "Cannot open %s for format tests" fname))
78
79 ;; This will force a reparse, removing any chance of semanticdb cache
80 ;; using stale data.
81 (semantic-clear-toplevel-cache)
82 ;; Force the reparse
83 (setq tags (semantic-fetch-tags))
84
85 (save-excursion
86 (while tags
87 (let* ((T (car tags))
88 (start (semantic-tag-end T))
89 (end (if (cdr tags)
90 (semantic-tag-start (car (cdr tags)))
91 (point-max)))
92 (TESTS nil)
93 )
94 (goto-char start)
95 ;; Scan the space between tags for all test condition matches.
96 (while (re-search-forward "## \\([a-z-]+\\) \"\\([^\n\"]+\\)\"$" end t)
97 (push (cons (match-string 1) (match-string 2)) TESTS))
98 (setq TESTS (nreverse TESTS))
99
100 (dolist (TST TESTS)
101 (let* ( ;; For each test, convert CAR into a semantic-format-tag* fcn
102 (sym (intern (concat "semantic-format-tag-" (car TST))))
103 ;; Convert the desired result from a string syntax to a string.
104 (desired (cdr TST))
105 ;; What does the fmt function do?
106 (actual (funcall sym T))
107 )
108 (when (not (string= desired actual))
109 (should-not (list "Desired" desired
110 "Actual" actual
111 "Formatter" (car TST))))
112 )))
113 (setq tags (cdr tags)))
114
115 ))
116
117 ;; If it wasn't already in memory, whack it.
118 (when (and b (not fb))
119 (kill-buffer b)))
120 ))
121
122 )))
123
124
125(provide 'cedet/semantic/fmt-utest)
126
127;;; semantic-fmt-utest.el ends here
diff --git a/test/manual/cedet/tests/test.mk b/test/lisp/cedet/semantic-utest-ia-resources/test.mk
index edea97e7b98..edea97e7b98 100644
--- a/test/manual/cedet/tests/test.mk
+++ b/test/lisp/cedet/semantic-utest-ia-resources/test.mk
diff --git a/test/manual/cedet/tests/test.srt b/test/lisp/cedet/semantic-utest-ia-resources/test.srt
index 38e6f9ed7b7..38e6f9ed7b7 100644
--- a/test/manual/cedet/tests/test.srt
+++ b/test/lisp/cedet/semantic-utest-ia-resources/test.srt
diff --git a/test/manual/cedet/tests/test.texi b/test/lisp/cedet/semantic-utest-ia-resources/test.texi
index 37d303c8b48..37d303c8b48 100644
--- a/test/manual/cedet/tests/test.texi
+++ b/test/lisp/cedet/semantic-utest-ia-resources/test.texi
diff --git a/test/manual/cedet/tests/testdoublens.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp
index ea3afc72a69..ea3afc72a69 100644
--- a/test/manual/cedet/tests/testdoublens.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.cpp
diff --git a/test/manual/cedet/tests/testdoublens.hpp b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp
index e8c9b345b28..e8c9b345b28 100644
--- a/test/manual/cedet/tests/testdoublens.hpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testdoublens.hpp
diff --git a/test/manual/cedet/tests/testfriends.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testfriends.cpp
index 20425f93afa..f84ed5a2190 100644
--- a/test/manual/cedet/tests/testfriends.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testfriends.cpp
@@ -35,4 +35,3 @@ int B::testB() {
35 35
36int B::testAB() { // %1% ( ( "testfriends.cpp" ) ( "B" "B::testAB" ) ) 36int B::testAB() { // %1% ( ( "testfriends.cpp" ) ( "B" "B::testAB" ) )
37} 37}
38
diff --git a/test/manual/cedet/tests/testjavacomp.java b/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java
index bfc016903c8..bfc016903c8 100644
--- a/test/manual/cedet/tests/testjavacomp.java
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testjavacomp.java
diff --git a/test/manual/cedet/tests/testlocalvars.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp
index 9d2329a0fa8..9d2329a0fa8 100644
--- a/test/manual/cedet/tests/testlocalvars.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testlocalvars.cpp
diff --git a/test/manual/cedet/tests/testnsp.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp
index db1603cead2..db1603cead2 100644
--- a/test/manual/cedet/tests/testnsp.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testnsp.cpp
diff --git a/test/manual/cedet/tests/testsppcomplete.c b/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c
index 084d6a8687d..084d6a8687d 100644
--- a/test/manual/cedet/tests/testsppcomplete.c
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsppcomplete.c
diff --git a/test/manual/cedet/tests/teststruct.cpp b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp
index 6659b5557b8..6659b5557b8 100644
--- a/test/manual/cedet/tests/teststruct.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/teststruct.cpp
diff --git a/test/manual/cedet/tests/testsubclass.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp
index 409950cce2f..409950cce2f 100644
--- a/test/manual/cedet/tests/testsubclass.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.cpp
diff --git a/test/manual/cedet/tests/testsubclass.hh b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh
index 5d795b32b10..5d795b32b10 100644
--- a/test/manual/cedet/tests/testsubclass.hh
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testsubclass.hh
diff --git a/test/manual/cedet/tests/testtemplates.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp
index ed7a057df0b..ed7a057df0b 100644
--- a/test/manual/cedet/tests/testtemplates.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testtemplates.cpp
diff --git a/test/manual/cedet/tests/testtypedefs.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp
index c82535f9581..c82535f9581 100644
--- a/test/manual/cedet/tests/testtypedefs.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testtypedefs.cpp
diff --git a/test/manual/cedet/tests/testusing.cpp b/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp
index 6f6c8542633..6f6c8542633 100644
--- a/test/manual/cedet/tests/testusing.cpp
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testusing.cpp
diff --git a/test/manual/cedet/tests/testusing.hh b/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh
index d3b690f8542..d3b690f8542 100644
--- a/test/manual/cedet/tests/testusing.hh
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testusing.hh
diff --git a/test/manual/cedet/tests/testvarnames.c b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c
index e796eb285c6..e796eb285c6 100644
--- a/test/manual/cedet/tests/testvarnames.c
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.c
diff --git a/test/manual/cedet/tests/testvarnames.java b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java
index 7ed9785fc07..7ed9785fc07 100644
--- a/test/manual/cedet/tests/testvarnames.java
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testvarnames.java
diff --git a/test/manual/cedet/tests/testwisent.wy b/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy
index 49eb5780f4b..49eb5780f4b 100644
--- a/test/manual/cedet/tests/testwisent.wy
+++ b/test/lisp/cedet/semantic-utest-ia-resources/testwisent.wy
diff --git a/test/lisp/cedet/semantic-utest-ia.el b/test/lisp/cedet/semantic-utest-ia.el
index 7210f66b0a7..122c431d472 100644
--- a/test/lisp/cedet/semantic-utest-ia.el
+++ b/test/lisp/cedet/semantic-utest-ia.el
@@ -30,121 +30,94 @@
30;; (Replace // with contents of comment-start for the language being tested.) 30;; (Replace // with contents of comment-start for the language being tested.)
31 31
32;;; Code: 32;;; Code:
33(require 'ert)
34(require 'ert-x)
33(require 'semantic) 35(require 'semantic)
34(require 'semantic/analyze) 36(require 'semantic/analyze)
35(require 'semantic/analyze/refs) 37(require 'semantic/analyze/refs)
36(require 'semantic/symref) 38(require 'semantic/symref)
37(require 'semantic/symref/filter) 39(require 'semantic/symref/filter)
38 40
39(defvar cedet-utest-directory
40 (let* ((C (file-name-directory (locate-library "cedet")))
41 (D (expand-file-name "../../test/manual/cedet/" C)))
42 D)
43 "Location of test files for this test suite.")
44
45(defvar semantic-utest-test-directory (expand-file-name "tests" cedet-utest-directory)
46 "Location of test files.")
47
48(ert-deftest semantic-utest-ia-doublens.cpp () 41(ert-deftest semantic-utest-ia-doublens.cpp ()
49 (let ((tst (expand-file-name "testdoublens.cpp" semantic-utest-test-directory))) 42 (let ((tst (ert-resource-file "testdoublens.cpp")))
50 (should (file-exists-p tst))
51 (should-not (semantic-ia-utest tst)))) 43 (should-not (semantic-ia-utest tst))))
52 44
53(ert-deftest semantic-utest-ia-subclass.cpp () 45(ert-deftest semantic-utest-ia-subclass.cpp ()
54 (let ((tst (expand-file-name "testsubclass.cpp" semantic-utest-test-directory))) 46 (let ((tst (ert-resource-file "testsubclass.cpp")))
55 (should (file-exists-p tst))
56 (should-not (semantic-ia-utest tst)))) 47 (should-not (semantic-ia-utest tst))))
57 48
58(ert-deftest semantic-utest-ia-typedefs.cpp () 49(ert-deftest semantic-utest-ia-typedefs.cpp ()
59 (let ((tst (expand-file-name "testtypedefs.cpp" semantic-utest-test-directory))) 50 (let ((tst (ert-resource-file "testtypedefs.cpp")))
60 (should (file-exists-p tst))
61 (should-not (semantic-ia-utest tst)))) 51 (should-not (semantic-ia-utest tst))))
62 52
63(ert-deftest semantic-utest-ia-struct.cpp () 53(ert-deftest semantic-utest-ia-struct.cpp ()
64 (let ((tst (expand-file-name "teststruct.cpp" semantic-utest-test-directory))) 54 (let ((tst (ert-resource-file "teststruct.cpp")))
65 (should (file-exists-p tst))
66 (should-not (semantic-ia-utest tst)))) 55 (should-not (semantic-ia-utest tst))))
67 56
68;;(ert-deftest semantic-utest-ia-union.cpp () 57;;(ert-deftest semantic-utest-ia-union.cpp ()
69;; (let ((tst (expand-file-name "testunion.cpp" semantic-utest-test-directory))) 58;; (let ((tst (ert-resource-file "testunion.cpp")))
70;; (should (file-exists-p tst))
71;; (should-not (semantic-ia-utest tst)))) 59;; (should-not (semantic-ia-utest tst))))
72 60
73(ert-deftest semantic-utest-ia-templates.cpp () 61(ert-deftest semantic-utest-ia-templates.cpp ()
74 (let ((tst (expand-file-name "testtemplates.cpp" semantic-utest-test-directory))) 62 (let ((tst (ert-resource-file "testtemplates.cpp")))
75 (should (file-exists-p tst))
76 (should-not (semantic-ia-utest tst)))) 63 (should-not (semantic-ia-utest tst))))
77 64
78;;(ert-deftest semantic-utest-ia-friends.cpp () 65;;(ert-deftest semantic-utest-ia-friends.cpp ()
79;; (let ((tst (expand-file-name "testfriends.cpp" semantic-utest-test-directory))) 66;; (let ((tst (ert-resource-file "testfriends.cpp")))
80;; (should (file-exists-p tst))
81;; (should-not (semantic-ia-utest tst)))) 67;; (should-not (semantic-ia-utest tst))))
82 68
83(ert-deftest semantic-utest-ia-using.cpp () 69(ert-deftest semantic-utest-ia-using.cpp ()
84 (let ((tst (expand-file-name "testusing.cpp" semantic-utest-test-directory))) 70 (let ((tst (ert-resource-file "testusing.cpp")))
85 (should (file-exists-p tst))
86 (should-not (semantic-ia-utest tst)))) 71 (should-not (semantic-ia-utest tst))))
87 72
88(ert-deftest semantic-utest-ia-nsp.cpp () 73(ert-deftest semantic-utest-ia-nsp.cpp ()
89 (skip-unless (executable-find "g++")) 74 (skip-unless (executable-find "g++"))
90 (let ((tst (expand-file-name "testnsp.cpp" semantic-utest-test-directory))) 75 (let ((tst (ert-resource-file "testnsp.cpp")))
91 (should (file-exists-p tst))
92 (should-not (semantic-ia-utest tst)))) 76 (should-not (semantic-ia-utest tst))))
93 77
94(ert-deftest semantic-utest-ia-localvars.cpp () 78(ert-deftest semantic-utest-ia-localvars.cpp ()
95 (let ((tst (expand-file-name "testlocalvars.cpp" semantic-utest-test-directory))) 79 (let ((tst (ert-resource-file "testlocalvars.cpp")))
96 (should (file-exists-p tst))
97 (should-not (semantic-ia-utest tst)))) 80 (should-not (semantic-ia-utest tst))))
98 81
99(ert-deftest semantic-utest-ia-namespace.cpp () 82(ert-deftest semantic-utest-ia-namespace.cpp ()
100 (skip-unless (executable-find "g++")) 83 (skip-unless (executable-find "g++"))
101 (let ((tst (expand-file-name "testnsp.cpp" semantic-utest-test-directory))) 84 (let ((tst (ert-resource-file "testnsp.cpp")))
102 (should (file-exists-p tst))
103 (should-not (semantic-ia-utest tst)))) 85 (should-not (semantic-ia-utest tst))))
104 86
105(ert-deftest semantic-utest-ia-sppcomplete.c () 87(ert-deftest semantic-utest-ia-sppcomplete.c ()
106 (let ((tst (expand-file-name "testsppcomplete.c" semantic-utest-test-directory))) 88 (let ((tst (ert-resource-file "testsppcomplete.c")))
107 (should (file-exists-p tst))
108 (should-not (semantic-ia-utest tst)))) 89 (should-not (semantic-ia-utest tst))))
109 90
110(ert-deftest semantic-utest-ia-varnames.c () 91(ert-deftest semantic-utest-ia-varnames.c ()
111 (let ((tst (expand-file-name "testvarnames.c" semantic-utest-test-directory))) 92 (let ((tst (ert-resource-file "testvarnames.c")))
112 (should (file-exists-p tst))
113 (should-not (semantic-ia-utest tst)))) 93 (should-not (semantic-ia-utest tst))))
114 94
115(ert-deftest semantic-utest-ia-javacomp.java () 95(ert-deftest semantic-utest-ia-javacomp.java ()
116 (let ((tst (expand-file-name "testjavacomp.java" semantic-utest-test-directory))) 96 (let ((tst (ert-resource-file "testjavacomp.java")))
117 (should (file-exists-p tst))
118 (should-not (semantic-ia-utest tst)))) 97 (should-not (semantic-ia-utest tst))))
119 98
120(ert-deftest semantic-utest-ia-varnames.java () 99(ert-deftest semantic-utest-ia-varnames.java ()
121 (let ((tst (expand-file-name "testvarnames.java" semantic-utest-test-directory))) 100 (let ((tst (ert-resource-file "testvarnames.java")))
122 (should (file-exists-p tst))
123 (should-not (semantic-ia-utest tst)))) 101 (should-not (semantic-ia-utest tst))))
124 102
125;;(ert-deftest semantic-utest-ia-f90.f90 () 103;;(ert-deftest semantic-utest-ia-f90.f90 ()
126;; (let ((tst (expand-file-name "testf90.f90" semantic-utest-test-directory))) 104;; (let ((tst (ert-resource-file "testf90.f90")))
127;; (should (file-exists-p tst))
128;; (should-not (semantic-ia-utest tst)))) 105;; (should-not (semantic-ia-utest tst))))
129 106
130(ert-deftest semantic-utest-ia-wisent.wy () 107(ert-deftest semantic-utest-ia-wisent.wy ()
131 (let ((tst (expand-file-name "testwisent.wy" semantic-utest-test-directory))) 108 (let ((tst (ert-resource-file "testwisent.wy")))
132 (should (file-exists-p tst))
133 (should-not (semantic-ia-utest tst)))) 109 (should-not (semantic-ia-utest tst))))
134 110
135(ert-deftest semantic-utest-ia-texi () 111(ert-deftest semantic-utest-ia-texi ()
136 (let ((tst (expand-file-name "test.texi" semantic-utest-test-directory))) 112 (let ((tst (ert-resource-file "test.texi")))
137 (should (file-exists-p tst))
138 (should-not (semantic-ia-utest tst)))) 113 (should-not (semantic-ia-utest tst))))
139 114
140(ert-deftest semantic-utest-ia-make () 115(ert-deftest semantic-utest-ia-make ()
141 (let ((tst (expand-file-name "test.mk" semantic-utest-test-directory))) 116 (let ((tst (ert-resource-file "test.mk")))
142 (should (file-exists-p tst))
143 (should-not (semantic-ia-utest tst)))) 117 (should-not (semantic-ia-utest tst))))
144 118
145(ert-deftest semantic-utest-ia-srecoder () 119(ert-deftest semantic-utest-ia-srecoder ()
146 (let ((tst (expand-file-name "test.srt" semantic-utest-test-directory))) 120 (let ((tst (ert-resource-file "test.srt")))
147 (should (file-exists-p tst))
148 (should-not (semantic-ia-utest tst)))) 121 (should-not (semantic-ia-utest tst))))
149 122
150;;; Core testing utility 123;;; Core testing utility
diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el b/test/lisp/cedet/semantic/bovine/gcc-tests.el
new file mode 100644
index 00000000000..e1a18c6c64c
--- /dev/null
+++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el
@@ -0,0 +1,129 @@
1;;; gcc-tests.el --- Tests for semantic/bovine/gcc.el -*- lexical-binding:t -*-
2
3;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Moved here from test/manual/cedet/semantic-tests.el
25
26;;; Code:
27
28(require 'ert)
29(require 'semantic/bovine/gcc)
30
31;;; From bovine-gcc:
32
33;; Example output of "gcc -v"
34(defvar semantic-gcc-test-strings
35 '(;; My old box:
36 "Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
37Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
38Thread model: posix
39gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
40 ;; Alex Ott:
41 "Using built-in specs.
42Target: i486-linux-gnu
43Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.1-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
44Thread model: posix
45gcc version 4.3.1 (Ubuntu 4.3.1-9ubuntu1)"
46 ;; My debian box:
47 "Using built-in specs.
48Target: x86_64-unknown-linux-gnu
49Configured with: ../../../sources/gcc/configure --prefix=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3 --with-gmp=/usr/local/gcc/gmp --with-mpfr=/usr/local/gcc/mpfr --enable-languages=c,c++,fortran --with-as=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/as --with-ld=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/ld --disable-multilib
50Thread model: posix
51gcc version 4.2.3"
52 ;; My mac:
53 "Using built-in specs.
54Target: i686-apple-darwin8
55Configured with: /private/var/tmp/gcc/gcc-5341.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=pentium-m --with-tune=prescott --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
56Thread model: posix
57gcc version 4.0.1 (Apple Computer, Inc. build 5341)"
58 ;; Ubuntu Intrepid
59 "Using built-in specs.
60Target: x86_64-linux-gnu
61Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
62Thread model: posix
63gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)"
64 ;; Red Hat EL4
65 "Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
66Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
67Thread model: posix
68gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)"
69 ;; Red Hat EL5
70 "Using built-in specs.
71Target: x86_64-redhat-linux
72Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
73Thread model: posix
74gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)"
75 ;; David Engster's german gcc on ubuntu 4.3
76 "Es werden eingebaute Spezifikationen verwendet.
77Ziel: i486-linux-gnu
78Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
79Thread-Modell: posix
80gcc-Version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)"
81 ;; Damien Deville bsd
82 "Using built-in specs.
83Target: i386-undermydesk-freebsd
84Configured with: FreeBSD/i386 system compiler
85Thread model: posix
86gcc version 4.2.1 20070719 [FreeBSD]"
87 )
88 "A bunch of sample gcc -v outputs from different machines.")
89
90(defvar semantic-gcc-test-strings-fail
91 '(;; A really old solaris box I found
92 "Reading specs from /usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
93gcc version 2.95.2 19991024 (release)"
94 )
95 "A bunch of sample gcc -v outputs that fail to provide the info we want.")
96
97(defun semantic-gcc-test-output-parser ()
98 "Test the output parser against some collected strings."
99 (dolist (S semantic-gcc-test-strings)
100 (let* ((fields (semantic-gcc-fields S))
101 (v (cdr (assoc 'version fields)))
102 (h (or (cdr (assoc 'target fields))
103 (cdr (assoc '--target fields))
104 (cdr (assoc '--host fields))))
105 (p (cdr (assoc '--prefix fields))))
106 ;; No longer test for prefixes.
107 (when (not (and v h))
108 (let ((strs (split-string S "\n")))
109 (error "Test failed on %S\nV H P:\n%S %S %S" (car strs) v h p)))))
110 (dolist (S semantic-gcc-test-strings-fail)
111 (let* ((fields (semantic-gcc-fields S))
112 (v (cdr (assoc 'version fields)))
113 (h (or (cdr (assoc '--host fields))
114 (cdr (assoc 'target fields))))
115 (p (cdr (assoc '--prefix fields)))
116 )
117 (when (and v h p)
118 (error "Negative test failed on %S" S)))))
119
120(ert-deftest semantic-gcc-test-output-parser ()
121 (semantic-gcc-test-output-parser))
122
123(ert-deftest semantic-gcc-test-output-parser-this-machine ()
124 "Test the output parser against the machine currently running Emacs."
125 (skip-unless (executable-find "gcc"))
126 (let ((semantic-gcc-test-strings (list (semantic-gcc-query "gcc" "-v"))))
127 (semantic-gcc-test-output-parser)))
128
129;;; gcc-tests.el ends here
diff --git a/test/manual/cedet/tests/test-fmt.cpp b/test/lisp/cedet/semantic/format-resources/test-fmt.cpp
index ab869c1ce00..ab869c1ce00 100644
--- a/test/manual/cedet/tests/test-fmt.cpp
+++ b/test/lisp/cedet/semantic/format-resources/test-fmt.cpp
diff --git a/test/manual/cedet/tests/test-fmt.el b/test/lisp/cedet/semantic/format-resources/test-fmt.el
index 122571323b2..941aaae8595 100644
--- a/test/manual/cedet/tests/test-fmt.el
+++ b/test/lisp/cedet/semantic/format-resources/test-fmt.el
@@ -1,4 +1,4 @@
1;;; test-fmt.el --- test semantic tag formatting 1;;; test-fmt.el --- test semantic tag formatting -*- lexical-binding: t -*-
2 2
3;;; Copyright (C) 2012, 2019-2021 Free Software Foundation, Inc. 3;;; Copyright (C) 2012, 2019-2021 Free Software Foundation, Inc.
4 4
diff --git a/test/lisp/cedet/semantic/format-tests.el b/test/lisp/cedet/semantic/format-tests.el
new file mode 100644
index 00000000000..e82c97b4c43
--- /dev/null
+++ b/test/lisp/cedet/semantic/format-tests.el
@@ -0,0 +1,95 @@
1;;; semantic/format-tests.el --- Parsing / Formatting tests -*- lexical-binding:t -*-
2
3;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Unit tests for the formatting feature.
25;;
26;; Using test code from the tests source directory, parse the source
27;; file. After parsing, read the comments for each signature, and
28;; make sure that the semantic-tag-format-* functions in question
29;; created the desired output.
30
31;;; Code:
32
33(require 'ert)
34(require 'ert-x)
35(require 'semantic/format)
36
37(defvar semantic-fmt-utest-file-list
38 (list (ert-resource-file "test-fmt.cpp")
39 ;; "tests/test-fmt.el" - add this when elisp is support by dflt in Emacs
40 )
41 "List of files to run unit tests in.")
42
43(ert-deftest semantic-fmt-utest ()
44 "Visit all file entries, and run formatting test. "
45 (save-current-buffer
46 (semantic-mode 1)
47 (dolist (fname semantic-fmt-utest-file-list)
48 (let ((fb (find-buffer-visiting fname))
49 (b (semantic-find-file-noselect fname))
50 (tags nil))
51 (save-current-buffer
52 (set-buffer b)
53 (should (semantic-active-p))
54 ;;(error "Cannot open %s for format tests" fname))
55
56 ;; This will force a reparse, removing any chance of semanticdb cache
57 ;; using stale data.
58 (semantic-clear-toplevel-cache)
59 ;; Force the reparse
60 (setq tags (semantic-fetch-tags))
61
62 (save-excursion
63 (while tags
64 (let* ((T (car tags))
65 (start (semantic-tag-end T))
66 (end (if (cdr tags)
67 (semantic-tag-start (car (cdr tags)))
68 (point-max)))
69 (TESTS nil))
70 (goto-char start)
71 ;; Scan the space between tags for all test condition matches.
72 (while (re-search-forward "## \\([a-z-]+\\) \"\\([^\n\"]+\\)\"$" end t)
73 (push (cons (match-string 1) (match-string 2)) TESTS))
74 (setq TESTS (nreverse TESTS))
75
76 (dolist (TST TESTS)
77 (let* ( ;; For each test, convert CAR into a semantic-format-tag* fcn
78 (sym (intern (concat "semantic-format-tag-" (car TST))))
79 ;; Convert the desired result from a string syntax to a string.
80 (desired (cdr TST))
81 ;; What does the fmt function do?
82 (actual (funcall sym T)))
83 (when (not (string= desired actual))
84 (should-not (list "Desired" desired
85 "Actual" actual
86 "Formatter" (car TST)))))))
87 (setq tags (cdr tags)))))
88
89 ;; If it wasn't already in memory, whack it.
90 (when (and b (not fb))
91 (kill-buffer b))))))
92
93(provide 'format-tests)
94
95;;; format-tests.el ends here
diff --git a/test/lisp/cedet/semantic/fw-tests.el b/test/lisp/cedet/semantic/fw-tests.el
new file mode 100644
index 00000000000..62d665dbb6e
--- /dev/null
+++ b/test/lisp/cedet/semantic/fw-tests.el
@@ -0,0 +1,45 @@
1;;; fw-tests.el --- Tests for semantic/fw.el -*- lexical-binding:t -*-
2
3;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Moved here from test/manual/cedet/semantic-tests.el
25
26;;; Code:
27
28(require 'ert)
29(require 'semantic/fw)
30
31;;; From semantic-fw:
32
33(ert-deftest semantic-test-data-cache ()
34 "Test the data cache."
35 (let ((data '(a b c)))
36 (with-current-buffer (get-buffer-create " *semantic-test-data-cache*")
37 (erase-buffer)
38 (insert "The Moose is Loose")
39 (goto-char (point-min))
40 (semantic-cache-data-to-buffer (current-buffer) (point) (+ (point) 5)
41 data 'moose 'exit-cache-zone)
42 ;; retrieve cached data
43 (should (equal (semantic-get-cache-data 'moose) data)))))
44
45;;; gw-tests.el ends here
diff --git a/test/lisp/cedet/srecode/document-tests.el b/test/lisp/cedet/srecode/document-tests.el
new file mode 100644
index 00000000000..0bc6e10d7a7
--- /dev/null
+++ b/test/lisp/cedet/srecode/document-tests.el
@@ -0,0 +1,80 @@
1;;; document-tests.el --- Tests for srecode/document.el -*- lexical-binding:t -*-
2
3;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; Extracted from srecode-document.el in the CEDET distribution.
25
26;; Converted to ert from test/manual/cedet/srecode-tests.el
27
28;;; Code:
29
30(require 'ert)
31(require 'srecode/document)
32
33;; FIXME: This test fails even before conversion to ert.
34(ert-deftest srecode-document-function-comment-extract-test ()
35 "Test old comment extraction.
36Dump out the extracted dictionary."
37 :tags '(:unstable)
38 (interactive)
39
40 (srecode-load-tables-for-mode major-mode)
41 (srecode-load-tables-for-mode major-mode 'document)
42
43 (should (srecode-table))
44 ;; (error "No template table found for mode %s" major-mode)
45
46 (let* ((temp (srecode-template-get-table (srecode-table)
47 "function-comment"
48 "declaration"
49 'document))
50 (fcn-in (semantic-current-tag)))
51
52 (should temp)
53 ;; (error "No templates for function comments")
54
55 ;; Try to figure out the tag we want to use.
56 (should fcn-in)
57 (should (semantic-tag-of-class-p fcn-in 'function))
58 ;; (error "No tag of class 'function to insert comment for")
59
60 (let ((lextok (semantic-documentation-comment-preceding-tag fcn-in 'lex)))
61
62 (should lextok)
63 ;; (error "No comment to attempt an extraction")
64
65 (let ((s (semantic-lex-token-start lextok))
66 (e (semantic-lex-token-end lextok))
67 (extract nil))
68
69 (pulse-momentary-highlight-region s e)
70
71 ;; Extract text from the existing comment.
72 (setq extract (srecode-extract temp s e))
73
74 (with-output-to-temp-buffer "*SRECODE DUMP*"
75 (princ "EXTRACTED DICTIONARY FOR ")
76 (princ (semantic-tag-name fcn-in))
77 (princ "\n--------------------------------------------\n")
78 (srecode-dump extract))))))
79
80;;; document-tests.el ends here
diff --git a/test/manual/cedet/srecode-tests.el b/test/lisp/cedet/srecode/fields-tests.el
index ebc3261f817..5f634a5e4ce 100644
--- a/test/manual/cedet/srecode-tests.el
+++ b/test/lisp/cedet/srecode/fields-tests.el
@@ -1,4 +1,4 @@
1;;; srecode-tests.el --- Some tests for CEDET's srecode 1;;; srecode/fields-tests.el --- Tests for srecode/fields.el -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2008-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
4 4
@@ -21,13 +21,15 @@
21 21
22;;; Commentary: 22;;; Commentary:
23 23
24;; Extracted from srecode-fields.el and srecode-document.el in the 24;; Extracted from srecode-fields.el in the CEDET distribution.
25;; CEDET distribution. 25
26;; Converted to ert from test/manual/cedet/srecode-tests.el
26 27
27;;; Code: 28;;; Code:
28 29
29;;; From srecode-fields: 30;;; From srecode-fields:
30 31
32(require 'ert)
31(require 'srecode/fields) 33(require 'srecode/fields)
32 34
33(defvar srecode-field-utest-text 35(defvar srecode-field-utest-text
@@ -36,13 +38,10 @@
36It is filled with some text." 38It is filled with some text."
37 "Text for tests.") 39 "Text for tests.")
38 40
39(defun srecode-field-utest () 41;; FIXME: This test fails even before conversion to ert.
40 "Test the srecode field manager." 42(ert-deftest srecode-field-utest-impl ()
41 (interactive)
42 (srecode-field-utest-impl))
43
44(defun srecode-field-utest-impl ()
45 "Implementation of the SRecode field utest." 43 "Implementation of the SRecode field utest."
44 :tags '(:unstable)
46 (save-excursion 45 (save-excursion
47 (find-file "/tmp/srecode-field-test.txt") 46 (find-file "/tmp/srecode-field-test.txt")
48 47
@@ -131,15 +130,15 @@ It is filled with some text."
131 130
132 ;; Various sizes 131 ;; Various sizes
133 (mapc (lambda (T) 132 (mapc (lambda (T)
134 (if (string= (object-name-string T) "Test4") 133 (if (string= (eieio-object-name-string T) "Test4")
135 (progn 134 (progn
136 (when (not (srecode-empty-region-p T)) 135 (when (not (srecode-empty-region-p T))
137 (error "Field %s is not empty" 136 (error "Field %s is not empty"
138 (object-name T))) 137 (eieio-object-name T)))
139 ) 138 )
140 (when (not (= (srecode-region-size T) 5)) 139 (when (not (= (srecode-region-size T) 5))
141 (error "Calculated size of %s was not 5" 140 (error "Calculated size of %s was not 5"
142 (object-name T))))) 141 (eieio-object-name T)))))
143 fields) 142 fields)
144 143
145 ;; Make sure things stay up after a 'command'. 144 ;; Make sure things stay up after a 'command'.
@@ -151,21 +150,21 @@ It is filled with some text."
151 (when (not (eq (srecode-overlaid-at-point 'srecode-field) 150 (when (not (eq (srecode-overlaid-at-point 'srecode-field)
152 (nth 0 fields))) 151 (nth 0 fields)))
153 (error "Region Test: Field %s not under point" 152 (error "Region Test: Field %s not under point"
154 (object-name (nth 0 fields)))) 153 (eieio-object-name (nth 0 fields))))
155 154
156 (srecode-field-next) 155 (srecode-field-next)
157 156
158 (when (not (eq (srecode-overlaid-at-point 'srecode-field) 157 (when (not (eq (srecode-overlaid-at-point 'srecode-field)
159 (nth 1 fields))) 158 (nth 1 fields)))
160 (error "Region Test: Field %s not under point" 159 (error "Region Test: Field %s not under point"
161 (object-name (nth 1 fields)))) 160 (eieio-object-name (nth 1 fields))))
162 161
163 (srecode-field-prev) 162 (srecode-field-prev)
164 163
165 (when (not (eq (srecode-overlaid-at-point 'srecode-field) 164 (when (not (eq (srecode-overlaid-at-point 'srecode-field)
166 (nth 0 fields))) 165 (nth 0 fields)))
167 (error "Region Test: Field %s not under point" 166 (error "Region Test: Field %s not under point"
168 (object-name (nth 0 fields)))) 167 (eieio-object-name (nth 0 fields))))
169 168
170 ;; Move cursor out of the region and have everything cleaned up. 169 ;; Move cursor out of the region and have everything cleaned up.
171 (goto-char 42) 170 (goto-char 42)
@@ -176,7 +175,7 @@ It is filled with some text."
176 (mapc (lambda (T) 175 (mapc (lambda (T)
177 (when (slot-boundp T 'overlay) 176 (when (slot-boundp T 'overlay)
178 (error "Overlay did not clear off of field %s" 177 (error "Overlay did not clear off of field %s"
179 (object-name T)))) 178 (eieio-object-name T))))
180 fields) 179 fields)
181 180
182 ;; End of LET 181 ;; End of LET
@@ -187,8 +186,7 @@ It is filled with some text."
187 (f1 (srecode-field "Test1" :name "TEST" :start 6 :end 8)) 186 (f1 (srecode-field "Test1" :name "TEST" :start 6 :end 8))
188 (f2 (srecode-field "Test2" :name "TEST" :start 28 :end 30)) 187 (f2 (srecode-field "Test2" :name "TEST" :start 28 :end 30))
189 (f3 (srecode-field "Test3" :name "NOTTEST" :start 35 :end 40)) 188 (f3 (srecode-field "Test3" :name "NOTTEST" :start 35 :end 40))
190 (reg (srecode-template-inserted-region "REG" :start 4 :end 40)) 189 (reg (srecode-template-inserted-region "REG" :start 4 :end 40)))
191 )
192 (srecode-overlaid-activate reg) 190 (srecode-overlaid-activate reg)
193 191
194 (when (not (string= (srecode-overlaid-text f1) 192 (when (not (string= (srecode-overlaid-text f1)
@@ -233,62 +231,8 @@ It is filled with some text."
233 (error "Linkage Test: tail-insert string on dissimilar fields is now the same")) 231 (error "Linkage Test: tail-insert string on dissimilar fields is now the same"))
234 232
235 ;; Cleanup 233 ;; Cleanup
236 (srecode-delete reg) 234 (srecode-delete reg))
237 )
238
239 (set-buffer-modified-p nil)
240
241 (message " All field tests passed.")
242 ))
243
244;;; From srecode-document:
245
246(require 'srecode/document)
247
248(defun srecode-document-function-comment-extract-test ()
249 "Test old comment extraction.
250Dump out the extracted dictionary."
251 (interactive)
252
253 (srecode-load-tables-for-mode major-mode)
254 (srecode-load-tables-for-mode major-mode 'document)
255
256 (if (not (srecode-table))
257 (error "No template table found for mode %s" major-mode))
258
259 (let* ((temp (srecode-template-get-table (srecode-table)
260 "function-comment"
261 "declaration"
262 'document))
263 (fcn-in (semantic-current-tag)))
264
265 (if (not temp)
266 (error "No templates for function comments"))
267
268 ;; Try to figure out the tag we want to use.
269 (when (or (not fcn-in)
270 (not (semantic-tag-of-class-p fcn-in 'function)))
271 (error "No tag of class 'function to insert comment for"))
272
273 (let ((lextok (semantic-documentation-comment-preceding-tag fcn-in 'lex))
274 )
275
276 (when (not lextok)
277 (error "No comment to attempt an extraction"))
278
279 (let ((s (semantic-lex-token-start lextok))
280 (e (semantic-lex-token-end lextok))
281 (extract nil))
282
283 (pulse-momentary-highlight-region s e)
284
285 ;; Extract text from the existing comment.
286 (setq extract (srecode-extract temp s e))
287 235
288 (with-output-to-temp-buffer "*SRECODE DUMP*" 236 (set-buffer-modified-p nil)))
289 (princ "EXTRACTED DICTIONARY FOR ")
290 (princ (semantic-tag-name fcn-in))
291 (princ "\n--------------------------------------------\n")
292 (srecode-dump extract))))))
293 237
294;;; srecode-tests.el ends here 238;;; srecode/fields-tests.el ends here
diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el
index 95f62e0d7ea..97b3349000c 100644
--- a/test/lisp/cus-edit-tests.el
+++ b/test/lisp/cus-edit-tests.el
@@ -53,9 +53,9 @@
53 (customize-apropos "cus-edit-tests") 53 (customize-apropos "cus-edit-tests")
54 (should-not (search-forward cus-edit-tests--obsolete-option-tag nil t)))) 54 (should-not (search-forward cus-edit-tests--obsolete-option-tag nil t))))
55 55
56(ert-deftest cus-edit-tests-customize-changed-options/hide-obsolete () 56(ert-deftest cus-edit-tests-customize-changed/hide-obsolete ()
57 (with-cus-edit-test "*Customize Changed Options*" 57 (with-cus-edit-test "*Customize Changed Options*"
58 (customize-changed-options "917.2") ; some future version 58 (customize-changed "917.2") ;; Some future version.
59 (should-not (search-forward cus-edit-tests--obsolete-option-tag nil t)))) 59 (should-not (search-forward cus-edit-tests--obsolete-option-tag nil t))))
60 60
61(ert-deftest cus-edit-tests-customize-group/hide-obsolete () 61(ert-deftest cus-edit-tests-customize-group/hide-obsolete ()
diff --git a/test/lisp/dom-tests.el b/test/lisp/dom-tests.el
index dbe3a15dac1..0a0d783b824 100644
--- a/test/lisp/dom-tests.el
+++ b/test/lisp/dom-tests.el
@@ -5,6 +5,8 @@
5;; Author: Simen Heggestøyl <simenheg@gmail.com> 5;; Author: Simen Heggestøyl <simenheg@gmail.com>
6;; Keywords: 6;; Keywords:
7 7
8;; This file is part of GNU Emacs.
9
8;; GNU Emacs is free software: you can redistribute it and/or modify 10;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 11;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or 12;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 980b402ca2d..0b70c11b298 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -32,6 +32,15 @@
32(require 'bytecomp) 32(require 'bytecomp)
33 33
34;;; Code: 34;;; Code:
35(defvar bytecomp-test-var nil)
36
37(defun bytecomp-test-get-var ()
38 bytecomp-test-var)
39
40(defun bytecomp-test-identity (x)
41 "Identity, but hidden from some optimisations."
42 x)
43
35(defconst byte-opt-testsuite-arith-data 44(defconst byte-opt-testsuite-arith-data
36 '( 45 '(
37 ;; some functional tests 46 ;; some functional tests
@@ -371,7 +380,57 @@
371 (assoc 'b '((a 1) (b 2) (c 3))) 380 (assoc 'b '((a 1) (b 2) (c 3)))
372 (assoc "b" '(("a" 1) ("b" 2) ("c" 3))) 381 (assoc "b" '(("a" 1) ("b" 2) ("c" 3)))
373 (let ((x '((a 1) (b 2) (c 3)))) (assoc 'c x)) 382 (let ((x '((a 1) (b 2) (c 3)))) (assoc 'c x))
374 (assoc 'a '((a 1) (b 2) (c 3)) (lambda (u v) (not (equal u v))))) 383 (assoc 'a '((a 1) (b 2) (c 3)) (lambda (u v) (not (equal u v))))
384
385 ;; Constprop test cases
386 (let ((a 'alpha) (b (concat "be" "ta")) (c nil) (d t) (e :gamma)
387 (f '(delta epsilon)))
388 (list a b c d e f))
389
390 (let ((x 1) (y (+ 3 4)))
391 (list
392 (let (q (y x) (z y))
393 (if q x (list x y z)))))
394
395 (let* ((x 3) (y (* x 2)) (x (1+ y)))
396 x)
397
398 (let ((x 1) (bytecomp-test-var 2) (y 3))
399 (list x bytecomp-test-var (bytecomp-get-test-var) y))
400
401 (progn
402 (defvar d)
403 (let ((x 'a) (y 'b)) (list x y)))
404
405 (let ((x 2))
406 (list x (setq x 13) (setq x (* x 2)) x))
407
408 (let ((x 'a) (y 'b))
409 (setq y x
410 x (cons 'c y)
411 y x)
412 (list x y))
413
414 (let ((x 3))
415 (let ((y x) z)
416 (setq x 5)
417 (setq y (+ y 8))
418 (setq z (if (bytecomp-test-identity t)
419 (progn
420 (setq x (+ x 1))
421 (list x y))
422 (setq x (+ x 2))
423 (list x y)))
424 (list x y z)))
425
426 (let ((i 1) (s 0) (x 13))
427 (while (< i 5)
428 (setq s (+ s i))
429 (setq i (1+ i)))
430 (list s x i))
431
432 (let ((x 2))
433 (list (or (bytecomp-identity 'a) (setq x 3)) x)))
375 "List of expression for test. 434 "List of expression for test.
376Each element will be executed by interpreter and with 435Each element will be executed by interpreter and with
377bytecompiled code, and their results compared.") 436bytecompiled code, and their results compared.")
@@ -1109,6 +1168,37 @@ mountpoint (Bug#44631)."
1109 (with-demoted-errors "Error cleaning up directory: %s" 1168 (with-demoted-errors "Error cleaning up directory: %s"
1110 (delete-directory directory :recursive))))) 1169 (delete-directory directory :recursive)))))
1111 1170
1171(defun bytecomp-tests--get-vars ()
1172 (list (ignore-errors (symbol-value 'bytecomp-tests--var1))
1173 (ignore-errors (symbol-value 'bytecomp-tests--var2))))
1174
1175(ert-deftest bytecomp-local-defvar ()
1176 "Check that local `defvar' declarations work correctly, both
1177interpreted and compiled."
1178 (let ((lexical-binding t))
1179 (let ((fun '(lambda ()
1180 (defvar bytecomp-tests--var1)
1181 (let ((bytecomp-tests--var1 'a) ; dynamic
1182 (bytecomp-tests--var2 'b)) ; still lexical
1183 (ignore bytecomp-tests--var2) ; avoid warning
1184 (bytecomp-tests--get-vars)))))
1185 (should (listp fun)) ; Guard against overzealous refactoring!
1186 (should (equal (funcall (eval fun t)) '(a nil)))
1187 (should (equal (funcall (byte-compile fun)) '(a nil)))
1188 )
1189
1190 ;; `progn' does not constitute a lexical scope for `defvar' (bug#46387).
1191 (let ((fun '(lambda ()
1192 (progn
1193 (defvar bytecomp-tests--var1)
1194 (defvar bytecomp-tests--var2))
1195 (let ((bytecomp-tests--var1 'c)
1196 (bytecomp-tests--var2 'd))
1197 (bytecomp-tests--get-vars)))))
1198 (should (listp fun))
1199 (should (equal (funcall (eval fun t)) '(c d)))
1200 (should (equal (funcall (byte-compile fun)) '(c d))))))
1201
1112;; Local Variables: 1202;; Local Variables:
1113;; no-byte-compile: t 1203;; no-byte-compile: t
1114;; End: 1204;; End:
diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el
index f3c308725ac..91f0a1e2014 100644
--- a/test/lisp/emacs-lisp/cl-extra-tests.el
+++ b/test/lisp/emacs-lisp/cl-extra-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Code: 20;;; Code:
21 21
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el
index 065ca4fa651..a5ec62b9c42 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el
index bcd63f73a3c..2e5f3020b41 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
index a3010f9e354..f8ca39c8c6e 100644
--- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
+++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
@@ -6,18 +6,18 @@
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
9;; This program is free software: you can redistribute it and/or 9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; modify it under the terms of the GNU General Public License as 10;; it under the terms of the GNU General Public License as published by
11;; published by the Free Software Foundation, either version 3 of the 11;; the Free Software Foundation, either version 3 of the License, or
12;; License, or (at your option) any later version. 12;; (at your option) any later version.
13;; 13
14;; This program is distributed in the hope that it will be useful, but 14;; GNU Emacs is distributed in the hope that it will be useful,
15;; WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; General Public License for more details. 17;; GNU General Public License for more details.
18;; 18
19;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
20;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Commentary: 22;;; Commentary:
23 23
diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el
index d60a6cb3d50..6a6080df3c8 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -6,18 +6,18 @@
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
9;; This program is free software: you can redistribute it and/or 9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; modify it under the terms of the GNU General Public License as 10;; it under the terms of the GNU General Public License as published by
11;; published by the Free Software Foundation, either version 3 of the 11;; the Free Software Foundation, either version 3 of the License, or
12;; License, or (at your option) any later version. 12;; (at your option) any later version.
13;; 13
14;; This program is distributed in the hope that it will be useful, but 14;; GNU Emacs is distributed in the hope that it will be useful,
15;; WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; General Public License for more details. 17;; GNU General Public License for more details.
18;; 18
19;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
20;; along with this program. If not, see <https://www.gnu.org/licenses/>. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Commentary: 22;;; Commentary:
23 23
diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el
index 40cb432708e..bdacb0832b3 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -6,18 +6,18 @@
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
9;; This program is free software: you can redistribute it and/or 9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; modify it under the terms of the GNU General Public License as 10;; it under the terms of the GNU General Public License as published by
11;; published by the Free Software Foundation, either version 3 of the 11;; the Free Software Foundation, either version 3 of the License, or
12;; License, or (at your option) any later version. 12;; (at your option) any later version.
13;; 13
14;; This program is distributed in the hope that it will be useful, but 14;; GNU Emacs is distributed in the hope that it will be useful,
15;; WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; General Public License for more details. 17;; GNU General Public License for more details.
18;; 18
19;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
20;; along with this program. If not, see `https://www.gnu.org/licenses/'. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Commentary: 22;;; Commentary:
23 23
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el
index f46fa63e4ce..9f40a18d343 100644
--- a/test/lisp/emacs-lisp/ert-x-tests.el
+++ b/test/lisp/emacs-lisp/ert-x-tests.el
@@ -7,18 +7,18 @@
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
10;; This program is free software: you can redistribute it and/or 10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; modify it under the terms of the GNU General Public License as 11;; it under the terms of the GNU General Public License as published by
12;; published by the Free Software Foundation, either version 3 of the 12;; the Free Software Foundation, either version 3 of the License, or
13;; License, or (at your option) any later version. 13;; (at your option) any later version.
14;; 14
15;; This program is distributed in the hope that it will be useful, but 15;; GNU Emacs is distributed in the hope that it will be useful,
16;; WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; General Public License for more details. 18;; GNU General Public License for more details.
19;; 19
20;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
21;; along with this program. If not, see `https://www.gnu.org/licenses/'. 21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22 22
23;;; Commentary: 23;;; Commentary:
24 24
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 85db3a00c8e..e2cecdf6b01 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -2,6 +2,8 @@
2 2
3;; Copyright (C) 2017-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2017-2021 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs.
6
5;; GNU Emacs is free software: you can redistribute it and/or modify 7;; GNU Emacs is free software: you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation, either version 3 of the License, or 9;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el
index fd07011137a..78ecf3ff03d 100644
--- a/test/lisp/emacs-lisp/lisp-tests.el
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -8,6 +8,8 @@
8;; Author: Marcin Borkowski <mbork@mbork.pl> 8;; Author: Marcin Borkowski <mbork@mbork.pl>
9;; Keywords: internal 9;; Keywords: internal
10 10
11;; This file is part of GNU Emacs.
12
11;; GNU Emacs is free software: you can redistribute it and/or modify 13;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by 14;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or 15;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el b/test/lisp/emacs-lisp/testcover-resources/testcases.el
index 5dbf2272b1a..7ced257c6f9 100644
--- a/test/lisp/emacs-lisp/testcover-resources/testcases.el
+++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el
@@ -6,18 +6,18 @@
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
9;; This program is free software: you can redistribute it and/or 9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; modify it under the terms of the GNU General Public License as 10;; it under the terms of the GNU General Public License as published by
11;; published by the Free Software Foundation, either version 3 of the 11;; the Free Software Foundation, either version 3 of the License, or
12;; License, or (at your option) any later version. 12;; (at your option) any later version.
13;; 13
14;; This program is distributed in the hope that it will be useful, but 14;; GNU Emacs is distributed in the hope that it will be useful,
15;; WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; General Public License for more details. 17;; GNU General Public License for more details.
18;; 18
19;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
20;; along with this program. If not, see `https://www.gnu.org/licenses/'. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Commentary: 22;;; Commentary:
23 23
diff --git a/test/lisp/emacs-lisp/testcover-tests.el b/test/lisp/emacs-lisp/testcover-tests.el
index 9f0312d85ff..7854e33e77d 100644
--- a/test/lisp/emacs-lisp/testcover-tests.el
+++ b/test/lisp/emacs-lisp/testcover-tests.el
@@ -6,18 +6,18 @@
6 6
7;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
8 8
9;; This program is free software: you can redistribute it and/or 9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; modify it under the terms of the GNU General Public License as 10;; it under the terms of the GNU General Public License as published by
11;; published by the Free Software Foundation, either version 3 of the 11;; the Free Software Foundation, either version 3 of the License, or
12;; License, or (at your option) any later version. 12;; (at your option) any later version.
13;; 13
14;; This program is distributed in the hope that it will be useful, but 14;; GNU Emacs is distributed in the hope that it will be useful,
15;; WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; General Public License for more details. 17;; GNU General Public License for more details.
18;; 18
19;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
20;; along with this program. If not, see `https://www.gnu.org/licenses/'. 20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21 21
22;;; Commentary: 22;;; Commentary:
23 23
diff --git a/test/lisp/gnus/gnus-search-tests.el b/test/lisp/gnus/gnus-search-tests.el
index 63469f8d518..e30ed9a80a7 100644
--- a/test/lisp/gnus/gnus-search-tests.el
+++ b/test/lisp/gnus/gnus-search-tests.el
@@ -5,18 +5,20 @@
5;; Author: Eric Abrahamsen <eric@ericabrahamsen.net> 5;; Author: Eric Abrahamsen <eric@ericabrahamsen.net>
6;; Keywords: 6;; Keywords:
7 7
8;; This program is free software; you can redistribute it and/or modify 8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 11;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or 12;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version. 13;; (at your option) any later version.
12 14
13;; This program is distributed in the hope that it will be useful, 15;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details. 18;; GNU General Public License for more details.
17 19
18;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>. 21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
20 22
21;;; Commentary: 23;;; Commentary:
22 24
diff --git a/test/lisp/gnus/gnus-util-tests.el b/test/lisp/gnus/gnus-util-tests.el
index 7f64b96303f..959be7987d3 100644
--- a/test/lisp/gnus/gnus-util-tests.el
+++ b/test/lisp/gnus/gnus-util-tests.el
@@ -3,12 +3,12 @@
3 3
4;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org> 4;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org>
5 5
6;; This file is not part of GNU Emacs. 6;; This file is part of GNU Emacs.
7 7
8;; GNU Emacs is free software; you can redistribute it and/or modify 8;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 3, or (at your option) 10;; the Free Software Foundation, either version 3 of the License, or
11;; any later version. 11;; (at your option) any later version.
12 12
13;; GNU Emacs is distributed in the hope that it will be useful, 13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el
index 7d059cb3f87..586097aaf31 100644
--- a/test/lisp/gnus/mm-decode-tests.el
+++ b/test/lisp/gnus/mm-decode-tests.el
@@ -4,10 +4,10 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; GNU Emacs is free software; you can redistribute it and/or modify 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 8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 3, or (at your option) 9;; the Free Software Foundation, either version 3 of the License, or
10;; any later version. 10;; (at your option) any later version.
11 11
12;; GNU Emacs is distributed in the hope that it will be useful, 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el
index b743187030f..a7ed7d3975b 100644
--- a/test/lisp/gnus/mml-sec-tests.el
+++ b/test/lisp/gnus/mml-sec-tests.el
@@ -1,14 +1,15 @@
1;;; mml-sec-tests.el --- Tests mml-sec.el, see README-mml-secure.txt. -*- lexical-binding:t -*- 1;;; mml-sec-tests.el --- Tests mml-sec.el, see README-mml-secure.txt. -*- lexical-binding:t -*-
2
2;; Copyright (C) 2015, 2020-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2015, 2020-2021 Free Software Foundation, Inc.
3 4
4;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org> 5;; Author: Jens Lechtenbörger <jens.lechtenboerger@fsfe.org>
5 6
6;; This file is not part of GNU Emacs. 7;; This file is part of GNU Emacs.
7 8
8;; GNU Emacs is free software; you can redistribute it and/or modify 9;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 3, or (at your option) 11;; the Free Software Foundation, either version 3 of the License, or
11;; any later version. 12;; (at your option) any later version.
12 13
13;; GNU Emacs is distributed in the hope that it will be useful, 14;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/test/lisp/mail/mail-utils-tests.el b/test/lisp/mail/mail-utils-tests.el
new file mode 100644
index 00000000000..5b54f2440c7
--- /dev/null
+++ b/test/lisp/mail/mail-utils-tests.el
@@ -0,0 +1,104 @@
1;;; mail-utils-tests.el --- tests for mail-utils.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; Author: Stefan Kangas <stefankangas@gmail.com>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;;; Code:
25
26(require 'ert)
27(require 'sasl)
28(require 'mail-utils)
29
30(ert-deftest mail-utils-tests-mail-quote-printable ()
31 (should (equal (mail-quote-printable "abc") "abc"))
32 (should (equal (mail-quote-printable "åäö") "=E5=E4=F6"))
33 (should (equal (mail-quote-printable "åäö" t) "=?ISO-8859-1?Q?=E5=E4=F6?=")))
34
35(ert-deftest mail-utils-tests-mail-quote-printable-region ()
36 (with-temp-buffer
37 (insert "?=\"\"")
38 (mail-quote-printable-region (point-min) (point-max))
39 (should (equal (buffer-string) "=3F=3D=22=22")))
40 (with-temp-buffer
41 (insert "x")
42 (mail-quote-printable-region (point-min) (point-max) t)
43 (should (equal (buffer-string) "=?=?ISO-8859-1?Q?x"))))
44
45(ert-deftest mail-utils-tests-mail-unquote-printable ()
46 (should (equal (mail-unquote-printable "=E5=E4=F6") "åäö"))
47 (should (equal (mail-unquote-printable "=?ISO-8859-1?Q?=E5=E4=F6?=" t) "åäö")))
48
49(ert-deftest mail-utils-tests-mail-unquote-printable-region ()
50 (with-temp-buffer
51 (insert "=E5=E4=F6")
52 (mail-unquote-printable-region (point-min) (point-max))
53 (should (equal (buffer-string) "åäö")))
54 (with-temp-buffer
55 (insert "=?ISO-8859-1?Q?=E5=E4=F6?=")
56 (mail-unquote-printable-region (point-min) (point-max) t)
57 (should (equal (buffer-string) "åäö"))))
58
59(ert-deftest mail-utils-tests-mail-strip-quoted-names ()
60 (should (equal (mail-strip-quoted-names
61 "\"foo\" <foo@example.org>, bar@example.org")
62 "foo@example.org, bar@example.org")))
63
64(ert-deftest mail-utils-tests-mail-dont-reply-to ()
65 (let ((mail-dont-reply-to-names "foo@example.org"))
66 (should (equal (mail-dont-reply-to "foo@example.org, bar@example.org")
67 "bar@example.org"))))
68
69
70(ert-deftest mail-utils-tests-mail-fetch-field ()
71 (with-temp-buffer
72 (insert "Foo: bar\nBaz: zut")
73 (should (equal (mail-fetch-field "Foo") "bar"))))
74
75(ert-deftest mail-utils-tests-mail-parse-comma-list ()
76 (with-temp-buffer
77 (insert "foo@example.org,bar@example.org,baz@example.org")
78 (goto-char (point-min))
79 (should (equal (mail-parse-comma-list)
80 '("baz@example.org" "bar@example.org" "foo@example.org")))))
81
82(ert-deftest mail-utils-tests-mail-comma-list-regexp ()
83 (should (equal (mail-comma-list-regexp
84 "foo@example.org,bar@example.org,baz@example.org")
85 "foo@example.org\\|bar@example.org\\|baz@example.org")))
86
87(ert-deftest mail-utils-tests-mail-rfc822-time-zone ()
88 (should (stringp (mail-rfc822-time-zone (current-time)))))
89
90(ert-deftest mail-utils-test-mail-rfc822-date/contains-year ()
91 (should (string-match (rx " 20" digit digit " ")
92 (mail-rfc822-date))))
93
94(ert-deftest mail-utils-test-mail-mbox-from ()
95 (with-temp-buffer
96 (insert "Subject: Hello
97From: jrh@example.org
98To: emacs-devel@gnu.org
99Date: Sun, 07 Feb 2021 22:46:37 -0500")
100 (should (equal (mail-mbox-from)
101 "From jrh@example.org Sun Feb 7 22:46:37 2021\n"))))
102
103(provide 'mail-utils-tests)
104;;; mail-utils-tests.el ends here
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 3ebca14a284..7349b191caf 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -1,4 +1,4 @@
1;;; completion-tests.el --- Tests for completion functions -*- lexical-binding: t; -*- 1;;; minibuffer-tests.el --- Tests for completion functions -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2013-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2013-2021 Free Software Foundation, Inc.
4 4
@@ -107,5 +107,23 @@
107 nil (length input)) 107 nil (length input))
108 (cons output (length output))))))) 108 (cons output (length output)))))))
109 109
110(provide 'completion-tests) 110(ert-deftest completion--insert-strings-faces ()
111;;; completion-tests.el ends here 111 (with-temp-buffer
112 (completion--insert-strings
113 '(("completion1" "suffix1")))
114 (should (equal (get-text-property 12 'face) '(completions-annotations))))
115 (with-temp-buffer
116 (completion--insert-strings
117 '(("completion1" #("suffix1" 0 7 (face shadow)))))
118 (should (equal (get-text-property 12 'face) 'shadow)))
119 (with-temp-buffer
120 (completion--insert-strings
121 '(("completion1" "prefix1" "suffix1")))
122 (should (equal (get-text-property 19 'face) nil)))
123 (with-temp-buffer
124 (completion--insert-strings
125 '(("completion1" "prefix1" #("suffix1" 0 7 (face shadow)))))
126 (should (equal (get-text-property 19 'face) 'shadow))))
127
128(provide 'minibuffer-tests)
129;;; minibuffer-tests.el ends here
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index 34a2af188f0..53c786ada48 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -465,6 +465,14 @@
465 (should (eq (dbus-unregister-service bus dbus--test-service) :non-existent)) 465 (should (eq (dbus-unregister-service bus dbus--test-service) :non-existent))
466 (should-not (member dbus--test-service (dbus-list-known-names bus))) 466 (should-not (member dbus--test-service (dbus-list-known-names bus)))
467 467
468 ;; A service name is a string, constructed of at least two words
469 ;; separated by ".".
470 (should
471 (equal
472 (butlast
473 (should-error (dbus-register-service bus "s")))
474 `(dbus-error ,dbus-error-invalid-args)))
475
468 ;; `dbus-service-dbus' is reserved for the BUS itself. 476 ;; `dbus-service-dbus' is reserved for the BUS itself.
469 (should 477 (should
470 (equal 478 (equal
diff --git a/test/lisp/net/sasl-scram-rfc-tests.el b/test/lisp/net/sasl-scram-rfc-tests.el
index 3e9879a49d4..dfd4cf0e7ac 100644
--- a/test/lisp/net/sasl-scram-rfc-tests.el
+++ b/test/lisp/net/sasl-scram-rfc-tests.el
@@ -4,6 +4,8 @@
4 4
5;; Author: Magnus Henoch <magnus.henoch@gmail.com> 5;; Author: Magnus Henoch <magnus.henoch@gmail.com>
6 6
7;; This file is part of GNU Emacs.
8
7;; GNU Emacs is free software: you can redistribute it and/or modify 9;; 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 10;; 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 11;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 19a40fdf06c..f4883923f6a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -5739,6 +5739,11 @@ This does not support globbing characters in file names (yet)."
5739 (string-match-p 5739 (string-match-p
5740 "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))) 5740 "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))
5741 5741
5742(defun tramp--test-gdrive-p ()
5743 "Check, whether the gdrive method is used."
5744 (string-equal
5745 "gdrive" (file-remote-p tramp-test-temporary-file-directory 'method)))
5746
5742(defun tramp--test-gvfs-p (&optional method) 5747(defun tramp--test-gvfs-p (&optional method)
5743 "Check, whether the remote host runs a GVFS based method. 5748 "Check, whether the remote host runs a GVFS based method.
5744This requires restrictions of file name syntax. 5749This requires restrictions of file name syntax.
@@ -5769,11 +5774,6 @@ This does not support external Emacs calls."
5769 (string-equal 5774 (string-equal
5770 "mock" (file-remote-p tramp-test-temporary-file-directory 'method))) 5775 "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))
5771 5776
5772(defun tramp--test-nextcloud-p ()
5773 "Check, whether the nextcloud method is used."
5774 (string-equal
5775 "nextcloud" (file-remote-p tramp-test-temporary-file-directory 'method)))
5776
5777(defun tramp--test-rclone-p () 5777(defun tramp--test-rclone-p ()
5778 "Check, whether the remote host is offered by rclone. 5778 "Check, whether the remote host is offered by rclone.
5779This requires restrictions of file name syntax." 5779This requires restrictions of file name syntax."
@@ -6144,7 +6144,6 @@ Use the `ls' command."
6144 (skip-unless (tramp--test-enabled)) 6144 (skip-unless (tramp--test-enabled))
6145 (skip-unless (tramp--test-sh-p)) 6145 (skip-unless (tramp--test-sh-p))
6146 (skip-unless (not (tramp--test-rsync-p))) 6146 (skip-unless (not (tramp--test-rsync-p)))
6147 (skip-unless (not (tramp--test-windows-nt-and-batch-p)))
6148 (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) 6147 (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
6149 (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) 6148 (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
6150 6149
@@ -6214,6 +6213,7 @@ Use the `ls' command."
6214 (skip-unless (not (tramp--test-windows-nt-and-batch-p))) 6213 (skip-unless (not (tramp--test-windows-nt-and-batch-p)))
6215 (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) 6214 (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
6216 (skip-unless (not (tramp--test-ksh-p))) 6215 (skip-unless (not (tramp--test-ksh-p)))
6216 (skip-unless (not (tramp--test-gdrive-p)))
6217 (skip-unless (not (tramp--test-crypt-p))) 6217 (skip-unless (not (tramp--test-crypt-p)))
6218 (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p)))) 6218 (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
6219 6219
@@ -6747,8 +6747,6 @@ If INTERACTIVE is non-nil, the tests are run interactively."
6747;; * Work on skipped tests. Make a comment, when it is impossible. 6747;; * Work on skipped tests. Make a comment, when it is impossible.
6748;; * Revisit expensive tests, once problems in `tramp-error' are solved. 6748;; * Revisit expensive tests, once problems in `tramp-error' are solved.
6749;; * Fix `tramp-test06-directory-file-name' for `ftp'. 6749;; * Fix `tramp-test06-directory-file-name' for `ftp'.
6750;; * Investigate, why `tramp-test11-copy-file' and `tramp-test12-rename-file'
6751;; do not work properly for `nextcloud'.
6752;; * Implement `tramp-test31-interrupt-process' for `adb' and for 6750;; * Implement `tramp-test31-interrupt-process' for `adb' and for
6753;; direct async processes. 6751;; direct async processes.
6754;; * Fix `tramp-test44-threads'. 6752;; * Fix `tramp-test44-threads'.
diff --git a/test/lisp/nxml/nxml-mode-tests.el b/test/lisp/nxml/nxml-mode-tests.el
index 4baab1f7600..7824691333e 100644
--- a/test/lisp/nxml/nxml-mode-tests.el
+++ b/test/lisp/nxml/nxml-mode-tests.el
@@ -2,6 +2,8 @@
2 2
3;; Copyright (C) 2019-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs.
6
5;; GNU Emacs is free software: you can redistribute it and/or modify 7;; GNU Emacs is free software: you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation, either version 3 of the License, or 9;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/nxml/xsd-regexp-tests.el b/test/lisp/nxml/xsd-regexp-tests.el
index 4dbc8999247..2194602dbec 100644
--- a/test/lisp/nxml/xsd-regexp-tests.el
+++ b/test/lisp/nxml/xsd-regexp-tests.el
@@ -2,6 +2,8 @@
2 2
3;; Copyright (C) 2019-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2019-2021 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs.
6
5;; GNU Emacs is free software: you can redistribute it and/or modify 7;; GNU Emacs is free software: you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by 8;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation, either version 3 of the License, or 9;; the Free Software Foundation, either version 3 of the License, or
diff --git a/test/lisp/obsolete/cl-tests.el b/test/lisp/obsolete/cl-tests.el
index 4a5f4f872b6..0e02e1ca1bc 100644
--- a/test/lisp/obsolete/cl-tests.el
+++ b/test/lisp/obsolete/cl-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
diff --git a/test/lisp/play/cookie1-resources/cookies b/test/lisp/play/cookie1-resources/cookies
new file mode 100644
index 00000000000..7bf569fa7d6
--- /dev/null
+++ b/test/lisp/play/cookie1-resources/cookies
@@ -0,0 +1,8 @@
1This fortune intentionally left blank.
2%
3This fortune intentionally not included.
4%
5This fortune intentionally says nothing.
6%
7This fortune is false.
8%
diff --git a/test/lisp/play/cookie1-tests.el b/test/lisp/play/cookie1-tests.el
new file mode 100644
index 00000000000..d63ecb972aa
--- /dev/null
+++ b/test/lisp/play/cookie1-tests.el
@@ -0,0 +1,40 @@
1;;; fortune-tests.el --- Tests for fortune.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2021 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;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'ert-x)
26(require 'cookie1)
27
28(ert-deftest cookie1-tests-cookie ()
29 (let ((fortune-file (ert-resource-file "cookies")))
30 (should (string-match "\\`This fortune"
31 (cookie fortune-file)))))
32
33(ert-deftest cookie1-testss-cookie-apropos ()
34 (let ((fortune-file (ert-resource-file "cookies")))
35 (should (string-match "\\`This fortune"
36 (car (cookie-apropos "false" fortune-file))))
37 (should (= (length (cookie-apropos "false" fortune-file)) 1))))
38
39(provide 'fortune-tests)
40;;; fortune-tests.el ends here
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index 434237cf638..8c698e4fac8 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -108,7 +108,7 @@ foo( # ruby-deep-indent-disabled
108# Multiline regexp. 108# Multiline regexp.
109/bars 109/bars
110 tees # toots 110 tees # toots
111 nfoos/ 111 nfoos::/
112 112
113def test1(arg) 113def test1(arg)
114 puts "hello" 114 puts "hello"
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el
index cf1ed2896e4..e55eb6d901b 100644
--- a/test/lisp/progmodes/tcl-tests.el
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -74,7 +74,6 @@
74 74
75;; From bug#44834 75;; From bug#44834
76(ert-deftest tcl-mode-namespace-indent-2 () 76(ert-deftest tcl-mode-namespace-indent-2 ()
77 :expected-result :failed
78 (with-temp-buffer 77 (with-temp-buffer
79 (tcl-mode) 78 (tcl-mode)
80 (let ((text "namespace eval Foo {\n proc foo {} {}\n\n proc bar {}{}}\n")) 79 (let ((text "namespace eval Foo {\n proc foo {} {}\n\n proc bar {}{}}\n"))
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
index 7b022811a5c..f2ddc2e3fb3 100644
--- a/test/lisp/simple-tests.el
+++ b/test/lisp/simple-tests.el
@@ -48,6 +48,31 @@
48 (should (= (count-words (point-min) (point-max)) 10)))) 48 (should (= (count-words (point-min) (point-max)) 10))))
49 49
50 50
51;;; `count-lines'
52
53(ert-deftest simple-test-count-lines ()
54 (with-temp-buffer
55 (should (= (count-lines (point-min) (point-max)) 0))
56 (insert "foo")
57 (should (= (count-lines (point-min) (point-max)) 1))
58 (insert "\nbar\nbaz\n")
59 (should (= (count-lines (point-min) (point-max)) 3))
60 (insert "r\n")
61 (should (= (count-lines (point-min) (point-max)) 4))))
62
63(ert-deftest simple-test-count-lines/ignore-invisible-lines ()
64 (with-temp-buffer
65 (insert "foo\nbar")
66 (should (= (count-lines (point-min) (point-max) t) 2))
67 (insert (propertize "\nbar\nbaz\nzut" 'invisible t))
68 (should (= (count-lines (point-min) (point-max) t) 2))))
69
70(ert-deftest simple-text-count-lines-non-ascii ()
71 (with-temp-buffer
72 (insert "あ\nい\nう\nえ\nお\n")
73 (should (= (count-lines (point) (point)) 0))))
74
75
51;;; `transpose-sexps' 76;;; `transpose-sexps'
52(defmacro simple-test--transpositions (&rest body) 77(defmacro simple-test--transpositions (&rest body)
53 (declare (indent 0) 78 (declare (indent 0)
diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el
index 694d683d546..92b6cc9177c 100644
--- a/test/lisp/textmodes/dns-mode-tests.el
+++ b/test/lisp/textmodes/dns-mode-tests.el
@@ -25,6 +25,27 @@
25(require 'ert) 25(require 'ert)
26(require 'dns-mode) 26(require 'dns-mode)
27 27
28(ert-deftest dns-mode-tests-dns-mode-soa-increment-serial ()
29 (with-temp-buffer
30 (insert "$TTL 86400
31@ IN SOA ns.icann.org. noc.dns.icann.org. (
32 2015080302 ;Serial
33 7200 ;Refresh
34 3600 ;Retry
35 1209600 ;Expire
36 3600 ;Negative response caching TTL\n)")
37 (dns-mode-soa-increment-serial)
38 ;; Number is updated from 2015080302 to the current date
39 ;; (actually, just ensure the year part is later than 2020).
40 (should (string-match "$TTL 86400
41@ IN SOA ns.icann.org. noc.dns.icann.org. (
42 20[2-9][0-9]+ ;Serial
43 7200 ;Refresh
44 3600 ;Retry
45 1209600 ;Expire
46 3600 ;Negative response caching TTL\n)"
47 (buffer-string)))))
48
28;;; IPv6 reverse zones 49;;; IPv6 reverse zones
29(ert-deftest dns-mode-ipv6-conversion () 50(ert-deftest dns-mode-ipv6-conversion ()
30 (let ((address "2001:db8::42")) 51 (let ((address "2001:db8::42"))
diff --git a/test/manual/cedet/cedet-utests.el b/test/manual/cedet/cedet-utests.el
index 7805fce2d12..e421054102d 100644
--- a/test/manual/cedet/cedet-utests.el
+++ b/test/manual/cedet/cedet-utests.el
@@ -26,7 +26,6 @@
26;; into one command. 26;; into one command.
27 27
28(require 'cedet) 28(require 'cedet)
29(require 'inversion)
30 29
31(defvar cedet-utest-directory 30(defvar cedet-utest-directory
32 (let* ((C (file-name-directory (locate-library "cedet"))) 31 (let* ((C (file-name-directory (locate-library "cedet")))
@@ -36,7 +35,6 @@
36 35
37(defvar cedet-utest-libs '("ede-tests" 36(defvar cedet-utest-libs '("ede-tests"
38 "semantic-tests" 37 "semantic-tests"
39 "srecode-tests"
40 ) 38 )
41 "List of test srcs that need to be loaded.") 39 "List of test srcs that need to be loaded.")
42 40
@@ -48,7 +46,7 @@
48 ;; 46 ;;
49 47
50 ;; Test inversion 48 ;; Test inversion
51 ("inversion" . inversion-unit-test) 49 ;; ("inversion" . inversion-unit-test) ; moved to automated suite
52 50
53 ;; EZ Image dumping. 51 ;; EZ Image dumping.
54 ("ezimage associations" . ezimage-image-association-dump) 52 ("ezimage associations" . ezimage-image-association-dump)
@@ -60,7 +58,7 @@
60 ("pulse interactive test" . (lambda () (pulse-test t))) 58 ("pulse interactive test" . (lambda () (pulse-test t)))
61 59
62 ;; Files 60 ;; Files
63 ("cedet file conversion" . cedet-files-utest) 61 ;; ("cedet file conversion" . cedet-files-utest) ; moved to automated suite
64 62
65 ;; 63 ;;
66 ;; EIEIO 64 ;; EIEIO
@@ -100,14 +98,14 @@
100 (message " ** Skipping test in noninteractive mode.") 98 (message " ** Skipping test in noninteractive mode.")
101 (semantic-test-throw-on-input)))) 99 (semantic-test-throw-on-input))))
102 100
103 ;;("semantic: gcc: output parse test" . semantic-gcc-test-output-parser) 101 ;;("semantic: gcc: output parse test" . semantic-gcc-test-output-parser) ; moved to automated suite
104 102
105 ;; 103 ;;
106 ;; SRECODE 104 ;; SRECODE
107 ;; 105 ;;
108 106
109 ;; TODO - fix the fields test 107 ;; TODO - fix the fields test
110 ;;("srecode: fields" . srecode-field-utest) 108 ;;("srecode: fields" . srecode-field-utest) ; moved to automated suite
111 ;;("srecode: templates" . srecode-utest-template-output) 109 ;;("srecode: templates" . srecode-utest-template-output)
112 ("srecode: show maps" . srecode-get-maps) 110 ("srecode: show maps" . srecode-get-maps)
113 ;;("srecode: getset" . srecode-utest-getset-output) 111 ;;("srecode: getset" . srecode-utest-getset-output)
@@ -376,7 +374,7 @@ Optional argument PRECR indicates to prefix the done msg w/ a newline."
376 (cedet-utest-add-log-item-start testname) 374 (cedet-utest-add-log-item-start testname)
377 )) 375 ))
378 376
379(defun cedet-utest-log(format &rest args) 377(defun cedet-utest-log (format &rest args)
380 "Log the text string FORMAT. 378 "Log the text string FORMAT.
381The rest of the ARGS are used to fill in FORMAT with `format'." 379The rest of the ARGS are used to fill in FORMAT with `format'."
382 (if noninteractive 380 (if noninteractive
@@ -392,99 +390,6 @@ The rest of the ARGS are used to fill in FORMAT with `format'."
392 (cedet-utest-show-log-end) 390 (cedet-utest-show-log-end)
393 ) 391 )
394 392
395;;; Inversion tests
396
397(defun inversion-unit-test ()
398 "Test inversion to make sure it can identify different version strings."
399 (interactive)
400 (let ((c1 (inversion-package-version 'inversion))
401 (c1i (inversion-package-incompatibility-version 'inversion))
402 (c2 (inversion-decode-version "1.3alpha2"))
403 (c3 (inversion-decode-version "1.3beta4"))
404 (c4 (inversion-decode-version "1.3 beta5"))
405 (c5 (inversion-decode-version "1.3.4"))
406 (c6 (inversion-decode-version "2.3alpha"))
407 (c7 (inversion-decode-version "1.3"))
408 (c8 (inversion-decode-version "1.3pre1"))
409 (c9 (inversion-decode-version "2.4 (patch 2)"))
410 (c10 (inversion-decode-version "2.4 (patch 3)"))
411 (c11 (inversion-decode-version "2.4.2.1"))
412 (c12 (inversion-decode-version "2.4.2.2"))
413 )
414 (if (not (and
415 (inversion-= c1 c1)
416 (inversion-< c1i c1)
417 (inversion-< c2 c3)
418 (inversion-< c3 c4)
419 (inversion-< c4 c5)
420 (inversion-< c5 c6)
421 (inversion-< c2 c4)
422 (inversion-< c2 c5)
423 (inversion-< c2 c6)
424 (inversion-< c3 c5)
425 (inversion-< c3 c6)
426 (inversion-< c7 c6)
427 (inversion-< c4 c7)
428 (inversion-< c2 c7)
429 (inversion-< c8 c6)
430 (inversion-< c8 c7)
431 (inversion-< c4 c8)
432 (inversion-< c2 c8)
433 (inversion-< c9 c10)
434 (inversion-< c10 c11)
435 (inversion-< c11 c12)
436 ;; Negatives
437 (not (inversion-< c3 c2))
438 (not (inversion-< c4 c3))
439 (not (inversion-< c5 c4))
440 (not (inversion-< c6 c5))
441 (not (inversion-< c7 c2))
442 (not (inversion-< c7 c8))
443 (not (inversion-< c12 c11))
444 ;; Test the tester on inversion
445 (not (inversion-test 'inversion inversion-version))
446 ;; Test that we throw an error
447 (inversion-test 'inversion "0.0.0")
448 (inversion-test 'inversion "1000.0")
449 ))
450 (error "Inversion tests failed")
451 (message "Inversion tests passed."))))
452
453;;; cedet-files unit test
454
455(defvar cedet-files-utest-list
456 '(
457 ( "/home/me/src/myproj/src/foo.c" . "!home!me!src!myproj!src!foo.c" )
458 ( "c:/work/myproj/foo.el" . "!drive_c!work!myproj!foo.el" )
459 ( "//windows/proj/foo.java" . "!!windows!proj!foo.java" )
460 ( "/home/me/proj!bang/foo.c" . "!home!me!proj!!bang!foo.c" )
461 )
462 "List of different file names to test.
463Each entry is a cons cell of ( FNAME . CONVERTED )
464where FNAME is some file name, and CONVERTED is what it should be
465converted into.")
466
467(defun cedet-files-utest ()
468 "Test out some file name conversions."
469 (interactive)
470 (let ((idx 0))
471 (dolist (FT cedet-files-utest-list)
472
473 (setq idx (+ idx 1))
474
475 (let ((dir->file (cedet-directory-name-to-file-name (car FT) t))
476 (file->dir (cedet-file-name-to-directory-name (cdr FT) t))
477 )
478
479 (unless (string= (cdr FT) dir->file)
480 (error "Failed: %d. Found: %S Wanted: %S"
481 idx dir->file (cdr FT))
482 )
483
484 (unless (string= file->dir (car FT))
485 (error "Failed: %d. Found: %S Wanted: %S"
486 idx file->dir (car FT)))))))
487
488;;; pulse test 393;;; pulse test
489 394
490(defun pulse-test (&optional no-error) 395(defun pulse-test (&optional no-error)
diff --git a/test/manual/cedet/ede-tests.el b/test/manual/cedet/ede-tests.el
index eb3132398a6..2af50860c60 100644
--- a/test/manual/cedet/ede-tests.el
+++ b/test/manual/cedet/ede-tests.el
@@ -1,4 +1,4 @@
1;;; ede-tests.el --- Some tests for the Emacs Development Environment 1;;; ede-tests.el --- Some tests for the Emacs Development Environment -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2008-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2021 Free Software Foundation, Inc.
4 4
@@ -42,8 +42,7 @@ The search is done with the current EDE root."
42 (ede-toplevel))))) 42 (ede-toplevel)))))
43 (data-debug-new-buffer "*EDE Locate ADEBUG*") 43 (data-debug-new-buffer "*EDE Locate ADEBUG*")
44 (ede-locate-file-in-project loc file) 44 (ede-locate-file-in-project loc file)
45 (data-debug-insert-object-slots loc "]")) 45 (data-debug-insert-object-slots loc "]")))
46 )
47 46
48(defun ede-locate-test-global (file) 47(defun ede-locate-test-global (file)
49 "Test EDE Locate on FILE using GNU Global type. 48 "Test EDE Locate on FILE using GNU Global type.
@@ -55,8 +54,7 @@ The search is done with the current EDE root."
55 (ede-toplevel))))) 54 (ede-toplevel)))))
56 (data-debug-new-buffer "*EDE Locate ADEBUG*") 55 (data-debug-new-buffer "*EDE Locate ADEBUG*")
57 (ede-locate-file-in-project loc file) 56 (ede-locate-file-in-project loc file)
58 (data-debug-insert-object-slots loc "]")) 57 (data-debug-insert-object-slots loc "]")))
59 )
60 58
61(defun ede-locate-test-idutils (file) 59(defun ede-locate-test-idutils (file)
62 "Test EDE Locate on FILE using ID Utils type. 60 "Test EDE Locate on FILE using ID Utils type.
@@ -68,8 +66,7 @@ The search is done with the current EDE root."
68 (ede-toplevel))))) 66 (ede-toplevel)))))
69 (data-debug-new-buffer "*EDE Locate ADEBUG*") 67 (data-debug-new-buffer "*EDE Locate ADEBUG*")
70 (ede-locate-file-in-project loc file) 68 (ede-locate-file-in-project loc file)
71 (data-debug-insert-object-slots loc "]")) 69 (data-debug-insert-object-slots loc "]")))
72 )
73 70
74(defun ede-locate-test-cscope (file) 71(defun ede-locate-test-cscope (file)
75 "Test EDE Locate on FILE using CScope type. 72 "Test EDE Locate on FILE using CScope type.
@@ -81,7 +78,6 @@ The search is done with the current EDE root."
81 (ede-toplevel))))) 78 (ede-toplevel)))))
82 (data-debug-new-buffer "*EDE Locate ADEBUG*") 79 (data-debug-new-buffer "*EDE Locate ADEBUG*")
83 (ede-locate-file-in-project loc file) 80 (ede-locate-file-in-project loc file)
84 (data-debug-insert-object-slots loc "]")) 81 (data-debug-insert-object-slots loc "]")))
85 )
86 82
87;;; ede-test.el ends here 83;;; ede-test.el ends here
diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el
index 716bcc7abed..3d72fa2965a 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -138,21 +138,6 @@ Optional argument ARG specifies not to use color."
138 138
139(require 'semantic/fw) 139(require 'semantic/fw)
140 140
141(defun semantic-test-data-cache ()
142 "Test the data cache."
143 (interactive)
144 (let ((data '(a b c)))
145 (save-excursion
146 (set-buffer (get-buffer-create " *semantic-test-data-cache*"))
147 (erase-buffer)
148 (insert "The Moose is Loose")
149 (goto-char (point-min))
150 (semantic-cache-data-to-buffer (current-buffer) (point) (+ (point) 5)
151 data 'moose 'exit-cache-zone)
152 (if (equal (semantic-get-cache-data 'moose) data)
153 (message "Successfully retrieved cached data.")
154 (error "Failed to retrieve cached data")))))
155
156(defun semantic-test-throw-on-input () 141(defun semantic-test-throw-on-input ()
157 "Test that throw on input will work." 142 "Test that throw on input will work."
158 (interactive) 143 (interactive)
@@ -281,110 +266,3 @@ tag that contains point, and return that."
281 Lcount (semantic-tag-name target) 266 Lcount (semantic-tag-name target)
282 (semantic-elapsed-time start nil))) 267 (semantic-elapsed-time start nil)))
283 Lcount))) 268 Lcount)))
284
285;;; From bovine-gcc:
286
287(require 'semantic/bovine/gcc)
288
289;; Example output of "gcc -v"
290(defvar semantic-gcc-test-strings
291 '(;; My old box:
292 "Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
293Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
294Thread model: posix
295gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
296 ;; Alex Ott:
297 "Using built-in specs.
298Target: i486-linux-gnu
299Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.1-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
300Thread model: posix
301gcc version 4.3.1 (Ubuntu 4.3.1-9ubuntu1)"
302 ;; My debian box:
303 "Using built-in specs.
304Target: x86_64-unknown-linux-gnu
305Configured with: ../../../sources/gcc/configure --prefix=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3 --with-gmp=/usr/local/gcc/gmp --with-mpfr=/usr/local/gcc/mpfr --enable-languages=c,c++,fortran --with-as=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/as --with-ld=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/ld --disable-multilib
306Thread model: posix
307gcc version 4.2.3"
308 ;; My mac:
309 "Using built-in specs.
310Target: i686-apple-darwin8
311Configured with: /private/var/tmp/gcc/gcc-5341.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=pentium-m --with-tune=prescott --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
312Thread model: posix
313gcc version 4.0.1 (Apple Computer, Inc. build 5341)"
314 ;; Ubuntu Intrepid
315 "Using built-in specs.
316Target: x86_64-linux-gnu
317Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
318Thread model: posix
319gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)"
320 ;; Red Hat EL4
321 "Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
322Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
323Thread model: posix
324gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)"
325 ;; Red Hat EL5
326 "Using built-in specs.
327Target: x86_64-redhat-linux
328Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
329Thread model: posix
330gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)"
331 ;; David Engster's german gcc on ubuntu 4.3
332 "Es werden eingebaute Spezifikationen verwendet.
333Ziel: i486-linux-gnu
334Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
335Thread-Modell: posix
336gcc-Version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)"
337 ;; Damien Deville bsd
338 "Using built-in specs.
339Target: i386-undermydesk-freebsd
340Configured with: FreeBSD/i386 system compiler
341Thread model: posix
342gcc version 4.2.1 20070719 [FreeBSD]"
343 )
344 "A bunch of sample gcc -v outputs from different machines.")
345
346(defvar semantic-gcc-test-strings-fail
347 '(;; A really old solaris box I found
348 "Reading specs from /usr/local/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
349gcc version 2.95.2 19991024 (release)"
350 )
351 "A bunch of sample gcc -v outputs that fail to provide the info we want.")
352
353(defun semantic-gcc-test-output-parser ()
354 "Test the output parser against some collected strings."
355 (interactive)
356 (let ((fail nil))
357 (dolist (S semantic-gcc-test-strings)
358 (let* ((fields (semantic-gcc-fields S))
359 (v (cdr (assoc 'version fields)))
360 (h (or (cdr (assoc 'target fields))
361 (cdr (assoc '--target fields))
362 (cdr (assoc '--host fields))))
363 (p (cdr (assoc '--prefix fields)))
364 )
365 ;; No longer test for prefixes.
366 (when (not (and v h))
367 (let ((strs (split-string S "\n")))
368 (message "Test failed on %S\nV H P:\n%S %S %S" (car strs) v h p))
369 (setq fail t))
370 ))
371 (dolist (S semantic-gcc-test-strings-fail)
372 (let* ((fields (semantic-gcc-fields S))
373 (v (cdr (assoc 'version fields)))
374 (h (or (cdr (assoc '--host fields))
375 (cdr (assoc 'target fields))))
376 (p (cdr (assoc '--prefix fields)))
377 )
378 (when (and v h p)
379 (message "Negative test failed on %S" S)
380 (setq fail t))
381 ))
382 (if (not fail) (message "Tests passed."))
383 ))
384
385(defun semantic-gcc-test-output-parser-this-machine ()
386 "Test the output parser against the machine currently running Emacs."
387 (interactive)
388 (let ((semantic-gcc-test-strings (list (semantic-gcc-query "gcc" "-v"))))
389 (semantic-gcc-test-output-parser))
390 )
diff --git a/test/manual/cedet/tests/test.el b/test/manual/cedet/tests/test.el
index 3bc945d89f8..a54c253be68 100644
--- a/test/manual/cedet/tests/test.el
+++ b/test/manual/cedet/tests/test.el
@@ -1,4 +1,4 @@
1;;; test.el --- Unit test file for Semantic Emacs Lisp support. 1;;; test.el --- Unit test file for Semantic Emacs Lisp support. -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2005-2021 Free Software Foundation, Inc. 3;; Copyright (C) 2005-2021 Free Software Foundation, Inc.
4 4
diff --git a/test/manual/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1
index 3de15514e79..e6b060f3352 100644
--- a/test/manual/etags/ETAGS.good_1
+++ b/test/manual/etags/ETAGS.good_1
@@ -2143,11 +2143,11 @@ main(37,571
2143 class D 41,622 2143 class D 41,622
2144 D(43,659 2144 D(43,659
2145 2145
2146el-src/TAGTEST.EL,179 2146el-src/TAGTEST.EL,181
2147(foo::defmumble bletch 1,0 2147(foo::defmumble bletch 3,33
2148(defun foo==bar foo==bar2,33 2148(defun foo==bar foo==bar4,66
2149(defalias 'pending-delete-mode pending-delete-mode6,149 2149(defalias 'pending-delete-mode pending-delete-mode8,182
2150(defalias (quote explicitly-quoted-pending-delete-mode)9,222 2150(defalias (quote explicitly-quoted-pending-delete-mode)11,255
2151 2151
2152el-src/emacs/lisp/progmodes/etags.el,5069 2152el-src/emacs/lisp/progmodes/etags.el,5069
2153(defvar tags-file-name 34,1035 2153(defvar tags-file-name 34,1035
diff --git a/test/manual/etags/el-src/TAGTEST.EL b/test/manual/etags/el-src/TAGTEST.EL
index 89a67913771..3e6599a4a45 100644
--- a/test/manual/etags/el-src/TAGTEST.EL
+++ b/test/manual/etags/el-src/TAGTEST.EL
@@ -1,3 +1,5 @@
1;;; -*- lexical-binding: t -*-
2
1(foo::defmumble bletch beuarghh) 3(foo::defmumble bletch beuarghh)
2(defun foo==bar () (message "hi")) ; Bug#5624 4(defun foo==bar () (message "hi")) ; Bug#5624
3;;; Ctags test file for lisp mode. 5;;; Ctags test file for lisp mode.
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 64f9137865b..dcec971c12e 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -106,7 +106,27 @@
106 #("foobar" 3 6 (face error)))) 106 #("foobar" 3 6 (face error))))
107 (should (ert-equal-including-properties 107 (should (ert-equal-including-properties
108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") 108 (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
109 #("foo bar" 4 7 (face error))))) 109 #("foo bar" 4 7 (face error))))
110 ;; Bug #46317
111 (let ((s (propertize "X" 'prop "val")))
112 (should (ert-equal-including-properties
113 (format (concat "%3s/" s) 12)
114 #(" 12/X" 4 5 (prop "val"))))
115 (should (ert-equal-including-properties
116 (format (concat "%3S/" s) 12)
117 #(" 12/X" 4 5 (prop "val"))))
118 (should (ert-equal-including-properties
119 (format (concat "%3d/" s) 12)
120 #(" 12/X" 4 5 (prop "val"))))
121 (should (ert-equal-including-properties
122 (format (concat "%-3s/" s) 12)
123 #("12 /X" 4 5 (prop "val"))))
124 (should (ert-equal-including-properties
125 (format (concat "%-3S/" s) 12)
126 #("12 /X" 4 5 (prop "val"))))
127 (should (ert-equal-including-properties
128 (format (concat "%-3d/" s) 12)
129 #("12 /X" 4 5 (prop "val"))))))
110 130
111;; Tests for bug#5131. 131;; Tests for bug#5131.
112(defun transpose-test-reverse-word (start end) 132(defun transpose-test-reverse-word (start end)
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e0aed2a71b6..9f6593a177c 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
@@ -1098,3 +1098,11 @@
1098 (goto-char (point-max)) 1098 (goto-char (point-max))
1099 (insert "fóo") 1099 (insert "fóo")
1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9))))) 1100 (should (approx-equal (buffer-line-statistics) '(1002 50 49.9)))))
1101
1102(ert-deftest test-line-number-at-position ()
1103 (with-temp-buffer
1104 (insert (make-string 10 ?\n))
1105 (should (= (line-number-at-pos (point)) 11))
1106 (should (= (line-number-at-pos nil) 11))
1107 (should-error (line-number-at-pos -1))
1108 (should-error (line-number-at-pos 100))))
diff --git a/test/src/indent-tests.el b/test/src/indent-tests.el
index 10f1202949b..6a3f1a5c95f 100644
--- a/test/src/indent-tests.el
+++ b/test/src/indent-tests.el
@@ -4,18 +4,18 @@
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
7;; This program is free software: you can redistribute it and/or 7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; modify it under the terms of the GNU General Public License as 8;; it under the terms of the GNU General Public License as published by
9;; published by the Free Software Foundation, either version 3 of the 9;; the Free Software Foundation, either version 3 of the License, or
10;; License, or (at your option) any later version. 10;; (at your option) any later version.
11;; 11
12;; This program is distributed in the hope that it will be useful, but 12;; GNU Emacs is distributed in the hope that it will be useful,
13;; WITHOUT ANY WARRANTY; without even the implied warranty of 13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; General Public License for more details. 15;; GNU General Public License for more details.
16;; 16
17;; You should have received a copy of the GNU General Public License 17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `https://www.gnu.org/licenses/'. 18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19 19
20;;; Commentary: 20;;; Commentary:
21 21
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index 28119fc999e..c55611eb84b 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -412,11 +412,11 @@
412 412
413(ert-deftest test-inhibit-interaction () 413(ert-deftest test-inhibit-interaction ()
414 (let ((inhibit-interaction t)) 414 (let ((inhibit-interaction t))
415 (should-error (read-from-minibuffer "foo: ")) 415 (should-error (read-from-minibuffer "foo: ") :type 'inhibited-interaction)
416 416
417 (should-error (y-or-n-p "foo: ")) 417 (should-error (y-or-n-p "foo: ") :type 'inhibited-interaction)
418 (should-error (yes-or-no-p "foo: ")) 418 (should-error (yes-or-no-p "foo: ") :type 'inhibited-interaction)
419 (should-error (read-blanks-no-input "foo: ")) 419 (should-error (read-no-blanks-input "foo: ") :type 'inhibited-interaction)
420 420
421 ;; See that we get the expected error. 421 ;; See that we get the expected error.
422 (should (eq (condition-case nil 422 (should (eq (condition-case nil
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index a3fba8d328b..e62bcb3f7c0 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -879,5 +879,33 @@ Return nil if FILENAME doesn't exist."
879 (file-regular-p filename) 879 (file-regular-p filename)
880 filename))) 880 filename)))
881 881
882;; Bug#46284
883(ert-deftest process-sentinel-interrupt-event ()
884 "Test that interrupting a process on Windows sends \"interrupt\" to sentinel."
885 (skip-unless (eq system-type 'windows-nt))
886 (with-temp-buffer
887 (let* ((proc-buf (current-buffer))
888 ;; Start a new emacs process to wait idly until interrupted.
889 (cmd "emacs -batch --eval=\"(sit-for 50000)\"")
890 (proc (start-file-process-shell-command
891 "test/process-sentinel-signal-event" proc-buf cmd))
892 (events '()))
893
894 ;; Capture any incoming events.
895 (set-process-sentinel proc
896 (lambda (_prc event)
897 (push event events)))
898 ;; Wait for the process to start.
899 (sleep-for 2)
900 (should (equal 'run (process-status proc)))
901 ;; Interrupt the sub-process and wait for it to die.
902 (interrupt-process proc)
903 (sleep-for 2)
904 ;; Should have received SIGINT...
905 (should (equal 'signal (process-status proc)))
906 (should (equal 2 (process-exit-status proc)))
907 ;; ...and the change description should be "interrupt".
908 (should (equal '("interrupt\n") events)))))
909
882(provide 'process-tests) 910(provide 'process-tests)
883;;; process-tests.el ends here 911;;; process-tests.el ends here