Replace usages of -first, -any? and -all?

pull/1871/head
Bozhidar Batsov 2024-02-05 13:34:10 +02:00
parent 40bd97ac05
commit a36bddd750
3 changed files with 18 additions and 18 deletions

View File

@ -270,8 +270,8 @@ failed, and the test aborted with failure.")
Raise an assertion error if the buffer is not clear afterwards."
(flycheck-clear)
(should (not flycheck-current-errors))
(should (not (-any? (lambda (ov) (overlay-get ov 'flycheck-overlay))
(overlays-in (point-min) (point-max))))))
(should (not (seq-find (lambda (ov) (overlay-get ov 'flycheck-overlay))
(overlays-in (point-min) (point-max))))))
;;; Test assertions
@ -286,11 +286,11 @@ Raise an assertion error if the buffer is not clear afterwards."
"Test that ERROR has a proper overlay in the current buffer.
ERROR is a Flycheck error object."
(let* ((overlay (-first (lambda (ov)
(equal (flycheck-error-without-group
(overlay-get ov 'flycheck-error))
(flycheck-error-without-group error)))
(flycheck-overlays-in 0 (+ 1 (buffer-size)))))
(let* ((overlay (seq-find (lambda (ov)
(equal (flycheck-error-without-group
(overlay-get ov 'flycheck-error))
(flycheck-error-without-group error)))
(flycheck-overlays-in 0 (+ 1 (buffer-size)))))
(region
;; Overlays of errors from other files are on the first line
(if (flycheck-relevant-error-other-file-p error)

View File

@ -12318,7 +12318,7 @@ published on NPM."
(defun flycheck--textlint-get-plugin ()
"Return the textlint plugin for the current mode."
(cdr (-first
(cdr (seq-find
(lambda (arg)
(pcase-let ((`(,mode . _) arg))
(or (and (booleanp mode) mode) ; mode is t

View File

@ -43,8 +43,8 @@
;;; Requirements
(require 'dash)
(require 'cl-lib)
(require 'seq)
(require 'ert) ; Unit test library
(require 'shut-up) ; Silence Emacs and intercept `message'
@ -618,7 +618,7 @@
:tags '(checker-api)
(dolist (checker flycheck-checkers)
(should (listp (flycheck-checker-get checker 'modes)))
(should (-all? #'symbolp (flycheck-checker-get checker 'modes)))))
(should (seq-every-p #'symbolp (flycheck-checker-get checker 'modes)))))
(ert-deftest flycheck-substitute-argument/source ()
:tags '(checker-api)
@ -1161,23 +1161,23 @@
(ert-deftest flycheck-may-check-automatically/not-in-ephemeral-buffers ()
:tags '(automatic)
(flycheck-ert-with-temp-buffer
(should-not (-any? #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should-not (seq-find #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should-not (flycheck-may-check-automatically))))
(ert-deftest flycheck-may-check-automatically/in-normal-buffers ()
:tags '(automatic)
(flycheck-ert-with-resource-buffer "automatic-check-dummy.el"
(should (-all? #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should (seq-every-p #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should (flycheck-may-check-automatically))))
(ert-deftest flycheck-may-check-automatically/automatic-checking-disabled ()
:tags '(automatic)
(flycheck-ert-with-resource-buffer "automatic-check-dummy.el"
(let ((flycheck-check-syntax-automatically nil))
(should-not (-any? #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should-not (seq-find #'flycheck-may-check-automatically
'(save idle-change new-line mode-enabled)))
(should (flycheck-may-check-automatically)))))
(ert-deftest flycheck-may-check-automatically/specific-event-disabled ()
@ -1189,8 +1189,8 @@
(remq event flycheck-check-syntax-automatically)))
(should flycheck-check-syntax-automatically)
(should-not (flycheck-may-check-automatically event))
(should (-all? #'flycheck-may-check-automatically
flycheck-check-syntax-automatically))
(should (seq-every-p #'flycheck-may-check-automatically
flycheck-check-syntax-automatically))
(should (flycheck-may-check-automatically))))))
(ert-deftest flycheck-check-syntax-automatically/mode-enabled-is-disabled ()