From 7975c811d32b6c08b4eab9e8faee615ab69c9e34 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 3 Sep 2023 21:04:02 +0200 Subject: [PATCH] Use new ERT `skip-when` macro in tests * test/lisp/autorevert-tests.el (auto-revert-test02-auto-revert-deleted-file): * test/lisp/emacs-lisp/benchmark-tests.el (benchmark-tests): * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--library-completion): * test/lisp/eshell/esh-proc-tests.el (esh-proc-test/kill-pipeline): * test/lisp/filenotify-tests.el (file-notify-test11-symlinks): * test/lisp/ibuffer-tests.el (ibuffer-0autoload): * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1): * test/lisp/net/network-stream-tests.el (echo-server-nowait) (connect-to-tls-ipv4-nowait, connect-to-tls-ipv6-nowait) (open-network-stream-tls-wait, open-network-stream-tls-nowait) (open-network-stream-tls, open-network-stream-tls-nocert) (open-gnutls-stream-new-api-nowait) (open-gnutls-stream-old-api-nowait): * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-bug-10483) (cperl-test-hyperactive-electric-else): * test/lisp/progmodes/elisp-mode-tests.el (eval-last-sexp-print-format-sym-echo) (eval-last-sexp-print-format-small-int-echo) (eval-last-sexp-print-format-large-int-echo) (eval-defun-prints-edebug-when-instrumented): * test/lisp/progmodes/python-tests.el (python-ffap-module-path-1): * test/lisp/shadowfile-tests.el (shadow-test00-clusters) (shadow-test01-sites, shadow-test02-files) (shadow-test03-expand-cluster-in-file-name) (shadow-test04-contract-file-name, shadow-test05-file-match) (shadow-test06-literal-groups, shadow-test07-regexp-groups) (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files): * test/lisp/simple-tests.el (eval-expression-print-format-sym-echo) (eval-expression-print-format-small-int-echo) (eval-expression-print-format-large-int-echo): * test/lisp/term-tests.el (term-simple-lines) (term-carriage-return, term-line-wrap, term-colors) (term-colors-bold-is-bright, term-cursor-movement) (term-scrolling-region, term-set-directory) (term-line-wrapping-then-motion, term-to-margin): * test/lisp/thread-tests.el (thread-tests-list-threads-error-when-not-configured): * test/lisp/vc/vc-tests.el (backend): * test/manual/scroll-tests.el (scroll-tests-scroll-margin-0) (scroll-tests-scroll-margin-negative) (scroll-tests-scroll-margin-max) (scroll-tests-scroll-margin-over-max) (scroll-tests-scroll-margin-whole-window): * test/misc/test-custom-libs.el (test-custom-libs): * test/src/emacs-module-tests.el (module/async-pipe): * test/src/fileio-tests.el (fileio-tests--odd-symlink-chars): * test/src/filelock-tests.el (filelock-tests-lock-spoiled) (filelock-tests-file-locked-p-spoiled) (filelock-tests-unlock-spoiled) (filelock-tests-kill-buffer-spoiled) (filelock-tests-detect-external-change): * test/src/image-tests.el (image-tests-image-size/error-on-nongraphical-display) (image-tests-image-mask-p/error-on-nongraphical-display) (image-tests-image-metadata/error-on-nongraphical-display): * test/src/process-tests.el (make-process/mix-stderr) (process-tests/fd-setsize-no-crash/make-network-process) (process-tests/fd-setsize-no-crash/make-serial-process): Use ERT `skip-when` macro in tests. --- test/lisp/autorevert-tests.el | 2 +- test/lisp/emacs-lisp/benchmark-tests.el | 4 ++-- test/lisp/emacs-lisp/find-func-tests.el | 2 +- test/lisp/eshell/esh-proc-tests.el | 2 +- test/lisp/filenotify-tests.el | 2 +- test/lisp/ibuffer-tests.el | 2 +- .../lisp/international/ucs-normalize-tests.el | 4 ++-- test/lisp/net/network-stream-tests.el | 20 +++++++++---------- test/lisp/progmodes/cperl-mode-tests.el | 6 +++--- test/lisp/progmodes/elisp-mode-tests.el | 8 ++++---- test/lisp/progmodes/python-tests.el | 2 +- test/lisp/shadowfile-tests.el | 20 +++++++++---------- test/lisp/simple-tests.el | 6 +++--- test/lisp/term-tests.el | 20 +++++++++---------- test/lisp/thread-tests.el | 2 +- test/lisp/vc/vc-tests.el | 4 ++-- test/manual/scroll-tests.el | 10 +++++----- test/misc/test-custom-libs.el | 2 +- test/src/emacs-module-tests.el | 2 +- test/src/fileio-tests.el | 2 +- test/src/filelock-tests.el | 10 +++++----- test/src/image-tests.el | 6 +++--- test/src/process-tests.el | 6 +++--- 23 files changed, 72 insertions(+), 72 deletions(-) diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 8dbb5d2a496..e01ce82858b 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -257,7 +257,7 @@ This expects `auto-revert--messages' to be bound by ;; Repeated unpredictable failures, bug#32645. :tags '(:unstable) ;; Unlikely to be hydra-specific? - ;; (skip-unless (not (getenv "EMACS_HYDRA_CI"))) + ;; (skip-when (getenv "EMACS_HYDRA_CI")) (with-auto-revert-test (ert-with-temp-file tmpfile (let (;; Try to catch bug#32645. diff --git a/test/lisp/emacs-lisp/benchmark-tests.el b/test/lisp/emacs-lisp/benchmark-tests.el index 99b5b142c37..7fe3be2157f 100644 --- a/test/lisp/emacs-lisp/benchmark-tests.el +++ b/test/lisp/emacs-lisp/benchmark-tests.el @@ -25,8 +25,8 @@ (ert-deftest benchmark-tests () ;; Avoid fork failures on Cygwin. See bug#62450 and etc/PROBLEMS ;; ("Fork failures in a build with native compilation"). - (skip-unless (not (and (eq system-type 'cygwin) - (featurep 'native-compile)))) + (skip-when (and (eq system-type 'cygwin) + (featurep 'native-compile))) (let (str t-long t-short m) (should (consp (benchmark-run nil (setq m (1+ 0))))) (should (consp (benchmark-run 1 (setq m (1+ 0))))) diff --git a/test/lisp/emacs-lisp/find-func-tests.el b/test/lisp/emacs-lisp/find-func-tests.el index 7251b76157b..59ecb5ab187 100644 --- a/test/lisp/emacs-lisp/find-func-tests.el +++ b/test/lisp/emacs-lisp/find-func-tests.el @@ -32,7 +32,7 @@ (ert-deftest find-func-tests--library-completion () ;bug#43393 ;; FIXME: How can we make this work in batch (see also ;; `mule-cmds--test-universal-coding-system-argument')? - ;; (skip-unless (not noninteractive)) + ;; (skip-when noninteractive) ;; Check that `partial-completion' works when completing library names. (should (equal "org/org" (ert-simulate-keys diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index fa20efa71e1..712d3519dce 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el @@ -281,7 +281,7 @@ prompt. See bug#54136." (executable-find "sleep"))) ;; This test doesn't work on EMBA with AOT nativecomp, but works ;; fine elsewhere. - (skip-unless (not (getenv "EMACS_EMBA_CI"))) + (skip-when (getenv "EMACS_EMBA_CI")) (with-temp-eshell (eshell-insert-command (concat "sh -c 'while true; do echo y; sleep 1; done' | " diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 0873910ddf9..57099add08b 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1583,7 +1583,7 @@ the file watch." :tags '(:expensive-test) (skip-unless (file-notify--test-local-enabled)) ;; This test does not work for kqueue (yet). - (skip-unless (not (string-equal (file-notify--test-library) "kqueue"))) + (skip-when (string-equal (file-notify--test-library) "kqueue")) (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el index 83bfa1f68af..ec0ba85da39 100644 --- a/test/lisp/ibuffer-tests.el +++ b/test/lisp/ibuffer-tests.el @@ -34,7 +34,7 @@ (ert-deftest ibuffer-0autoload () ; sort first "Tests to see whether ibuffer has been autoloaded" - (skip-unless (not (featurep 'ibuf-ext))) + (skip-when (featurep 'ibuf-ext)) (should (fboundp 'ibuffer-mark-unsaved-buffers)) (should diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index 97b8fa66cd3..bc7e743291d 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el @@ -255,8 +255,8 @@ Must be called with `ucs-normalize-tests--norm-buf' as current buffer." (ert-deftest ucs-normalize-part1 () :tags '(:expensive-test) - (skip-unless (not (or (getenv "EMACS_HYDRA_CI") - (getenv "EMACS_EMBA_CI")))) ; SLOW ~ 1800s + (skip-when (or (getenv "EMACS_HYDRA_CI") + (getenv "EMACS_EMBA_CI"))) ; SLOW ~ 1800s ;; This takes a long time, so make sure we're compiled. (dolist (fun '(ucs-normalize-tests--part1-rule2 ucs-normalize-tests--rule1-failing-for-partX diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el index 0fd9549c305..8b1ae398930 100644 --- a/test/lisp/net/network-stream-tests.el +++ b/test/lisp/net/network-stream-tests.el @@ -236,7 +236,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect))) + (skip-when (eq (process-status proc) 'connect)) (with-current-buffer (process-buffer proc) (process-send-string proc "echo foo") (sleep-for 0.1) @@ -323,7 +323,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -336,7 +336,7 @@ (ert-deftest connect-to-tls-ipv6-nowait () (skip-unless (executable-find "gnutls-serv")) (skip-unless (gnutls-available-p)) - (skip-unless (not (eq system-type 'windows-nt))) + (skip-when (eq system-type 'windows-nt)) (skip-unless (featurep 'make-network-process '(:family ipv6))) (let ((server (make-tls-server 44333)) (times 0) @@ -368,7 +368,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -403,7 +403,7 @@ (< (setq times (1+ times)) 10)) (sit-for 0.1)) (should proc) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -446,7 +446,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -484,7 +484,7 @@ (< (setq times (1+ times)) 10)) (sit-for 0.1)) (should proc) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -523,7 +523,7 @@ (< (setq times (1+ times)) 10)) (sit-for 0.1)) (should proc) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -673,7 +673,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) @@ -712,7 +712,7 @@ (while (and (eq (process-status proc) 'connect) (< (setq times (1+ times)) 10)) (sit-for 0.1)) - (skip-unless (not (eq (process-status proc) 'connect)))) + (skip-when (eq (process-status proc) 'connect))) (if (process-live-p server) (delete-process server))) (setq status (gnutls-peer-status proc)) (should (consp status)) diff --git a/test/lisp/progmodes/cperl-mode-tests.el b/test/lisp/progmodes/cperl-mode-tests.el index 8f334245c64..87d8ffa2d8d 100644 --- a/test/lisp/progmodes/cperl-mode-tests.el +++ b/test/lisp/progmodes/cperl-mode-tests.el @@ -892,8 +892,8 @@ without a statement terminator on the same line does not loop forever. The test starts an asynchronous Emacs batch process under timeout control." :tags '(:expensive-test) - (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; FIXME times out - (skip-unless (not (< emacs-major-version 28))) ; times out in older Emacsen + (skip-when (getenv "EMACS_HYDRA_CI")) ; FIXME times out + (skip-when (< emacs-major-version 28)) ; times out in older Emacsen (skip-unless (eq cperl-test-mode #'cperl-mode)) (let* ((emacs (concat invocation-directory invocation-name)) (test-function 'cperl-test--run-bug-10483) @@ -1242,7 +1242,7 @@ however, must not happen when the keyword occurs in a variable \"$else\" or \"$continue\"." (skip-unless (eq cperl-test-mode #'cperl-mode)) ;; `self-insert-command' takes a second argument only since Emacs 27 - (skip-unless (not (< emacs-major-version 27))) + (skip-when (< emacs-major-version 27)) (with-temp-buffer (setq cperl-electric-keywords t) (cperl-mode) diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 5b6ef88dceb..4fa869c773f 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -128,7 +128,7 @@ (ert-deftest eval-last-sexp-print-format-sym-echo () ;; We can only check the echo area when running interactive. - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (let ((current-prefix-arg nil)) (erase-buffer) (insert "t") (message nil) @@ -147,7 +147,7 @@ (should (equal (buffer-string) "?A65 (#o101, #x41, ?A)"))))) (ert-deftest eval-last-sexp-print-format-small-int-echo () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (let ((current-prefix-arg nil)) (erase-buffer) (insert "?A") (message nil) @@ -171,7 +171,7 @@ (should (equal (buffer-string) "?B66 (#o102, #x42, ?B)")))))) (ert-deftest eval-last-sexp-print-format-large-int-echo () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (let ((eval-expression-print-maximum-character ?A)) (let ((current-prefix-arg nil)) @@ -186,7 +186,7 @@ ;;; eval-defun (ert-deftest eval-defun-prints-edebug-when-instrumented () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (let ((current-prefix-arg '(4))) (erase-buffer) (insert "(defun foo ())") (message nil) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 9f935f2748c..a44a11896f0 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -4918,7 +4918,7 @@ import abc ;; Skip the test on macOS, since the standard Python installation uses ;; libedit rather than readline which confuses the running of an inferior ;; interpreter in this case (see bug#59477 and bug#25753). - (skip-unless (not (eq system-type 'darwin))) + (skip-when (eq system-type 'darwin)) (trace-function 'python-shell-output-filter) (python-tests-with-temp-buffer-with-shell " diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 5edba039032..b1c06ad2d05 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -101,7 +101,7 @@ Per definition, all files are identical on the different hosts of a cluster (or site). This is not tested here; it must be guaranteed by the originator of a cluster definition." :tags '(:expensive-test) - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((text-quoting-style 'grave) ;; We inspect the *Messages* buffer! @@ -219,7 +219,7 @@ guaranteed by the originator of a cluster definition." Per definition, all files are identical on the different hosts of a cluster (or site). This is not tested here; it must be guaranteed by the originator of a cluster definition." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -320,7 +320,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test02-files () "Check file manipulation functions." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -391,7 +391,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test03-expand-cluster-in-file-name () "Check canonical file name of a cluster or site." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -456,7 +456,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test04-contract-file-name () "Check canonical file name of a cluster or site." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -511,7 +511,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test05-file-match () "Check `shadow-same-site' and `shadow-file-match'." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -563,7 +563,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test06-literal-groups () "Check literal group definitions." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -648,7 +648,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test07-regexp-groups () "Check regexp group definitions." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (let ((shadow-info-file shadow-test-info-file) @@ -710,7 +710,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test08-shadow-todo () "Check that needed shadows are added to todo." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (skip-unless (file-writable-p ert-remote-temporary-file-directory)) @@ -855,7 +855,7 @@ guaranteed by the originator of a cluster definition." (ert-deftest shadow-test09-shadow-copy-files () "Check that needed shadow files are copied." :tags '(:expensive-test) - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (skip-unless (file-remote-p ert-remote-temporary-file-directory)) (skip-unless (file-writable-p ert-remote-temporary-file-directory)) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 7dabb735522..b632c908443 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -742,7 +742,7 @@ See Bug#21722." (ert-deftest eval-expression-print-format-sym-echo () ;; We can only check the echo area when running interactive. - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) t))) (let ((current-prefix-arg nil)) @@ -763,7 +763,7 @@ See Bug#21722." (should (equal (buffer-string) "65 (#o101, #x41, ?A)")))))) (ert-deftest eval-expression-print-format-small-int-echo () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?A))) (let ((current-prefix-arg nil)) @@ -789,7 +789,7 @@ See Bug#21722." (should (equal (buffer-string) "66 (#o102, #x42, ?B)")))))) (ert-deftest eval-expression-print-format-large-int-echo () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (with-temp-buffer (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?B)) (eval-expression-print-maximum-character ?A)) diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index ee2bb6574ae..911d03d5628 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -110,7 +110,7 @@ (buffer-substring (point-min) (point-max)))))) (ert-deftest term-simple-lines () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let ((str "\ first line\r next line\r\n")) @@ -118,14 +118,14 @@ next line\r\n")) (string-replace "\r" "" str))))) (ert-deftest term-carriage-return () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let ((str "\ first line\r_next line\r\n")) (should (equal (term-test-screen-from-input 40 12 str) "_next line\n")))) (ert-deftest term-line-wrap () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (should (string-match-p ;; Don't be strict about trailing whitespace. "\\`a\\{40\\}\na\\{20\\} *\\'" @@ -137,7 +137,7 @@ first line\r_next line\r\n")) (list str str)))))) (ert-deftest term-colors () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (pcase-dolist (`(,str ,expected) ansi-test-strings) (let ((result (term-test-screen-from-input 40 12 str))) (should (equal result expected)) @@ -145,7 +145,7 @@ first line\r_next line\r\n")) (text-properties-at 0 expected)))))) (ert-deftest term-colors-bold-is-bright () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let ((ansi-color-bold-is-bright t)) (pcase-dolist (`(,str ,expected ,bright-expected) ansi-test-strings) (let ((expected (or bright-expected expected)) @@ -155,7 +155,7 @@ first line\r_next line\r\n")) (text-properties-at 0 expected))))))) (ert-deftest term-cursor-movement () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) ;; Absolute positioning. (should (equal "ab\ncd" (term-test-screen-from-input @@ -186,7 +186,7 @@ first line\r_next line\r\n")) "\e[D\e[Da"))))) (ert-deftest term-scrolling-region () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (should (equal "\ line3 line4 @@ -338,7 +338,7 @@ line6\r line7"))))) (ert-deftest term-set-directory () - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let ((term-ansi-at-user (user-real-login-name))) (should (equal (term-test-screen-from-input 40 12 "\eAnSiTc /foo/\n" 'default-directory) @@ -354,7 +354,7 @@ A real-life example is the default zsh prompt which writes spaces to the end of line (triggering line-wrapping state), and then sends a carriage return followed by another space to overwrite the first character of the line." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let* ((width 10) (strs (list "x" (make-string (1- width) ?_) "\r_"))) @@ -364,7 +364,7 @@ the first character of the line." (ert-deftest term-to-margin () "Test cursor movement at the scroll margin. This is a reduced example from GNU nano's initial screen." - (skip-unless (not (memq system-type '(windows-nt ms-dos)))) + (skip-when (memq system-type '(windows-nt ms-dos))) (let* ((width 10) (x (make-string width ?x)) (y (make-string width ?y))) diff --git a/test/lisp/thread-tests.el b/test/lisp/thread-tests.el index 4ba7b99719c..5d684a96a18 100644 --- a/test/lisp/thread-tests.el +++ b/test/lisp/thread-tests.el @@ -88,7 +88,7 @@ (ert-deftest thread-tests-list-threads-error-when-not-configured () "Signal an error running `list-threads' if threads are not configured." - (skip-unless (not (featurep 'threads))) + (skip-when (featurep 'threads)) (should-error (list-threads))) (provide 'thread-tests) diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index 0a26e25e32a..f40cee8cc5b 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el @@ -781,7 +781,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." ;; CVS calls vc-delete-file, which insists on prompting ;; "Really want to delete ...?", and `vc-mtn.el' does not implement ;; `delete-file' at all. - (skip-unless (not (memq ',backend '(CVS Mtn)))) + (skip-when (memq ',backend '(CVS Mtn))) (vc-test--rename-file ',backend)) (ert-deftest @@ -796,7 +796,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." (format "vc-test-%s01-register" backend-string)))))) ;; `vc-mtn.el' gives me: ;; "Failed (status 1): mtn commit -m Testing vc-version-diff\n\n foo" - (skip-unless (not (memq ',backend '(Mtn)))) + (skip-when (memq ',backend '(Mtn))) (vc-test--version-diff ',backend)) )))) diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el index c2a4ef17bff..b2cfeabfe64 100644 --- a/test/manual/scroll-tests.el +++ b/test/manual/scroll-tests.el @@ -80,25 +80,25 @@ ,@body))) (ert-deftest scroll-tests-scroll-margin-0 () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (scroll-tests-with-buffer-window (scroll-tests-up-and-down 0))) (ert-deftest scroll-tests-scroll-margin-negative () "A negative `scroll-margin' should be the same as 0." - (skip-unless (not noninteractive)) + (skip-when noninteractive) (scroll-tests-with-buffer-window (scroll-tests-up-and-down -10 0))) (ert-deftest scroll-tests-scroll-margin-max () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (scroll-tests-with-buffer-window (let ((max-margin (/ (window-text-height) 4))) (scroll-tests-up-and-down max-margin)))) (ert-deftest scroll-tests-scroll-margin-over-max () "A `scroll-margin' more than max should be the same as max." - (skip-unless (not noninteractive)) + (skip-when noninteractive) (scroll-tests-with-buffer-window 7 (let ((max-margin (/ (window-text-height) 4))) (scroll-tests-up-and-down (+ max-margin 1) max-margin) @@ -155,7 +155,7 @@ middle of the window." (should (scroll-tests--point-in-middle-of-window-p))))) (ert-deftest scroll-tests-scroll-margin-whole-window () - (skip-unless (not noninteractive)) + (skip-when noninteractive) (scroll-tests--scroll-margin-whole-window)) (ert-deftest scroll-tests-scroll-margin-whole-window-line-spacing () diff --git a/test/misc/test-custom-libs.el b/test/misc/test-custom-libs.el index eb565de8eee..d255a87eeaf 100644 --- a/test/misc/test-custom-libs.el +++ b/test/misc/test-custom-libs.el @@ -39,7 +39,7 @@ :tags '(:expensive-test) :expected-result :failed ; FIXME: See above. ;; This test is very slow, and IMO not worth the time it takes. - (skip-unless (not (getenv "EMACS_HYDRA_CI"))) + (skip-when (getenv "EMACS_HYDRA_CI")) (skip-unless (file-readable-p custom-test-admin-cus-test)) (load custom-test-admin-cus-test) (cus-test-libs t) diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index ac88011b543..59af5d9a4a8 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -457,7 +457,7 @@ See Bug#36226." (ert-deftest module/async-pipe () "Check that writing data from another thread works." - (skip-unless (not (eq system-type 'windows-nt))) ; FIXME! + (skip-when (eq system-type 'windows-nt)) ; FIXME! (with-temp-buffer (let ((process (make-pipe-process :name "module/async-pipe" :buffer (current-buffer) diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 50642420ce9..62a9be546f9 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -50,7 +50,7 @@ Also check that an encoding error can appear in a symlink." ;; Some Windows versions don't support symlinks, and those which do ;; will pop up UAC elevation prompts, so we disable this test on ;; MS-Windows. - (skip-unless (not (eq system-type 'windows-nt))) + (skip-when (eq system-type 'windows-nt)) (should (equal nil (fileio-tests--symlink-failure)))) (ert-deftest fileio-tests--directory-file-name () diff --git a/test/src/filelock-tests.el b/test/src/filelock-tests.el index c5e77f70bb2..f4376b2a5b0 100644 --- a/test/src/filelock-tests.el +++ b/test/src/filelock-tests.el @@ -109,7 +109,7 @@ the case)." (ert-deftest filelock-tests-lock-spoiled () "Check `lock-buffer'." - (skip-unless (not (eq system-type 'ms-dos))) ; no filelock support + (skip-when (eq system-type 'ms-dos)) ; no filelock support (filelock-tests--fixture (filelock-tests--spoil-lock-file buffer-file-truename) ;; FIXME: errors when locking a file are ignored; should they be? @@ -119,7 +119,7 @@ the case)." (ert-deftest filelock-tests-file-locked-p-spoiled () "Check that `file-locked-p' fails if the lockfile is \"spoiled\"." - (skip-unless (not (eq system-type 'ms-dos))) ; no filelock support + (skip-when (eq system-type 'ms-dos)) ; no filelock support (filelock-tests--fixture (filelock-tests--spoil-lock-file buffer-file-truename) (let ((err (should-error (file-locked-p (buffer-file-name))))) @@ -130,7 +130,7 @@ the case)." (ert-deftest filelock-tests-unlock-spoiled () "Check that `unlock-buffer' fails if the lockfile is \"spoiled\"." - (skip-unless (not (eq system-type 'ms-dos))) ; no filelock support + (skip-when (eq system-type 'ms-dos)) ; no filelock support (filelock-tests--fixture ;; Set the buffer modified with file locking temporarily disabled. (let ((create-lockfiles nil)) @@ -150,7 +150,7 @@ the case)." (ert-deftest filelock-tests-kill-buffer-spoiled () "Check that `kill-buffer' fails if a lockfile is \"spoiled\"." - (skip-unless (not (eq system-type 'ms-dos))) ; no filelock support + (skip-when (eq system-type 'ms-dos)) ; no filelock support (filelock-tests--fixture ;; Set the buffer modified with file locking temporarily disabled. (let ((create-lockfiles nil)) @@ -176,7 +176,7 @@ the case)." (ert-deftest filelock-tests-detect-external-change () "Check that an external file modification is reported." - (skip-unless (not (eq system-type 'ms-dos))) ; no filelock support + (skip-when (eq system-type 'ms-dos)) ; no filelock support (skip-unless (executable-find "touch")) (skip-unless (executable-find "echo")) (dolist (cl '(t nil)) diff --git a/test/src/image-tests.el b/test/src/image-tests.el index 317f4d3aab6..3eec2bb4c60 100644 --- a/test/src/image-tests.el +++ b/test/src/image-tests.el @@ -44,15 +44,15 @@ (xpm . ,(find-image '((:file "splash.xpm" :type xpm)))))) (ert-deftest image-tests-image-size/error-on-nongraphical-display () - (skip-unless (not (display-images-p))) + (skip-when (display-images-p)) (should-error (image-size 'invalid-spec))) (ert-deftest image-tests-image-mask-p/error-on-nongraphical-display () - (skip-unless (not (display-images-p))) + (skip-when (display-images-p)) (should-error (image-mask-p (cdr (assq 'xpm image-tests--images))))) (ert-deftest image-tests-image-metadata/error-on-nongraphical-display () - (skip-unless (not (display-images-p))) + (skip-when (display-images-p)) (should-error (image-metadata (cdr (assq 'xpm image-tests--images))))) (ert-deftest image-tests-imagemagick-types () diff --git a/test/src/process-tests.el b/test/src/process-tests.el index e17e1c0d833..711a27f1cfb 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -231,7 +231,7 @@ process to complete." (with-timeout (60 (ert-fail "Test timed out")) ;; Frequent random (?) failures on hydra.nixos.org, with no process output. ;; Maybe this test should be tagged unstable? See bug#31214. - (skip-unless (not (getenv "EMACS_HYDRA_CI"))) + (skip-when (getenv "EMACS_HYDRA_CI")) (with-temp-buffer (let ((process (make-process :name "mix-stderr" @@ -723,7 +723,7 @@ FD_SETSIZE file descriptors (Bug#24325)." (skip-unless (featurep 'make-network-process '(:server t))) (skip-unless (featurep 'make-network-process '(:family local))) ;; Avoid hang due to connect/accept handshake on Cygwin (bug#49496). - (skip-unless (not (eq system-type 'cygwin))) + (skip-when (eq system-type 'cygwin)) (with-timeout (60 (ert-fail "Test timed out")) (ert-with-temp-directory directory (process-tests--with-processes processes @@ -763,7 +763,7 @@ FD_SETSIZE file descriptors (Bug#24325)." "Check that Emacs doesn't crash when trying to use more than FD_SETSIZE file descriptors (Bug#24325)." ;; This test cannot be run if PTYs aren't supported. - (skip-unless (not (eq system-type 'windows-nt))) + (skip-when (eq system-type 'windows-nt)) (with-timeout (60 (ert-fail "Test timed out")) (process-tests--with-processes processes ;; In order to use `make-serial-process', we need to create some -- 2.39.2