commit cb1563f3ca2e0d5b3a3e0384b5c76c4d47587f75 (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Sun Aug 30 02:38:22 2020 +0200 Convert manual rmailmm tests to ert * test/manual/rmailmm.el: Move from here... * test/lisp/mail/rmailmm-tests.el: ...to here, and convert to ert. diff --git a/test/manual/rmailmm.el b/test/lisp/mail/rmailmm-tests.el similarity index 68% rename from test/manual/rmailmm.el rename to test/lisp/mail/rmailmm-tests.el index d6e29a8b07..645bb96d11 100644 --- a/test/manual/rmailmm.el +++ b/test/lisp/mail/rmailmm-tests.el @@ -1,4 +1,4 @@ -;;; rmailmm.el --- tests for mail/rmailmm.el +;;; rmailmm-tests.el --- Tests for rmailmm.el -*- lexical-binding:t -*- ;; Copyright (C) 2006-2020 Free Software Foundation, Inc. @@ -19,27 +19,42 @@ ;;; Commentary: +;; Converted to ert from previous manual tests. + +;; FIXME: Some of these still lack a condition for success. + ;;; Code: +(require 'ert) (require 'rmailmm) -(defun rmailmm-test-handler () +(ert-deftest rmailmm-test-handler () "Test of a mail using no MIME parts at all." (let ((mail "To: alex@gnu.org Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -\372\304\322\301\327\323\324\327\325\312\324\305\41")) - (switch-to-buffer (get-buffer-create "*test*")) - (erase-buffer) - (set-buffer-multibyte nil) - (insert mail) - (rmail-mime-show t) - (set-buffer-multibyte t))) +\372\304\322\301\327\323\324\327\325\312\324\305\41") + (correct "To: alex@gnu.org +Content-Type: text/plain; charset=koi8-r +Content-Transfer-Encoding: 8bit +MIME-Version: 1.0 -(defun rmailmm-test-bulk-handler () +Здравствуйте! +")) + (with-temp-buffer + (erase-buffer) + (set-buffer-multibyte nil) + (insert mail) + (rmail-mime-show t) + (set-buffer-multibyte t) + (should (equal (buffer-string) correct))))) + +;;;; FIXME: This doesn't seem to be working. +(ert-deftest rmailmm-test-bulk-handler () "Test of a mail used as an example in RFC 2183." + :tags '(:unstable) (let ((mail "Content-Type: image/jpeg Content-Disposition: attachment; filename=genome.jpeg; modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"; @@ -54,13 +69,17 @@ WATQdRUvAK0Bnmshmtn79PpaLBbbOZkjKvRnjRZoRswOkG1wFchKew2g9wXVJVZL/m4+B+vv UDwbgUEAUmk2Zyg101d6PhCDySgAvTvDgKiuOrc4dLxUb7UMnhGIexyI+d6U+ABuNAP4Simx lgAAAABJRU5ErkJggg== ")) - (switch-to-buffer (get-buffer-create "*test*")) - (erase-buffer) - (insert mail) - (rmail-mime-show))) - -(defun rmailmm-test-multipart-handler () + (with-temp-buffer + (erase-buffer) + (insert mail) + (rmail-mime-show) + ;; FIXME: What is the condition for success? + ))) + +;; FIXME: Has no condition for success -- see below. +(ert-deftest rmailmm-test-multipart-handler () "Test of a mail used as an example in RFC 2046." + :tags '(:unstable) (let ((mail "From: Nathaniel Borenstein To: Ned Freed Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST) @@ -88,6 +107,11 @@ This is the epilogue. It is also to be ignored.")) (switch-to-buffer (get-buffer-create "*test*")) (erase-buffer) (insert mail) - (rmail-mime-show t))) + (rmail-mime-show t) + ;; FIXME: What is the condition for success? + (should nil) ; expected fail for now + )) + +(provide 'rmailmm-tests) -;;; rmailmm.el ends here +;; rmailmm-tests.el ends here commit 826192409a6acaa7f58ac1d86c0481a92b8c8aac Author: Stefan Kangas Date: Sat Aug 29 23:27:51 2020 +0200 Convert unsafep tests to ert * lisp/emacs-lisp/tcover-unsafep.el: Move from here... * test/lisp/emacs-lisp/unsafep-tests.el: ...to here, and convert to use ert instead of tcover. diff --git a/lisp/emacs-lisp/tcover-unsafep.el b/test/lisp/emacs-lisp/unsafep-tests.el similarity index 76% rename from lisp/emacs-lisp/tcover-unsafep.el rename to test/lisp/emacs-lisp/unsafep-tests.el index 108dee3d95..2b920a00ca 100644 --- a/lisp/emacs-lisp/tcover-unsafep.el +++ b/test/lisp/emacs-lisp/unsafep-tests.el @@ -1,10 +1,8 @@ -;;;; testcover-unsafep.el -- Use testcover to test unsafep's code coverage - -;; Copyright (C) 2002-2020 Free Software Foundation, Inc. +;;; unsafep-tests.el --- tests for unsafep.el -*- lexical-binding: t; -*- ;; Author: Jonathan Yavner -;; Keywords: safety lisp utility -;; Package: testcover + +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -21,18 +19,19 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . -(require 'testcover) +;;; Code: + +(require 'ert) +(require 'unsafep) (defvar safe-functions) -;;;These forms are all considered safe +;;; These forms are all considered safe (defconst testcover-unsafep-safe '(((lambda (x) (* x 2)) 14) (apply 'cdr (mapcar (lambda (x) (car x)) y)) (cond ((= x 4) 5) (t 27)) (condition-case x (car y) (error (car x))) - (dolist (x y) (message "here: %s" x)) - (dotimes (x 14 (* x 2)) (message "here: %d" x)) (let (x) (dolist (y '(1 2 3) (1+ y)) (push y x))) (let (x) (apply (lambda (x) (* x 2)) 14)) (let ((x '(2))) (push 1 x) (pop x) (add-to-list 'x 2)) @@ -47,7 +46,7 @@ (propertize "x" 'display '(height (progn (delete-file "x") 1)))) "List of forms that `unsafep' should decide are safe.") -;;;These forms are considered unsafe +;;; These forms are considered unsafe (defconst testcover-unsafep-unsafe '(( (add-to-list x y) . (unquoted x)) @@ -109,32 +108,37 @@ ) "A-list of (FORM . REASON)... that`unsafep' should decide are unsafe.") -(declare-function unsafep-function "unsafep" (fun)) - -;;;######################################################################### -(defun testcover-unsafep () +(ert-deftest test-unsafep/safe () "Executes all unsafep tests and displays the coverage results." - (interactive) - (testcover-unmark-all "unsafep.el") - (testcover-start "unsafep.el") - (let (save-functions) + (let (safe-functions) (dolist (x testcover-unsafep-safe) - (if (unsafep x) - (error "%S should be safe" x))) + (should-not (unsafep x))))) + +(ert-deftest test-unsafep/message () + ;; FIXME: This failed after converting these tests from testcover to + ;; ert. + :expected-result :failed + (should-not '(dolist (x y) (message "here: %s" x))) + (should-not '(dotimes (x 14 (* x 2)) (message "here: %d" x)))) + +(ert-deftest test-unsafep/unsafe () + "Executes all unsafep tests and displays the coverage results." + (let (safe-functions) (dolist (x testcover-unsafep-unsafe) - (if (not (equal (unsafep (car x)) (cdr x))) - (error "%S should be unsafe: %s" (car x) (cdr x)))) - (setq safe-functions t) - (if (or (unsafep '(delete-file "x")) - (unsafep-function 'delete-file)) - (error "safe-functions=t should allow delete-file")) - (setq safe-functions '(setcar)) - (if (unsafep '(setcar x 1)) - (error "safe-functions=(setcar) should allow setcar")) - (if (not (unsafep '(setcdr x 1))) - (error "safe-functions=(setcar) should not allow setcdr"))) - (testcover-mark-all "unsafep.el") - (testcover-end "unsafep.el") - (message "Done")) - -;; testcover-unsafep.el ends here. + (should (equal (unsafep (car x)) (cdr x)))))) + +(ert-deftest test-unsafep/safe-functions-t () + "safe-functions=t should allow delete-file" + (let ((safe-functions t)) + (should-not (unsafep '(delete-file "x"))) + (should-not (unsafep-function 'delete-file)))) + +(ert-deftest test-unsafep/safe-functions-setcar () + "safe-functions=(setcar) should allow setcar but not setcdr" + (let ((safe-functions '(setcar))) + (should-not (unsafep '(setcar x 1))) + (should (unsafep '(setcdr x 1))))) + +(provide 'unsafep-tests) + +;;; unsafep-tests.el ends here commit 17291414b10024a32ac877ce1d25665191f7bf4d Author: Stefan Kangas Date: Sat Aug 29 22:47:39 2020 +0200 * lisp/play/snake.el: Use lexical-binding. diff --git a/lisp/play/snake.el b/lisp/play/snake.el index 70d80c464f..00072a4c05 100644 --- a/lisp/play/snake.el +++ b/lisp/play/snake.el @@ -1,4 +1,4 @@ -;;; snake.el --- implementation of Snake for Emacs +;;; snake.el --- implementation of Snake for Emacs -*- lexical-binding:t -*- ;; Copyright (C) 1997, 2001-2020 Free Software Foundation, Inc. commit 2aeff0794a2b2b86ffe4325a8c677ebbfb2afa1f Author: Stefan Kangas Date: Sat Aug 29 20:55:46 2020 +0200 Use lexical-binding in more tests * test/lib-src/emacsclient-tests.el: * test/lisp/emacs-lisp/hierarchy-tests.el: * test/lisp/eshell/eshell-tests.el: * test/lisp/gnus/gnus-util-tests.el: * test/lisp/progmodes/js-tests.el: * test/lisp/textmodes/bibtex-tests.el: * test/src/editfns-tests.el: * test/src/fns-tests.el: Use lexical-binding. * test/lisp/emacs-lisp/hierarchy-tests.el (hierarchy-leafs-includes-lonely-roots): * test/src/editfns-tests.el (transpose-test-get-byte-positions): * test/src/fns-tests.el (fns-tests-func-arity): Adjust for lexical-binding. diff --git a/test/lib-src/emacsclient-tests.el b/test/lib-src/emacsclient-tests.el index 901922c03e..a502bb782f 100644 --- a/test/lib-src/emacsclient-tests.el +++ b/test/lib-src/emacsclient-tests.el @@ -1,4 +1,4 @@ -;;; emacsclient-tests.el --- Test emacsclient +;;; emacsclient-tests.el --- Test emacsclient -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. diff --git a/test/lisp/emacs-lisp/hierarchy-tests.el b/test/lisp/emacs-lisp/hierarchy-tests.el index 23cfc79d84..41d3f2f3cc 100644 --- a/test/lisp/emacs-lisp/hierarchy-tests.el +++ b/test/lisp/emacs-lisp/hierarchy-tests.el @@ -1,4 +1,4 @@ -;;; hierarchy-tests.el --- Tests for hierarchy.el +;;; hierarchy-tests.el --- Tests for hierarchy.el -*- lexical-binding:t -*- ;; Copyright (C) 2017-2019 Damien Cassou @@ -274,7 +274,7 @@ '(dove pigeon dolphin cow))))) (ert-deftest hierarchy-leafs-includes-lonely-roots () - (let ((parentfn (lambda (item) nil)) + (let ((parentfn (lambda (_) nil)) (hierarchy (hierarchy-new))) (hierarchy-add-tree hierarchy 'foo parentfn) (should (equal (hierarchy-leafs hierarchy) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 16a0464772..1b93fb0fbb 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -1,4 +1,4 @@ -;;; tests/eshell-tests.el --- Eshell test suite +;;; tests/eshell-tests.el --- Eshell test suite -*- lexical-binding:t -*- ;; Copyright (C) 1999-2020 Free Software Foundation, Inc. @@ -61,6 +61,8 @@ (eshell-insert-command text func) (eshell-match-result regexp)) +(defvar eshell-history-file-name) + (defun eshell-test-command-result (command) "Like `eshell-command-result', but not using HOME." (let ((eshell-directory-name (make-temp-file "eshell" t)) diff --git a/test/lisp/gnus/gnus-util-tests.el b/test/lisp/gnus/gnus-util-tests.el index b01e2fc296..7eadb0de71 100644 --- a/test/lisp/gnus/gnus-util-tests.el +++ b/test/lisp/gnus/gnus-util-tests.el @@ -1,4 +1,4 @@ -;;; gnus-util-tests.el --- Selectived tests only. +;;; gnus-util-tests.el --- Selectived tests only. -*- lexical-binding:t -*- ;; Copyright (C) 2015-2020 Free Software Foundation, Inc. ;; Author: Jens Lechtenbörger diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 0d53c0681b..681e51de0e 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -1,4 +1,4 @@ -;;; js-tests.el --- Test suite for js-mode +;;; js-tests.el --- Test suite for js-mode -*- lexical-binding:t -*- ;; Copyright (C) 2017-2020 Free Software Foundation, Inc. diff --git a/test/lisp/textmodes/bibtex-tests.el b/test/lisp/textmodes/bibtex-tests.el index b3858de9e6..c12722fca1 100644 --- a/test/lisp/textmodes/bibtex-tests.el +++ b/test/lisp/textmodes/bibtex-tests.el @@ -1,4 +1,4 @@ -;;; bibtex-tests.el --- Test suite for bibtex. +;;; bibtex-tests.el --- Test suite for bibtex. -*- lexical-binding:t -*- ;; Copyright (C) 2013-2020 Free Software Foundation, Inc. diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index d7c7aec17c..de0aeabfe7 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -1,4 +1,4 @@ -;;; editfns-tests.el -- tests for editfns.c +;;; editfns-tests.el -- tests for editfns.c -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. @@ -124,8 +124,8 @@ "Validate character position to byte position translation." (let ((bytes '())) (dotimes (pos len) - (setq bytes (add-to-list 'bytes (position-bytes (1+ pos)) t))) - bytes)) + (push (position-bytes (1+ pos)) bytes)) + (nreverse bytes))) (ert-deftest transpose-ascii-regions-test () (with-temp-buffer diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 400e912648..b9a7d29895 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -1,4 +1,4 @@ -;;; fns-tests.el --- tests for src/fns.c +;;; fns-tests.el --- tests for src/fns.c -*- lexical-binding:t -*- ;; Copyright (C) 2014-2020 Free Software Foundation, Inc. @@ -229,8 +229,8 @@ (require 'info) (should (equal (func-arity 'Info-goto-node) '(1 . 3))) (should (equal (func-arity (lambda (&rest x))) '(0 . many))) - (should (equal (func-arity (eval (lambda (x &optional y)) nil)) '(1 . 2))) - (should (equal (func-arity (eval (lambda (x &optional y)) t)) '(1 . 2))) + (should (equal (func-arity (eval '(lambda (x &optional y)) nil)) '(1 . 2))) + (should (equal (func-arity (eval '(lambda (x &optional y)) t)) '(1 . 2))) (should (equal (func-arity 'let) '(1 . unevalled)))) (defun fns-tests--string-repeat (s o) commit e709c187fde76573ea3ec3a5f14e09b9ed59525f Author: Paul Eggert Date: Sat Aug 29 13:34:06 2020 -0700 Mark failing fileio test on MS-Windows * test/src/fileio-tests.el (fileio-tests--HOME-trailing-slash): Expect failure on MS-Windows. diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 7baa4c7e2f..bedda83bbd 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -109,6 +109,9 @@ Also check that an encoding error can appear in a symlink." (ert-deftest fileio-tests--HOME-trailing-slash () "Test that expand-file-name of \"~\" respects trailing slash." + :expected-result (if (memq system-type '(windows-nt ms-dos)) + :failed + :passed) (let ((process-environment (copy-sequence process-environment))) (dolist (home (if (memq system-type '(windows-nt ms-dos)) commit e2702ca5fb1af6f80800e0ba202ffecebb723eed Author: Alan Third Date: Sat Aug 29 16:31:52 2020 +0100 Run GNUstep build test more often * .gitlab-ci.yml (test-gnustep): Include more files that may affect the GNUstep build. diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 566efb1409..913ba0fd4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,18 +73,10 @@ test-gnustep: changes: - .gitlab-ci.yml - configure.ac - - src/nsfns.m - - src/nsfont.m - - src/nsgui.h - - src/nsimage.m - - src/nsmenu.m - - src/nsselect.m - - src/nsterm.h - - src/nsterm.m - - src/nsxwidget.h - - src/nsxwidget.m - - src/macfont.h - - src/macfont.m + - src/ns*.{h,m} + - src/macfont.{h,m} + - lisp/term/ns-win.el + - nextstep/**/* script: - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq -o=Dpkg::Use-Pty=0 gnustep-devel - ./autogen.sh autoconf commit 665e05543c09ac6403e5b8599cdb13d809606d6a Author: Stefan Kangas Date: Sat Aug 29 16:13:05 2020 +0200 * lisp/mail/mspools.el: Remove redundant :group args. diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el index 94b0886c75..21aefa6c79 100644 --- a/lisp/mail/mspools.el +++ b/lisp/mail/mspools.el @@ -125,18 +125,15 @@ (defcustom mspools-update nil "Non-nil means update *spools* buffer after visiting any folder." - :type 'boolean - :group 'mspools) + :type 'boolean) (defcustom mspools-suffix "spool" "Extension used for spool files (not including full stop)." - :type 'string - :group 'mspools) + :type 'string) (defcustom mspools-using-vm (fboundp 'vm) "Non-nil if VM is used as mail reader, otherwise RMAIL is used." - :type 'boolean - :group 'mspools) + :type 'boolean) (defcustom mspools-folder-directory (if (boundp 'vm-folder-directory) @@ -144,8 +141,7 @@ "~/MAIL/") "Directory where mail folders are kept. Ensure it has a trailing /. Defaults to `vm-folder-directory' if bound else to ~/MAIL/." - :type 'directory - :group 'mspools) + :type 'directory) (defcustom mspools-vm-system-mail (or (getenv "MAIL") (concat rmail-spool-directory @@ -156,8 +152,7 @@ without it. By default this will be set to the environment variable $MAIL. Otherwise it will use `rmail-spool-directory' to guess where your primary spool is. If this fails, set it to something like /usr/spool/mail/login-name." - :type 'file - :group 'mspools) + :type 'file) ;;; Internal Variables commit c7e297e90669dfa7f77eb4eb2b5c846f90fa0b23 Author: João Távora Date: Sat Aug 29 14:28:54 2020 +0100 Prevent ElDoc blinking when eldoc-documentation-enthusiast is used This eldoc-documentation-strategy function didn't always obey protocol since it returned nil sometimes, which the eldoc engine took it as a hint for the "old" protocol to clear the echo area. * lisp/emacs-lisp/eldoc.el (eldoc-documentation-enthusiast): Return t. (Version): Bump to 1.9.0 diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 4825b5c5e6..6bb732ef85 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -5,7 +5,7 @@ ;; Author: Noah Friedman ;; Keywords: extensions ;; Created: 1995-10-06 -;; Version: 1.8.0 +;; Version: 1.9.0 ;; Package-Requires: ((emacs "26.3")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -573,7 +573,8 @@ Meant as a value for `eldoc-documentation-strategy'." (let* ((callback (eldoc--make-callback :enthusiast)) (str (funcall f callback))) (if (stringp str) (funcall callback str)) - nil)))) + nil))) + t) ;; JT@2020-07-10: ElDoc is pre-loaded, so in Emacs < 28 we can't ;; make the "old" `eldoc-documentation-function' point to the new commit f8484f668340a753936a517e59d2307b1abd375a Author: Ulrich Müller Date: Sat Aug 29 12:29:13 2020 +0200 Delete duplicate definition for koi8-u coding system * lisp/language/cyrillic.el (koi8-u): Delete duplicate definition. diff --git a/lisp/language/cyrillic.el b/lisp/language/cyrillic.el index 9847ab66e6..c19637010a 100644 --- a/lisp/language/cyrillic.el +++ b/lisp/language/cyrillic.el @@ -169,13 +169,6 @@ Support for Russian using koi8-r and the russian-computer input method.") :charset-list '(ibm866) :mime-charset 'cp866) -(define-coding-system 'koi8-u - "KOI8-U 8-bit encoding for Cyrillic (MIME: KOI8-U)" - :coding-type 'charset - :mnemonic ?U - :charset-list '(koi8-u) - :mime-charset 'koi8-u) - (define-coding-system 'koi8-t "KOI8-T 8-bit encoding for Cyrillic" :coding-type 'charset commit 63578dc4355ebdf0e2b0a56280f71aa5f28ac6a0 Author: Mattias Engdegård Date: Sat Aug 29 13:10:18 2020 +0200 * test/lisp/emacs-lisp/rx-tests.el: Improve test coverage. diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 0e6f27836e..3b01d89dba 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -56,9 +56,12 @@ (ert-deftest rx-def-in-or () (rx-let ((a b) (b (or "abc" c)) - (c ?a)) + (c ?a) + (d (any "a-z"))) (should (equal (rx (or a (| "ab" "abcde") "abcd")) - "\\(?:a\\(?:b\\(?:c\\(?:de?\\)?\\)?\\)?\\)")))) + "\\(?:a\\(?:b\\(?:c\\(?:de?\\)?\\)?\\)?\\)")) + (should (equal (rx (or ?m (not d))) + "[^a-ln-z]")))) (ert-deftest rx-char-any () "Test character alternatives with `]' and `-' (Bug#25123)." @@ -132,8 +135,8 @@ ;; relint suppression: Single-character range .f-f ;; relint suppression: Range .--/. overlaps previous .- ;; relint suppression: Range .\*--. overlaps previous .--/ - (should (equal (rx (any "-a" "c-" "f-f" "--/*--")) - "[*-/acf]")) + (should (equal (rx (any "-a" "c-" "f-f" "--/*--") (any "," "-" "A")) + "[*-/acf][,A-]")) (should (equal (rx (any "]-a" ?-) (not (any "]-a" ?-))) "[]-a-][^]-a-]")) (should (equal (rx (any "--]") (not (any "--]")) @@ -394,6 +397,8 @@ "ab"))) (ert-deftest rx-literal () + (should (equal (rx (literal "$a")) + "\\$a")) (should (equal (rx (literal (char-to-string 42)) nonl) "\\*.")) (let ((x "a+b"))