[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat cf19a498bf 1/2: Prefix tests with compat- (Fix #
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat cf19a498bf 1/2: Prefix tests with compat- (Fix #20) |
Date: |
Sun, 19 Mar 2023 07:57:39 -0400 (EDT) |
branch: externals/compat
commit cf19a498bf98569bcb4a97351411937b9ee4fcf6
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Prefix tests with compat- (Fix #20)
---
compat-tests.el | 376 ++++++++++++++++++++++++++++----------------------------
1 file changed, 188 insertions(+), 188 deletions(-)
diff --git a/compat-tests.el b/compat-tests.el
index 8b93c704b4..a4e80de031 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -33,7 +33,7 @@
;; :follow
;; (lambda (link _)
;; (org-link-open-from-string
-;; (format "[[file:compat-tests.el::ert-deftest %s ()]]" link))))
+;; (format "[[file:compat-tests.el::ert-deftest compat-%s ()]]" link))))
;;
;; You can then jump to the links with the command
;; `org-open-at-point-global', ideally bound to a convenient key.
@@ -79,14 +79,14 @@
(declare (indent 2))
(if (eval cond t) then (macroexp-progn else)))
-(ert-deftest compat-loaded-features ()
+(ert-deftest compat-compat-loaded-features ()
(let ((version 0))
(while (< version 30)
(should-equal (> version emacs-major-version)
(featurep (intern (format "compat-%s" version))))
(setq version (1+ version)))))
-(ert-deftest compat-function ()
+(ert-deftest compat-compat-function ()
(let ((sym (compat-function plist-put)) list)
(should sym)
(should (symbolp sym))
@@ -94,11 +94,11 @@
(should-equal (compat-call plist-get list "first" #'string=) 1)))
(defconst compat-tests--version (package-get-version))
-(ert-deftest package-get-version ()
+(ert-deftest compat-package-get-version ()
(should (stringp compat-tests--version))
(should-equal 29 (car (version-to-list compat-tests--version))))
-(ert-deftest buffer-match-p ()
+(ert-deftest compat-buffer-match-p ()
(let ((b "*compat-test-buffer*")
(child-mode (make-symbol "child"))
(parent-mode (make-symbol "parent")))
@@ -118,7 +118,7 @@
(should (buffer-match-p `(and (major-mode . ,child-mode) "compat" t) b))
(should (buffer-match-p `(or (major-mode . prog-mode) "foo" t) b))))
-(ert-deftest match-buffers ()
+(ert-deftest compat-match-buffers ()
(let ((b1 (get-buffer-create "*compat-buffer1*"))
(b2 (get-buffer-create "*compat-buffer2*"))
(b3 (get-buffer-create "*compat-buffer3*"))
@@ -132,7 +132,7 @@
(match-buffers `(or (major-mode . ,m1) (major-mode . ,m2))
(list b1 b2 b3)))))
-(ert-deftest thing-at-mouse ()
+(ert-deftest compat-thing-at-mouse ()
(save-window-excursion
(with-temp-buffer
(let ((event `(mouse-1 (,(selected-window) 1 (0 . 0) 0))))
@@ -150,7 +150,7 @@
(should-equal (point) 1)
(should-equal '((1 . 18)) (region-bounds))))))
-(ert-deftest dolist-with-progress-reporter ()
+(ert-deftest compat-dolist-with-progress-reporter ()
(let (y)
(should-equal
(dolist-with-progress-reporter (x '(1 2 3) y) "Reporter"
@@ -163,7 +163,7 @@
(push x y))
'(3 2 1))))
-(ert-deftest minibuffer-history-value ()
+(ert-deftest compat-minibuffer-history-value ()
(let ((minibuffer-history-variable 'file-name-history)
(file-name-history '("a" "b" "c")))
(should-equal (minibuffer-history-value) '("a" "b" "c")))
@@ -179,7 +179,7 @@
nil nil nil 'file-name-history))))
'("x" "y" "z"))))
-(ert-deftest with-minibuffer-selected-window ()
+(ert-deftest compat-with-minibuffer-selected-window ()
(let (ran)
(should-not (minibuffer-selected-window))
(should-not (with-minibuffer-selected-window
@@ -194,19 +194,19 @@
(should ran))
(advice-remove #'minibuffer-selected-window #'selected-window))))
-(ert-deftest fixnump ()
+(ert-deftest compat-fixnump ()
(should (fixnump 0))
(should (fixnump most-negative-fixnum))
(should (fixnump most-positive-fixnum)))
-(ert-deftest bignump ()
+(ert-deftest compat-bignump ()
(should-not (bignump 0))
(should-not (bignump most-negative-fixnum))
(should-not (bignump most-positive-fixnum))
(should-equal (bignump (1+ most-positive-fixnum)) (> emacs-major-version 26))
(should-equal (bignump (1- most-negative-fixnum)) (> emacs-major-version
26)))
-(ert-deftest buttonize ()
+(ert-deftest compat-buttonize ()
(let ((b (buttonize "button" 'c 'd 'h)))
(should-equal b "button")
(should-equal 'c (get-text-property 0 'action b))
@@ -216,7 +216,7 @@
(should-equal 'h (get-text-property 0 'help-echo b))
(should-equal 'h (get-text-property 5 'help-echo b))))
-(ert-deftest button-buttonize ()
+(ert-deftest compat-button-buttonize ()
(let ((b (with-no-warnings (button-buttonize "button" 'c 'd))))
(should-equal b "button")
(should-equal 'c (get-text-property 0 'action b))
@@ -224,7 +224,7 @@
(should-equal 'd (get-text-property 0 'button-data b))
(should-equal 'd (get-text-property 5 'button-data b))))
-(ert-deftest buttonize-region ()
+(ert-deftest compat-buttonize-region ()
(with-temp-buffer
(insert "<button>")
(buttonize-region 2 7 'c 'd 'h)
@@ -237,7 +237,7 @@
(should-equal 'h (get-text-property 2 'help-echo))
(should-equal 'h (get-text-property 6 'help-echo))))
-(ert-deftest with-restriction ()
+(ert-deftest compat-with-restriction ()
(with-temp-buffer
(insert "abc")
(with-restriction 2 3 :label 'foo
@@ -247,7 +247,7 @@
(should-equal "b" (buffer-string)))
(should-equal "abc" (buffer-string))))
-(ert-deftest without-restriction ()
+(ert-deftest compat-without-restriction ()
(with-temp-buffer
(insert "abc")
(narrow-to-region 2 3)
@@ -258,7 +258,7 @@
(should-equal "abc" (buffer-string)))
(should-equal "b" (buffer-string))))
-(ert-deftest with-memoization ()
+(ert-deftest compat-with-memoization ()
(let ((x (cons nil nil)) y computed)
(with-memoization (car x)
(setq computed 'a))
@@ -285,14 +285,14 @@
(should-equal y 'e)
(should-equal computed 'e)))
-(ert-deftest make-separator-line ()
+(ert-deftest compat-make-separator-line ()
(should-equal (length (make-separator-line 10)) 11)
(should (string-suffix-p "\n" (make-separator-line 10)))
(should (string-suffix-p "\n" (make-separator-line)))
(should-equal (replace-regexp-in-string
"[^\n]" "" (make-separator-line)) "\n"))
-(ert-deftest pos-bol ()
+(ert-deftest compat-pos-bol ()
(with-temp-buffer
(insert (propertize "one" 'field 1)
(propertize "two" 'field 2)
@@ -329,7 +329,7 @@
(should-equal (pos-bol 0) 1)
(should-equal (pos-eol 0) 10)))
-(ert-deftest image-property ()
+(ert-deftest compat-image-property ()
(let ((image (list 'image)))
;; Add properties.
(setf (image-property image :scale) 1)
@@ -348,7 +348,7 @@
(setf (image-property image :width) nil)
(should-equal image '(image))))
-(ert-deftest read-answer ()
+(ert-deftest compat-read-answer ()
(let ((orig-re (symbol-function #'read-event))
(orig-rc (symbol-function #'read-char))
(orig-rm (symbol-function #'read-from-minibuffer)))
@@ -367,7 +367,7 @@
(fset #'read-char orig-rc)
(fset #'read-from-minibuffer orig-rm))))
-(ert-deftest read-multiple-choice ()
+(ert-deftest compat-read-multiple-choice ()
(let ((orig-re (symbol-function #'read-event))
(orig-rc (symbol-function #'read-char))
(orig-cr completing-read-function))
@@ -388,7 +388,7 @@
(fset #'read-char orig-rc)
(setq completing-read-function orig-cr))))
-(ert-deftest read-char-from-minibuffer ()
+(ert-deftest compat-read-char-from-minibuffer ()
(let ((orig (symbol-function #'read-from-minibuffer)))
(unwind-protect
(progn
@@ -399,14 +399,14 @@
(should-equal ?a (read-char-from-minibuffer "Prompt: ")))
(fset #'read-from-minibuffer orig))))
-(ert-deftest with-environment-variables ()
+(ert-deftest compat-with-environment-variables ()
(let ((A "COMPAT_TESTS__VAR") (B "/foo/bar"))
(should-not (getenv A))
(with-environment-variables ((A B))
(should-equal (getenv A) B))
(should-not (getenv A))))
-(ert-deftest with-window-non-dedicated ()
+(ert-deftest compat-with-window-non-dedicated ()
(unwind-protect
(progn
(should-not (window-dedicated-p))
@@ -417,12 +417,12 @@
(should (window-dedicated-p)))
(set-window-dedicated-p nil nil)))
-(ert-deftest count-windows ()
+(ert-deftest compat-count-windows ()
(should (fixnump (compat-call count-windows)))
(should (fixnump (compat-call count-windows t)))
(should (fixnump (compat-call count-windows t t))))
-(ert-deftest recenter ()
+(ert-deftest compat-recenter ()
(save-window-excursion
(set-window-buffer nil (current-buffer))
(compat-call recenter nil nil)
@@ -430,7 +430,7 @@
(compat-call recenter 1 nil)
(compat-call recenter 1 t)))
-(ert-deftest get-display-property ()
+(ert-deftest compat-get-display-property ()
(with-temp-buffer
(insert (propertize "foo" 'face 'bold 'display '(height 2.0)))
(should-equal (get-display-property 2 'height) 2.0))
@@ -446,7 +446,7 @@
(should-equal (get-display-property 2 'height) 2.0)
(should-equal (get-display-property 2 'space-width) 20)))
-(ert-deftest add-display-text-property ()
+(ert-deftest compat-add-display-text-property ()
(with-temp-buffer
(insert "Foo bar zot gazonk")
(add-display-text-property 4 8 'height 2.0)
@@ -473,7 +473,7 @@
4 8 (display ((raise 0.5) (height 2.0)))
8 12 (display (raise 0.5))))))
-(ert-deftest line-number-at-pos ()
+(ert-deftest compat-line-number-at-pos ()
(with-temp-buffer
(insert "\n\n\n")
(narrow-to-region (1+ (point-min)) (point-max))
@@ -519,12 +519,12 @@
"C-c" mode-specific-map
"s-c" "C-c C-c"
"<t>" 'compat-default-command))
-(ert-deftest defvar-keymap ()
+(ert-deftest compat-defvar-keymap ()
(should-equal compat-tests--map-1 compat-tests--map-2)
(should-equal compat-tests--map-1 compat-tests--map-3)
(should-equal compat-tests--map-1 compat-tests--map-4))
-(ert-deftest keymap-set-after ()
+(ert-deftest compat-keymap-set-after ()
(let ((map (make-sparse-keymap)))
(keymap-set-after map "d" 'd "a")
(keymap-set-after map "a" 'a)
@@ -533,7 +533,7 @@
(keymap-set-after map "d" 'd "b") ;; TODO the after argument has no
effect?!
(should-equal map '(keymap (?a . a) (?b . b) (?c . c) (?d . d)))))
-(ert-deftest keymap-substitute ()
+(ert-deftest compat-keymap-substitute ()
(let ((map (define-keymap
"C-x C-f" #'find-file
"s-f" #'find-file
@@ -543,7 +543,7 @@
(should-equal (keymap-lookup map "C-x C-f") 'ffap)
(should-equal (keymap-lookup map "s-f") 'ffap)))
-(ert-deftest key-parse ()
+(ert-deftest compat-key-parse ()
(should-equal (key-parse "f") [?f])
(should-equal (key-parse "X") [?X])
(should-equal (key-parse "X f") [?X ?f])
@@ -634,12 +634,12 @@
(should-equal (key-parse "<mouse-1>") [mouse-1])
(should-equal (key-parse "<Scroll_Lock>") [Scroll_Lock]))
-(ert-deftest keymap--check ()
+(ert-deftest compat-keymap--check ()
(keymap--check "X")
(should-error (keymap--check ""))
(should-error (keymap--check " X")))
-(ert-deftest key-valid-p ()
+(ert-deftest compat-key-valid-p ()
(should-not (key-valid-p ""))
(should (key-valid-p "f"))
(should (key-valid-p "X"))
@@ -757,7 +757,7 @@
(should-not (key-valid-p "M-xx"))
(should-not (key-valid-p "M-x<TAB>")))
-(ert-deftest keymap-lookup ()
+(ert-deftest compat-keymap-lookup ()
(should-not (keymap-lookup compat-tests--map-1 "C-x b"))
(should-equal (keymap-lookup compat-tests--map-1 "C-x C-f") #'find-file)
(should-equal (keymap-lookup compat-tests--map-1 "RET") #'exit-minibuffer)
@@ -766,7 +766,7 @@
(should-not (keymap-lookup compat-tests--map-1 "x"))
(should-equal (keymap-lookup compat-tests--map-1 "x" t)
'compat-default-command))
-(ert-deftest keymap-local-lookup ()
+(ert-deftest compat-keymap-local-lookup ()
(let ((orig (current-local-map)))
(unwind-protect
(progn
@@ -781,7 +781,7 @@
(should-equal (keymap-local-lookup "x" t) 'compat-default-command))
(use-local-map orig))))
-(ert-deftest keymap-local-set ()
+(ert-deftest compat-keymap-local-set ()
(let ((orig (current-local-map)))
(unwind-protect
(progn
@@ -796,7 +796,7 @@
(use-local-map orig))
(should-not (keymap-local-lookup "s-c"))))
-(ert-deftest keymap-global-set ()
+(ert-deftest compat-keymap-global-set ()
(let ((orig (current-global-map)))
(unwind-protect
(progn
@@ -811,12 +811,12 @@
(use-global-map orig))
(should-not (keymap-global-lookup "s-c"))))
-(ert-deftest keymap-global-lookup ()
+(ert-deftest compat-keymap-global-lookup ()
(should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer)
(should-equal (keymap-global-lookup "C-x C-f") #'find-file)
(should-equal (keymap-global-lookup "C-c") #'mode-specific-command-prefix))
-(ert-deftest keymap-unset ()
+(ert-deftest compat-keymap-unset ()
(let ((map (make-sparse-keymap)))
(define-key map "\M-x" #'execute-extended-command)
(define-key map "\C-x\C-f" #'find-file)
@@ -834,7 +834,7 @@
(keymap-unset map "C-y" t)
(should-equal map '(keymap (24 keymap) (27 keymap)))))
-(ert-deftest keymap-local-unset ()
+(ert-deftest compat-keymap-local-unset ()
(let ((map (make-sparse-keymap))
(orig (current-local-map)))
(unwind-protect
@@ -849,7 +849,7 @@
(should-equal (current-local-map) '(keymap (24 keymap) (27 keymap
(120)))))
(use-local-map orig))))
-(ert-deftest keymap-global-unset ()
+(ert-deftest compat-keymap-global-unset ()
(let ((map (make-sparse-keymap))
(orig (current-global-map)))
(unwind-protect
@@ -864,7 +864,7 @@
(should-equal (current-global-map) '(keymap (24 keymap) (27 keymap
(120)))))
(use-global-map orig))))
-(ert-deftest define-key ()
+(ert-deftest compat-define-key ()
(let ((map (make-sparse-keymap)))
(define-key map "\M-x" #'execute-extended-command)
(define-key map "\C-x\C-f" #'find-file)
@@ -874,7 +874,7 @@
(compat-call define-key map "\C-y" nil t)
(should-equal map '(keymap (24 keymap) (27 keymap)))))
-(ert-deftest function-alias-p ()
+(ert-deftest compat-function-alias-p ()
(defun compat-tests--alias-fun ())
(should-not (function-alias-p 1))
(should-not (function-alias-p 'compat-tests--alias-fun))
@@ -896,7 +896,7 @@
(should-equal (function-alias-p 'compat-tests--cyclic-alias-a t)
'(compat-tests--cyclic-alias-b))))
-(ert-deftest ignore-error ()
+(ert-deftest compat-ignore-error ()
(should-equal (ignore-error (end-of-file)
(read ""))
nil)
@@ -906,13 +906,13 @@
(should-error (ignore-error foo
(read ""))))
-(ert-deftest hash-table-empty-p ()
+(ert-deftest compat-hash-table-empty-p ()
(should (hash-table-empty-p (make-hash-table)))
(let ((ht (make-hash-table)))
(puthash 'k 'v ht)
(should-not (hash-table-empty-p ht))))
-(ert-deftest thread-first ()
+(ert-deftest compat-thread-first ()
(should-equal (thread-first (+ 40 2)) 42)
(should-equal (thread-first
5
@@ -927,7 +927,7 @@
(append (list "good")))
(list "this" "is" "good")))
-(ert-deftest thread-last ()
+(ert-deftest compat-thread-last ()
(should-equal (thread-last (+ 40 2)) 42)
(should-equal (thread-last
5
@@ -942,22 +942,22 @@
(format "abs sum is: %s"))
"abs sum is: 15"))
-(ert-deftest ntake ()
+(ert-deftest compat-ntake ()
(should-not (ntake 5 nil))
(should-equal '(1 2) (ntake 5 '(1 2)))
(should-equal '(1 2 3) (ntake 3 '(1 2 3 4))))
-(ert-deftest take ()
+(ert-deftest compat-take ()
(should-not (take 5 nil))
(should-equal '(1 2) (take 5 '(1 2)))
(should-equal '(1 2 3) (take 3 '(1 2 3 4))))
-(ert-deftest format-message ()
+(ert-deftest compat-format-message ()
(should-equal (format-message "a=%s b=%s" 1 2) "a=1 b=2"))
(defvar compat-tests--boundp)
(defvar compat-tests--global-boundp)
-(ert-deftest buffer-local-boundp ()
+(ert-deftest compat-buffer-local-boundp ()
(let ((buf (generate-new-buffer "boundp")))
(with-current-buffer buf
(setq-local compat-tests--boundp t))
@@ -969,7 +969,7 @@
(defvar compat-tests--local-a nil)
(defvar compat-tests--local-b nil)
(defvar compat-tests--local-c nil)
-(ert-deftest setq-local ()
+(ert-deftest compat-setq-local ()
(compat-call setq-local
compat-tests--local-a 1
compat-tests--local-b 2
@@ -981,7 +981,7 @@
(defvar compat-tests--global)
(defvar compat-tests--local)
(defvar compat-tests--unexist)
-(ert-deftest buffer-local-set-state ()
+(ert-deftest compat-buffer-local-set-state ()
(setq compat-tests--global 1)
(with-temp-buffer
(setq-local compat-tests--local 2)
@@ -996,7 +996,7 @@
(should-equal compat-tests--local 2)
(should-not (boundp 'compat-tests--unexist)))))
-(ert-deftest gensym ()
+(ert-deftest compat-gensym ()
(let ((orig gensym-counter))
(should (integerp gensym-counter))
(should (symbolp (gensym "compat")))
@@ -1004,14 +1004,14 @@
(should (string-prefix-p "compat" (symbol-name (gensym "compat"))))
(should-equal gensym-counter (+ orig 3))))
-(ert-deftest delete-line ()
+(ert-deftest compat-delete-line ()
(with-temp-buffer
(insert "first\nsecond\nthird\n")
(goto-char 7)
(delete-line)
(should-equal (buffer-string) "first\nthird\n")))
-(ert-deftest list-of-strings-p ()
+(ert-deftest compat-list-of-strings-p ()
(should-not (list-of-strings-p 1))
(should (list-of-strings-p nil))
(should (list-of-strings-p '("a" "b")))
@@ -1019,7 +1019,7 @@
(should-not (list-of-strings-p '("a" nil "b")))
(should-not (list-of-strings-p '("a" "b" . "c"))))
-(ert-deftest plistp ()
+(ert-deftest compat-plistp ()
(should (plistp '(:a a :b b)))
(should (plistp '(1 2 3 4)))
(should-not (plistp '(1 2 3)))
@@ -1029,7 +1029,7 @@
(setf (nthcdr 3 l) l)
(plistp l))))
-(ert-deftest plist-get ()
+(ert-deftest compat-plist-get ()
(let (list)
(setq list (compat-call plist-put list 'first 1))
(setq list (compat-call plist-put list 'second 2))
@@ -1047,10 +1047,10 @@
(should (compat-call plist-member list "first" #'string=))
(should-not (compat-call plist-member list "third" #'string=))))
-(ert-deftest garbage-collect-maybe ()
+(ert-deftest compat-garbage-collect-maybe ()
(garbage-collect-maybe 10))
-(ert-deftest buffer-hash ()
+(ert-deftest compat-buffer-hash ()
(should-equal (sha1 "foo") "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33")
(should-equal (with-temp-buffer
(insert "foo")
@@ -1066,7 +1066,7 @@
(buffer-hash))
(sha1 "foo")))
-(ert-deftest with-buffer-unmodified-if-unchanged ()
+(ert-deftest compat-with-buffer-unmodified-if-unchanged ()
(with-temp-buffer
(with-buffer-unmodified-if-unchanged
(insert "t"))
@@ -1097,7 +1097,7 @@
(with-current-buffer inner
(should-not (buffer-modified-p))))))))
-(ert-deftest insert-into-buffer ()
+(ert-deftest compat-insert-into-buffer ()
;; Without optional compat--arguments
(with-temp-buffer
(let ((other (current-buffer)))
@@ -1123,7 +1123,7 @@
(insert-into-buffer other 2 3))
(should-equal (buffer-string) "abce"))))
-(ert-deftest bool-vector ()
+(ert-deftest compat-bool-vector ()
(should-equal (bool-vector) (bool-vector-not (bool-vector)))
(should-equal (bool-vector t) (bool-vector-not (bool-vector nil)))
(should-equal (bool-vector nil) (bool-vector-not (bool-vector t)))
@@ -1132,7 +1132,7 @@
(should-equal (bool-vector nil t) (bool-vector-not (bool-vector t nil)))
(should-equal (bool-vector nil nil) (bool-vector-not (bool-vector t t))))
-(ert-deftest assoc ()
+(ert-deftest compat-assoc ()
;; Fallback behaviour:
(should-not (compat-call assoc 1 nil)) ;empty list
(should-equal '(1) (compat-call assoc 1 '((1)))) ;single element
list
@@ -1159,7 +1159,7 @@
("\\.awk\\'" . awk-mode))
#'string-match-p)))
-(ert-deftest assoc-delete-all ()
+(ert-deftest compat-assoc-delete-all ()
(should-equal (list) (assoc-delete-all 0 (list)))
;; Test `eq'
(should-equal '((1 . one)) (assoc-delete-all 0 (list (cons 1 'one))))
@@ -1186,7 +1186,7 @@
(should-equal '((0 . zero) a (0 . zero)) (compat-call assoc-delete-all 0
(list (cons 0 'zero) (cons 1 'one) 'a (cons 0 'zero)) #'/=))
(should-equal '(a (0 . zero) (0 . zero)) (compat-call assoc-delete-all 0
(list 'a (cons 0 'zero) (cons 1 'one) (cons 0 'zero)) #'/=)))
-(ert-deftest provided-derived-mode-p ()
+(ert-deftest compat-provided-derived-mode-p ()
(let ((one (make-symbol "1"))
(two (make-symbol "2"))
(three (make-symbol "3"))
@@ -1216,7 +1216,7 @@
(should-equal three (derived-mode-p one.5 two one three))
(should-equal three (derived-mode-p one.5 three two one)))))
-(ert-deftest format-prompt ()
+(ert-deftest compat-format-prompt ()
(should-equal "Prompt: " (format-prompt "Prompt" nil))
(should-equal "Prompt: " (format-prompt "Prompt" ""))
(should-equal "Prompt (default ): " (format-prompt "Prompt" " "))
@@ -1226,7 +1226,7 @@
(should-equal "Prompt 10: " (format-prompt "Prompt %d" nil 10))
(should-equal "Prompt \"abc\" (default 3): " (format-prompt "Prompt %S" 3
"abc")))
-(ert-deftest cXXXr ()
+(ert-deftest compat-cXXXr ()
(let ((xxx '(((a . b) . (c . d)) . ((e . f) . (g . h)))))
(should-not (caaar ()))
(should-not (caadr ()))
@@ -1245,7 +1245,7 @@
(should-equal 'd (cddar xxx))
(should-equal 'h (cdddr xxx))))
-(ert-deftest cXXXXr ()
+(ert-deftest compat-cXXXXr ()
(let ((xxxx
'((((a . b) . (c . d)) . ((e . f) . (g . h))) .
(((i . j) . (k . l)) . ((m . j) . (o . p))))))
@@ -1280,22 +1280,22 @@
(should-equal 'l (cddadr xxxx))
(should-equal 'h (cdddar xxxx))))
-(ert-deftest compiled-function-p ()
+(ert-deftest compat-compiled-function-p ()
(should-not (compiled-function-p '(lambda (x) x)))
(should (compiled-function-p (symbol-function 'assq)))
(should (compiled-function-p (symbol-function 'identity))))
-(ert-deftest subr-native-elisp-p ()
+(ert-deftest compat-subr-native-elisp-p ()
(should-not (subr-native-elisp-p (symbol-function 'identity))))
-(ert-deftest subr-primitive-p ()
+(ert-deftest compat-subr-primitive-p ()
(should (subr-primitive-p (symbol-function 'identity))) ;function from
fns.c
(when (< emacs-major-version 28)
(should-not (subr-primitive-p (symbol-function 'match-string)))) ;function
from subr.el
(should-not (subr-primitive-p (symbol-function 'defun))) ;macro from
subr.el
(should-not (subr-primitive-p nil)))
-(ert-deftest mapcan ()
+(ert-deftest compat-mapcan ()
(should-not (mapcan #'identity nil))
(should-equal (list 1)
(mapcan #'identity
@@ -1316,13 +1316,13 @@
(mapcan #'identity
(list (list) (list) (list) (list)))))
-(ert-deftest xor ()
+(ert-deftest compat-xor ()
(should (xor t nil))
(should (xor nil t))
(should-not (xor nil nil))
(should-not (xor t t)))
-(ert-deftest length= ()
+(ert-deftest compat-length= ()
(should (length= '() 0)) ;empty list
(should (length= '(1) 1)) ;single element
(should (length= '(1 2 3) 3)) ;multiple elements
@@ -1338,7 +1338,7 @@
(should-not (length= [1 2 3] 4)) ;more than
(should-error (length= 3 nil) :type 'wrong-type-argument))
-(ert-deftest length< ()
+(ert-deftest compat-length< ()
(should-not (length< '(1) 0)) ;single element
(should-not (length< '(1 2 3) 2)) ;multiple elements
(should-not (length< '(1 2 3) 3)) ;equal length
@@ -1352,7 +1352,7 @@
(should (length< [1 2 3] 4)) ;more than
(should-error (length< 3 nil) :type 'wrong-type-argument))
-(ert-deftest length> ()
+(ert-deftest compat-length> ()
(should (length> '(1) 0)) ;single element
(should (length> '(1 2 3) 2)) ;multiple elements
(should-not (length> '(1 2 3) 3)) ;equal length
@@ -1366,13 +1366,13 @@
(should-not (length> [1 2 3] 4)) ;more than
(should-error (length< 3 nil) :type 'wrong-type-argument))
-(ert-deftest ensure-list ()
+(ert-deftest compat-ensure-list ()
(should-not (ensure-list nil)) ;; empty list
(should-equal '(1) (ensure-list '(1))) ;; single element list
(should-equal '(1 2 3) (ensure-list '(1 2 3))) ;; multiple element list
(should-equal '(1) (ensure-list 1))) ;; atom
-(ert-deftest proper-list-p ()
+(ert-deftest compat-proper-list-p ()
(should-equal 0 (proper-list-p ())) ;; empty list
(should-equal 1 (proper-list-p '(1))) ;; single element
(should-equal 3 (proper-list-p '(1 2 3))) ;; multiple elements
@@ -1387,12 +1387,12 @@
(should-not (proper-list-p []))
(should-not (proper-list-p [1 2 3])))
-(ert-deftest always ()
+(ert-deftest compat-always ()
(should-equal t (always)) ;; no arguments
(should-equal t (always 1)) ;; single argument
(should-equal t (always 1 2 3 4))) ;; multiple arguments
-(ert-deftest file-backup-file-names ()
+(ert-deftest compat-file-backup-file-names ()
(ert-with-temp-directory dir
(let ((file (file-name-concat dir "file")) backups)
(make-empty-file file)
@@ -1405,7 +1405,7 @@
(make-empty-file (car backups))
(should-equal backups (sort (file-backup-file-names file) #'string<)))))
-(ert-deftest make-temp-file ()
+(ert-deftest compat-make-temp-file ()
(let ((file (compat-call make-temp-file "compat-tests" nil nil
"test-content")))
(unwind-protect
(with-temp-buffer
@@ -1413,7 +1413,7 @@
(should-equal "test-content" (buffer-string)))
(delete-file file))))
-(ert-deftest make-nearby-temp-file ()
+(ert-deftest compat-make-nearby-temp-file ()
(let ((file1 (make-nearby-temp-file "compat-tests"))
(file2 (make-nearby-temp-file "compat-tests" nil "suffix"))
(dir (make-nearby-temp-file "compat-tests" t)))
@@ -1436,7 +1436,7 @@
(should (string-match-p "\\`/mock:.*:/tmp/compat-tests" file))
(delete-file file)))))
-(ert-deftest executable-find ()
+(ert-deftest compat-executable-find ()
(should (member (executable-find "sh") '("/usr/bin/sh" "/bin/sh")))
(should (member (executable-find "ls") '("/usr/bin/ls" "/bin/ls")))
;; Tramp test (mock protocol)
@@ -1444,13 +1444,13 @@
(should (member (compat-call executable-find "sh" t) '("/usr/bin/sh"
"/bin/sh")))
(should (member (compat-call executable-find "ls" t) '("/usr/bin/ls"
"/bin/ls")))))
-(ert-deftest exec-path ()
+(ert-deftest compat-exec-path ()
(should-equal (exec-path) exec-path)
;; Tramp test (mock protocol)
(let ((default-directory "/mock::/"))
(should (member "/bin" (exec-path)))))
-(ert-deftest with-existing-directory ()
+(ert-deftest compat-with-existing-directory ()
(let ((dir (make-temp-name "/tmp/not-exist-")))
(let ((default-directory dir))
(should-not (file-exists-p default-directory)))
@@ -1458,7 +1458,7 @@
(should-not (equal dir default-directory))
(should (file-exists-p default-directory)))))
-(ert-deftest temporary-file-directory ()
+(ert-deftest compat-temporary-file-directory ()
(should-equal (temporary-file-directory) temporary-file-directory)
(let ((default-directory "/mnt"))
(should-equal (temporary-file-directory) default-directory))
@@ -1466,19 +1466,19 @@
(let ((default-directory "/mock::/"))
(should (string-match-p "\\`/mock:.*:/tmp/?\\'"
(temporary-file-directory)))))
-(ert-deftest directory-files ()
+(ert-deftest compat-directory-files ()
(should-not (compat-call directory-files "." nil nil nil 0))
(should (list-of-strings-p (compat-call directory-files "." nil nil nil 1)))
(should-equal 1 (length (compat-call directory-files "." nil nil nil 1)))
(should-equal 2 (length (compat-call directory-files "." nil nil nil 2))))
-(ert-deftest directory-files-and-attributes ()
+(ert-deftest compat-directory-files-and-attributes ()
(should-not (compat-call directory-files-and-attributes "." nil nil nil nil
0))
(should (consp (car (compat-call directory-files-and-attributes "." nil nil
nil nil 1))))
(should-equal 1 (length (compat-call directory-files-and-attributes "." nil
nil nil nil 1)))
(should-equal 2 (length (compat-call directory-files-and-attributes "." nil
nil nil nil 2))))
-(ert-deftest directory-name-p ()
+(ert-deftest compat-directory-name-p ()
(should (directory-name-p "/"))
(should-not (directory-name-p "/file"))
(should-not (directory-name-p "/dir/file"))
@@ -1492,7 +1492,7 @@
(should (directory-name-p "dir/subdir/"))
(should-not (directory-name-p "dir/subdir")))
-(ert-deftest directory-empty-p ()
+(ert-deftest compat-directory-empty-p ()
(ert-with-temp-directory dir
(should (directory-empty-p dir))
(make-empty-file (file-name-concat dir "file"))
@@ -1500,7 +1500,7 @@
(delete-file (file-name-concat dir "file"))
(should (directory-empty-p dir))))
-(ert-deftest directory-abbrev-apply ()
+(ert-deftest compat-directory-abbrev-apply ()
(let ((directory-abbrev-alist
(list
(cons (directory-abbrev-make-regexp "/long/path/to/foo") "foo:")
@@ -1508,10 +1508,10 @@
(should-equal (directory-abbrev-apply "/long/path/to/foo/file") "foo:file")
(should-equal (directory-abbrev-apply "/long/path/to/bar/file")
"bar:file")))
-(ert-deftest directory-abbrev-make-regexp ()
+(ert-deftest compat-directory-abbrev-make-regexp ()
(should-equal (directory-abbrev-make-regexp "/home/user/")
"\\`/home/user/\\(/\\|\\'\\)"))
-(ert-deftest make-empty-file ()
+(ert-deftest compat-make-empty-file ()
(ert-with-temp-directory dir
(let ((file (file-name-concat dir "file")))
(should-not (file-exists-p file))
@@ -1519,11 +1519,11 @@
(should (file-exists-p file))
(should-equal 0 (file-attribute-size (file-attributes file))))))
-(ert-deftest mounted-file-systems ()
+(ert-deftest compat-mounted-file-systems ()
(should-not (string-match-p mounted-file-systems "/etc/"))
(should (string-match-p mounted-file-systems "/mnt/")))
-(ert-deftest make-lock-file-name ()
+(ert-deftest compat-make-lock-file-name ()
(should-equal (expand-file-name ".#") (make-lock-file-name ""))
(should-equal (expand-file-name ".#a") (make-lock-file-name "a"))
(should-equal (expand-file-name ".#foo") (make-lock-file-name "foo"))
@@ -1540,7 +1540,7 @@
(should-equal (expand-file-name "bar/.#b") (make-lock-file-name "bar/b"))
(should-equal (expand-file-name "bar/.#foo") (make-lock-file-name
"bar/foo")))
-(ert-deftest file-has-changed-p ()
+(ert-deftest compat-file-has-changed-p ()
(ert-with-temp-file file
(should (file-has-changed-p file))
(should-not (file-has-changed-p file))
@@ -1561,7 +1561,7 @@
(should-not (file-has-changed-p file 'tag2))
(should-not (file-has-changed-p file 'tag2))))
-(ert-deftest file-attribute-getters ()
+(ert-deftest compat-file-attribute-getters ()
(let ((attrs '(type link-number user-id group-id access-time
modification-time
status-change-time size modes unspecified inode-number
device-number)))
(should-equal (file-attribute-file-identifier attrs) '(inode-number
device-number))
@@ -1577,16 +1577,16 @@
(should-equal (file-attribute-inode-number attrs) 'inode-number)
(should-equal (file-attribute-device-number attrs) 'device-number)))
-(ert-deftest file-attribute-collect ()
+(ert-deftest compat-file-attribute-collect ()
(let ((attrs '(t l u g a m s S m U i d)))
(should-equal (file-attribute-collect attrs 'group-id 'user-id) '(g u))
(should-equal (file-attribute-collect attrs 'size 'inode-number 'type) '(S
i t))))
-(ert-deftest file-size-human-readable-iec ()
+(ert-deftest compat-file-size-human-readable-iec ()
(should-equal "1 KiB" (file-size-human-readable-iec 1024))
(should-equal "2.1 MiB" (file-size-human-readable-iec 2223456)))
-(ert-deftest file-size-human-readable ()
+(ert-deftest compat-file-size-human-readable ()
(should-equal "1000" (compat-call file-size-human-readable 1000))
(should-equal "1k" (compat-call file-size-human-readable 1024))
(should-equal "1M" (compat-call file-size-human-readable (* 1024 1024)))
@@ -1602,13 +1602,13 @@
(should-equal "1 k" (compat-call file-size-human-readable 1000 'si " "))
(should-equal "1 kA" (compat-call file-size-human-readable 1000 'si " "
"A")))
-(ert-deftest with-file-modes ()
+(ert-deftest compat-with-file-modes ()
(let ((old (default-file-modes)))
(with-file-modes (1+ old)
(should-equal (default-file-modes) (1+ old)))
(should-equal (default-file-modes) old)))
-(ert-deftest file-modes-number-to-symbolic ()
+(ert-deftest compat-file-modes-number-to-symbolic ()
(should-equal "-rwx------" (file-modes-number-to-symbolic #o700))
(should-equal "-rwxrwx---" (file-modes-number-to-symbolic #o770))
(should-equal "-rwx---rwx" (file-modes-number-to-symbolic #o707))
@@ -1620,7 +1620,7 @@
(should-equal "prwx------" (file-modes-number-to-symbolic #o10700))
(should-equal "-rwx------" (file-modes-number-to-symbolic #o30700)))
-(ert-deftest file-local-name ()
+(ert-deftest compat-file-local-name ()
(should-equal "" (file-local-name ""))
(should-equal "foo" (file-local-name "foo"))
(should-equal "/bar/foo" (file-local-name "/bar/foo"))
@@ -1634,7 +1634,7 @@
(should-equal ":foo" (file-local-name "/ssh:::foo"))
(should-equal ":/bar/foo" (file-local-name "/ssh:::/bar/foo")))
-(ert-deftest file-name-quoted-p ()
+(ert-deftest compat-file-name-quoted-p ()
(should-not (compat-call file-name-quoted-p "" t)) ;; top argument
(should (compat-call file-name-quoted-p "/:" t)) ;; top argument
(should-not (file-name-quoted-p ""))
@@ -1649,14 +1649,14 @@
(when (>= emacs-major-version 26)
(should-not (file-name-quoted-p "/ssh:/:a"))))
-(ert-deftest file-name-unquote ()
+(ert-deftest compat-file-name-unquote ()
(should-equal "/" (compat-call file-name-unquote "/:" t)) ;; top argument
(should-equal ":"(compat-call file-name-unquote "/::" t)) ;; top argument
(should-equal "/" (file-name-unquote "/:/"))
(should-equal "/" (file-name-unquote "/:"))
(should-equal ":" (file-name-unquote "/::")))
-(ert-deftest file-name-quote ()
+(ert-deftest compat-file-name-quote ()
(should-equal "/:" (compat-call file-name-quote "" t)) ;; top argument
(should-equal "/::"(compat-call file-name-quote ":" t)) ;; top argument
(should-equal "/:" (file-name-quote ""))
@@ -1669,7 +1669,7 @@
(should-equal "/:a" (file-name-quote "/:a"))
(should-equal (concat "/ssh:" (system-name) ":/:a") (file-name-quote
"/ssh::a")))
-(ert-deftest file-name-concat ()
+(ert-deftest compat-file-name-concat ()
(should-equal (file-name-concat "foo" "bar") "foo/bar")
(should-equal (file-name-concat "foo" "bar") "foo/bar")
(should-equal (file-name-concat "foo" "bar" "zot") "foo/bar/zot")
@@ -1686,20 +1686,20 @@
(should-equal (file-name-concat "" "bar") "bar")
(should-equal (file-name-concat "" "") ""))
-(ert-deftest file-name-parent-directory ()
+(ert-deftest compat-file-name-parent-directory ()
(should-equal (file-name-parent-directory "/foo/bar") "/foo/")
(should-equal (file-name-parent-directory "/foo/") "/")
(should-equal (file-name-parent-directory "foo/bar") "foo/")
(should-equal (file-name-parent-directory "foo") "./"))
-(ert-deftest file-name-split ()
+(ert-deftest compat-file-name-split ()
(should-equal (file-name-split "foo/bar") '("foo" "bar"))
(should-equal (file-name-split "/foo/bar") '("" "foo" "bar"))
(should-equal (file-name-split "/foo/bar/zot") '("" "foo" "bar" "zot"))
(should-equal (file-name-split "/foo/bar/") '("" "foo" "bar" ""))
(should-equal (file-name-split "foo/bar/") '("foo" "bar" "")))
-(ert-deftest file-name-with-extension ()
+(ert-deftest compat-file-name-with-extension ()
(should-equal "file.ext" (file-name-with-extension "file" "ext"))
(should-equal "file.ext" (file-name-with-extension "file" ".ext"))
(should-equal "file.ext" (file-name-with-extension "file." ".ext"))
@@ -1718,7 +1718,7 @@
(should-error (file-name-with-extension "rel/" "ext") :type 'error)
(should-error (file-name-with-extension "/abs/" "ext")) :type 'error)
-(ert-deftest flatten-tree ()
+(ert-deftest compat-flatten-tree ()
;; Example from docstring:
(should-equal '(1 2 3 4 5 6 7) (flatten-tree '(1 (2 . 3) nil (4 5 (6)) 7)))
;; Trivial example
@@ -1736,7 +1736,7 @@
(should-equal '(1 2 3 4) (flatten-tree '((1) nil 2 ((3 4)))))
(should-equal '(1 2 3 4) (flatten-tree '(((1 nil)) 2 (((3 nil nil) 4))))))
-(ert-deftest sort ()
+(ert-deftest compat-sort ()
(should-equal (list 1 2 3) (sort (list 1 2 3) #'<))
(should-equal (list 1 2 3) (sort (list 1 3 2) #'<))
(should-equal (list 1 2 3) (sort (list 3 2 1) #'<))
@@ -1751,7 +1751,7 @@
(compat-call sort vec #'>)
(should-equal vec [8 5 4 4 3 3 3 2 2 1])))
-(ert-deftest replace-string-in-region ()
+(ert-deftest compat-replace-string-in-region ()
(with-temp-buffer
(insert "foo bar zot foobar")
(should-equal (replace-string-in-region "foo" "new" (point-min)
(point-max)) 2)
@@ -1785,7 +1785,7 @@
(should-equal (replace-string-in-region " bar" "" (point-min) 8) 1)
(should-equal (buffer-string) "foo bar"))))
-(ert-deftest replace-regexp-in-region ()
+(ert-deftest compat-replace-regexp-in-region ()
(with-temp-buffer
(insert "foo bar zot foobar")
(should-equal (replace-regexp-in-region "fo+" "new" (point-min)
(point-max)) 2)
@@ -1818,24 +1818,24 @@
(should-equal (replace-regexp-in-region " bar" "" (point-min) 8) 1)
(should-equal (buffer-string) "foo bar"))))
-(ert-deftest string-split ()
+(ert-deftest compat-string-split ()
(should-equal '("a" "b" "c") (split-string "a b c"))
(should-equal '("a" "b" "c") (string-split "a b c")))
-(ert-deftest string-equal-ignore-case ()
+(ert-deftest compat-string-equal-ignore-case ()
(should (string-equal-ignore-case "abc" "abc"))
(should (string-equal-ignore-case "abc" "ABC"))
(should (string-equal-ignore-case "abc" "abC"))
(should-not (string-equal-ignore-case "abc" "abCD"))
(should (string-equal-ignore-case "S" "s")))
-(ert-deftest string-greaterp ()
+(ert-deftest compat-string-greaterp ()
(should (string-greaterp "b" "a"))
(should-not (string-greaterp "a" "b"))
(should (string-greaterp "aaab" "aaaa"))
(should-not (string-greaterp "aaaa" "aaab")))
-(ert-deftest string-clean-whitespace ()
+(ert-deftest compat-string-clean-whitespace ()
(should-equal "a b c" (string-clean-whitespace "a b c"))
(should-equal "a b c" (string-clean-whitespace " a b c"))
(should-equal "a b c" (string-clean-whitespace "a b c "))
@@ -1855,7 +1855,7 @@
(should-equal "aa bb cc" (string-clean-whitespace "aa bb cc "))
(should-equal "aa bb cc" (string-clean-whitespace " aa bb cc ")))
-(ert-deftest string-fill ()
+(ert-deftest compat-string-fill ()
(should-equal "a a a a a" (string-fill "a a a a a" 9))
(should-equal "a a a a a" (string-fill "a a a a a" 10))
(should-equal "a a a a\na" (string-fill "a a a a a" 8))
@@ -1864,7 +1864,7 @@
(should-equal "a\na\na\na\na" (string-fill "a a a a a" 2))
(should-equal "a\na\na\na\na" (string-fill "a a a a a" 1)))
-(ert-deftest string-lines ()
+(ert-deftest compat-string-lines ()
(should-equal '("a" "b" "c") (string-lines "a\nb\nc"))
(should-equal '("a" "b" "c") (string-lines "a\nb\nc\n" t))
(should-equal '("a" "b" "c") (string-lines "a\nb\n\nc\n" t))
@@ -1885,7 +1885,7 @@
(should-equal '("a\n" "b\n" "c\n") (compat-call string-lines "a\n\nb\nc\n" t
t))
(should-equal '("a\n" "b\n" "c\n") (compat-call string-lines "a\nb\nc\n" nil
t)))
-(ert-deftest string-pad ()
+(ert-deftest compat-string-pad ()
(should-equal "a " (string-pad "a" 4))
(should-equal "aaaa" (string-pad "aaaa" 4))
(should-equal "aaaaaa" (string-pad "aaaaaa" 4))
@@ -1893,14 +1893,14 @@
(should-equal " a" (string-pad "a" 4 nil t))
(should-equal "...a" (string-pad "a" 4 ?. t)))
-(ert-deftest string-chop-newline ()
+(ert-deftest compat-string-chop-newline ()
(should-equal "" (string-chop-newline ""))
(should-equal "" (string-chop-newline "\n"))
(should-equal "aaa" (string-chop-newline "aaa"))
(should-equal "aaa" (string-chop-newline "aaa\n"))
(should-equal "aaa\n" (string-chop-newline "aaa\n\n")))
-(ert-deftest string-distance ()
+(ert-deftest compat-string-distance ()
(should-equal 3 (string-distance "kitten" "sitting")) ;from wikipedia
;; In Emacs 27, `string-distance' had a bug when comparing two empty
;; strings. This was fixed in the following commit:
@@ -1916,7 +1916,7 @@
(should-equal 3 (string-distance "a" "あ" t)) ;byte example
(should-equal 1 (string-distance "a" "あ")))
-(ert-deftest string-width ()
+(ert-deftest compat-string-width ()
(should-equal 0 (compat-call string-width ""))
(should-equal 3 (compat-call string-width "abc")) ;; no
argument
(should-equal 5 (compat-call string-width "abcあ"))
@@ -1931,7 +1931,7 @@
(should-equal 2 (compat-call string-width "abcあ" 3 4))
(should-equal 0 (compat-call string-width "a " 1 1)))
-(ert-deftest string-trim-left ()
+(ert-deftest compat-string-trim-left ()
(should-equal "a" (compat-call string-trim-left "---a" "-+")) ;; Additional
regexp
(should-equal "" (compat-call string-trim-left ""))
;empty string
(should-equal "a" (compat-call string-trim-left "a"))
;"full" string
@@ -1953,7 +1953,7 @@
(should-equal "a\t\n" (compat-call string-trim-left "\t\ta\t\n"))
(should-equal "a \n" (compat-call string-trim-left "\n \ta \n")))
-(ert-deftest string-trim-right ()
+(ert-deftest compat-string-trim-right ()
(should-equal "a" (compat-call string-trim-right "a---" "-+")) ;; Additional
regexp
(should-equal "" (compat-call string-trim-right ""))
;empty string
(should-equal "a" (compat-call string-trim-right "a"))
;"full" string
@@ -1975,7 +1975,7 @@
(should-equal "\t\ta" (compat-call string-trim-right "\t\ta\t\n"))
(should-equal "\n \ta" (compat-call string-trim-right "\n \ta \n")))
-(ert-deftest string-trim ()
+(ert-deftest compat-string-trim ()
(should-equal "aaa" (compat-call string-trim "--aaa__" "-+" "_+")) ;;
Additional regexp
(should-equal "" (compat-call string-trim ""))
;empty string
(should-equal "a" (compat-call string-trim "a"))
;"full" string
@@ -2004,7 +2004,7 @@
`(with-no-warnings (string-to-multibyte ,str))
`(string-to-multibyte ,str)))
-(ert-deftest string-search ()
+(ert-deftest compat-string-search ()
;; Find needle at the beginning of a haystack:
(should-equal 0 (string-search "a" "abb"))
;; Find needle at the begining of a haystack, with more potential
@@ -2113,7 +2113,7 @@
(should-equal 2 (string-search (compat-tests--string-to-multibyte
"o\303\270")
"foo\303\270"))))
-(ert-deftest string-replace ()
+(ert-deftest compat-string-replace ()
(should-equal "bba" (string-replace "aa" "bb" "aaa"))
(should-equal "AAA" (string-replace "aa" "bb" "AAA"))
;; Additional test copied from subr-tests.el:
@@ -2146,7 +2146,7 @@
(should-equal "defg" (string-replace "abc" "defg" "abc"))
(should-error (string-replace "" "x" "abc") :type 'wrong-length-argument))
-(ert-deftest dlet ()
+(ert-deftest compat-dlet ()
(should-not (boundp 'compat-tests--dlet1))
(should-not (boundp 'compat-tests--dlet2))
(dlet ((compat-tests--dlet1 1)
@@ -2156,7 +2156,7 @@
(should-not (boundp 'compat-tests--dlet1))
(should-not (boundp 'compat-tests--dlet2)))
-(ert-deftest while-let ()
+(ert-deftest compat-while-let ()
(let ((list '(1 2 3 4)) rev)
(while-let ((x (pop list)))
(push x rev))
@@ -2166,7 +2166,7 @@
(push (cons x y) zipped))
(should-equal '((3 . c) (2 . b) (1 . a)) zipped)))
-(ert-deftest when-let* ()
+(ert-deftest compat-when-let* ()
(should-equal "second"
(when-let*
((x 3)
@@ -2178,7 +2178,7 @@
(should-not
(when-let* (((= 5 6))) "first" "second")))
-(ert-deftest if-let* ()
+(ert-deftest compat-if-let* ()
(should-equal "then"
(if-let*
((x 3)
@@ -2190,7 +2190,7 @@
(should-equal "else"
(if-let* (((= 5 6))) "then" "else")))
-(ert-deftest when-let ()
+(ert-deftest compat-when-let ()
;; FIXME Broken on Emacs 25
(compat-tests--if (= emacs-major-version 25)
(should-equal "second"
@@ -2220,7 +2220,7 @@
(d (memq 0 '(1 2 3 0 5 6))))
"first" "last")))
-(ert-deftest if-let ()
+(ert-deftest compat-if-let ()
;; FIXME Broken on Emacs 25
(compat-tests--if (= emacs-major-version 25)
(should-equal "then"
@@ -2252,7 +2252,7 @@
(e (memq 0 '(1 2 3 5 6))))
t)))
-(ert-deftest and-let* ()
+(ert-deftest compat-and-let* ()
(should ;trivial body
(and-let*
((x 3)
@@ -2271,7 +2271,7 @@
(should-not
(and-let* (((= 5 6))) t)))
-(ert-deftest named-let ()
+(ert-deftest compat-named-let ()
(should-equal (named-let l ((i 0)) (if (= i 8) i (l (1+ i))))
8)
(should-equal (named-let l ((i 0)) (if (= i 100000) i (l (1+ i))))
@@ -2325,7 +2325,7 @@
((lop (and (setq b (not b)) (1+ i)))))))
'ok))
-(ert-deftest alist-get ()
+(ert-deftest compat-alist-get ()
;; Fallback behaviour:
(should-not (alist-get 1 nil)) ;empty list
(should-equal 'a (alist-get 1 '((1 . a)))) ;single element
list
@@ -2354,7 +2354,7 @@
(should-equal 'd (compat-call alist-get 0 '((1 . a) (2 . b) (3 . c)) 'd))
;default value
(should-equal 'd (compat-call alist-get 2 '((1 . a) (2 . b) (3 . c)) 'd nil
#'ignore)))
-(ert-deftest alist-get-gv ()
+(ert-deftest compat-alist-get-gv ()
(let ((alist (list (cons 1 "one")
(cons 2 "two")
(cons 3 "three"))))
@@ -2378,7 +2378,7 @@
(setf (compat-call alist-get "two" alist nil 'remove #'string=) nil)
(should-equal alist '(("one" . "eins") ("three" . 3)))))
-(ert-deftest plist-get-gv ()
+(ert-deftest compat-plist-get-gv ()
(let ((plist '(1 "one" 2 "two" 3 "three")))
(setf (plist-get plist 1) "eins")
(should-equal (plist-get plist 1) "eins")
@@ -2394,7 +2394,7 @@
(should-equal (compat-call plist-get plist "one" #'string=) "eins")
(should-equal plist '("one" "eins" "two" 2 "three" 3))))
-(ert-deftest prop-match ()
+(ert-deftest compat-prop-match ()
(should (prop-match-p (make-prop-match)))
(should (prop-match-p (make-prop-match :end 1)))
(should (prop-match-p (make-prop-match :beginning 1 :end 2 :value 3)))
@@ -2407,7 +2407,7 @@
(should-not (prop-match-p "string"))
(should-not (prop-match-p '(1 2 3))))
-(ert-deftest text-property-search-forward ()
+(ert-deftest compat-text-property-search-forward ()
(with-temp-buffer
(insert "one "
(propertize "two " 'prop 'val)
@@ -2429,7 +2429,7 @@
(goto-char (point-min))
(should-not (text-property-search-forward 'non-existant))))
-(ert-deftest text-property-search-backward ()
+(ert-deftest compat-text-property-search-backward ()
(with-temp-buffer
(insert "one "
(propertize "two " 'prop 'val)
@@ -2451,13 +2451,13 @@
(goto-char (point-max))
(should-not (text-property-search-backward 'non-existant))))
-(ert-deftest color-dark-p ()
+(ert-deftest compat-color-dark-p ()
(should (color-dark-p '(0 0 0)))
(should (color-dark-p '(0.5 0.5 0.5)))
(should-not (color-dark-p '(0.5 0.7 0.5)))
(should-not (color-dark-p '(1 1 1 ))))
-(ert-deftest color-values-from-color-spec ()
+(ert-deftest compat-color-values-from-color-spec ()
;; #RGB notation
(should-equal '(0 0 0) (color-values-from-color-spec "#000"))
(should-equal '(0 0 0) (color-values-from-color-spec "#000000"))
@@ -2553,7 +2553,7 @@
(should-not (color-values-from-color-spec "rgbi : 0/0/0"))
(should-not (color-values-from-color-spec "rgbi:0/0.5/10")))
-(ert-deftest lookup-key ()
+(ert-deftest compat-lookup-key ()
(let ((a-map (make-sparse-keymap))
(b-map (make-sparse-keymap)))
(define-key a-map "x" 'foo)
@@ -2569,13 +2569,13 @@
(defmacro compat-tests--filename ()
(macroexp-file-name))
-(ert-deftest macroexp-file-name ()
+(ert-deftest compat-macroexp-file-name ()
(should-equal (file-name-nondirectory (compat-tests--filename))
"compat-tests.el"))
-(ert-deftest macroexp-warn-and-return ()
+(ert-deftest compat-macroexp-warn-and-return ()
(should-equal (macroexp-warn-and-return "test warning" '(some form)) '(some
form)))
-(ert-deftest macroexp-parse-body ()
+(ert-deftest compat-macroexp-parse-body ()
(should-equal '(((declare test)) . (a b c))
(macroexp-parse-body '((declare test) a b c)))
(should-equal '(((interactive)) . (a b c))
@@ -2583,7 +2583,7 @@
(should-equal '(((interactive) (cl-declare)) . (a b c))
(macroexp-parse-body '((interactive) (cl-declare) a b c))))
-(ert-deftest macroexp-quote ()
+(ert-deftest compat-macroexp-quote ()
(should-equal nil (macroexp-quote nil))
(should-equal t (macroexp-quote t))
(should-equal :key (macroexp-quote :key))
@@ -2591,7 +2591,7 @@
(should-equal ''sym (macroexp-quote 'sym))
(should-equal ''(1 2 3) (macroexp-quote '(1 2 3))))
-(ert-deftest macroexpand-1 ()
+(ert-deftest compat-macroexpand-1 ()
(should-equal '(if a b c) (macroexpand-1 '(if a b c)))
(should-equal '(if a (progn b)) (macroexpand-1 '(when a b)))
(should-equal '(if a (progn (unless b c))) (macroexpand-1 '(when a (unless b
c)))))
@@ -2602,9 +2602,9 @@
(obsolete encode-time-value))
(encode-time-value 1 2 3 4 0)
(goto-line 10)))
-(ert-deftest with-suppressed-warnings ()
#'compat-tests--with-suppressed-warnings)
+(ert-deftest compat-with-suppressed-warnings ()
#'compat-tests--with-suppressed-warnings)
-(ert-deftest time-equal-p ()
+(ert-deftest compat-time-equal-p ()
(should (time-equal-p nil nil))
;; FIXME: Testing these values can be tricky, because the timestamp
@@ -2636,7 +2636,7 @@
;; (should (time-equal-p (days-to-time 999.0) '(1317 2688 0 0)))
)
-(ert-deftest decoded-time ()
+(ert-deftest compat-decoded-time ()
(let ((time '(second minute hour day month year weekday dst zone)))
(should-equal (decoded-time-second time) 'second)
(should-equal (decoded-time-minute time) 'minute)
@@ -2666,7 +2666,7 @@
(should-equal (decoded-time-dst time) 'DST)
(should-equal (decoded-time-zone time) 'ZONE)))
-(ert-deftest decoded-time-period ()
+(ert-deftest compat-decoded-time-period ()
(should-equal 0 (decoded-time-period '()))
(should-equal 0 (decoded-time-period '(0)))
(should-equal 1 (decoded-time-period '(1)))
@@ -2716,23 +2716,23 @@
(should-error (decoded-time-period '(0 0 0 0 a)) :type 'wrong-type-argument)
(should-error (decoded-time-period '(0 0 0 0 0 a)) :type
'wrong-type-argument))
-(ert-deftest make-decoded-time ()
+(ert-deftest compat-make-decoded-time ()
(should-equal '(s m h d M Y nil D Z)
(make-decoded-time :second 's :minute 'm :hour 'h
:day 'd :month 'M :year 'Y
:dst 'D :zone 'Z)))
-(ert-deftest date-days-in-month ()
+(ert-deftest compat-date-days-in-month ()
(should-equal 31 (date-days-in-month 2020 1))
(should-equal 30 (date-days-in-month 2020 4))
(should-equal 29 (date-days-in-month 2020 2))
(should-equal 28 (date-days-in-month 2021 2)))
-(ert-deftest date-ordinal-to-time ()
+(ert-deftest compat-date-ordinal-to-time ()
(should-equal '(nil nil nil 9 4 2020 nil nil nil) (date-ordinal-to-time 2020
100))
(should-equal '(nil nil nil 19 7 2021 nil nil nil) (date-ordinal-to-time
2021 200)))
-(ert-deftest regexp-opt ()
+(ert-deftest compat-regexp-opt ()
;; Ensure `regexp-opt' doesn't change the existing
;; behaviour:
(should-equal "[abc]" (compat-call regexp-opt '("a" "b" "c")))
@@ -2742,14 +2742,14 @@
(should-equal "\\(?:\\`a\\`\\)" (compat-call regexp-opt '()))
(should-equal "\\<\\(\\`a\\`\\)\\>" (compat-call regexp-opt '() 'words)))
-(ert-deftest regexp-unmatchable ()
+(ert-deftest compat-regexp-unmatchable ()
(dolist (str '("" ;empty string
"a" ;simple string
"aaa" ;longer string
))
(should-not (string-match-p regexp-unmatchable str))))
-(ert-deftest use-region ()
+(ert-deftest compat-use-region ()
(with-temp-buffer
(insert "abc\ndef\n")
(set-mark 2)
@@ -2759,7 +2759,7 @@
(should-equal 2 (use-region-beginning))
(should-equal 7 (use-region-end))))
-(ert-deftest region-bounds ()
+(ert-deftest compat-region-bounds ()
(should-error (region-bounds))
;; FIXME: On Emacs 24 `region-bounds' always returns a continuous region.
(when (> emacs-major-version 24)
@@ -2773,7 +2773,7 @@
(goto-char 7)
(should-equal (region-bounds) '((2 . 7)))))
-(ert-deftest region-noncontiguous-p ()
+(ert-deftest compat-region-noncontiguous-p ()
(when (> emacs-major-version 24)
(let ((region-extract-function (lambda (_) '((2 . 3) (6 . 7)))))
(should (region-noncontiguous-p))))
@@ -2791,12 +2791,12 @@
(should (region-noncontiguous-p))
(should (use-region-noncontiguous-p))))))
-(ert-deftest get-scratch-buffer-create ()
+(ert-deftest compat-get-scratch-buffer-create ()
(should-equal "*scratch*" (buffer-name (get-scratch-buffer-create)))
(should-equal initial-major-mode
(buffer-local-value 'major-mode (get-scratch-buffer-create))))
-(ert-deftest ring-resize ()
+(ert-deftest compat-ring-resize ()
(let ((ring (make-ring 3)))
(ring-insert ring 1)
(ring-insert ring 2)
@@ -2827,7 +2827,7 @@
(should-equal (ring-size ring) 3)
(should-equal (ring-elements ring) '(5 4 3))))
-(ert-deftest save-mark-and-excursion ()
+(ert-deftest compat-save-mark-and-excursion ()
(with-temp-buffer
(insert "a\nb\nc")
(goto-char 1)
@@ -2842,7 +2842,7 @@
(should-equal (point) 1)
(should-equal (mark) 2)))
-(ert-deftest text-quoting-style ()
+(ert-deftest compat-text-quoting-style ()
(should (text-quoting-style))
(let ((text-quoting-style t))
(should-equal 'curve (text-quoting-style)))
@@ -2851,7 +2851,7 @@
(let ((text-quoting-style 'grave))
(should-equal 'grave (text-quoting-style))))
-(ert-deftest substitute-quotes ()
+(ert-deftest compat-substitute-quotes ()
(let ((text-quoting-style 'curve))
(should-equal (substitute-quotes "quotes ‘like this’") "quotes ‘like
this’")
(should-equal (substitute-quotes "`x'") "‘x’")
@@ -2871,19 +2871,19 @@
(should-equal (substitute-quotes "'") "'")
(should-equal (substitute-quotes "\\`") "\\`")))
-(ert-deftest readablep ()
+(ert-deftest compat-readablep ()
(should (readablep "foo"))
(should (readablep '("foo" 1 2.3 (a . b) [x y z] :key)))
(should-not (readablep (list (make-marker))))
(should-not (readablep (make-marker))))
-(ert-deftest count-sentences ()
+(ert-deftest compat-count-sentences ()
(with-temp-buffer
(insert "First sentence. Second sentence. Third sentence. Fourth
sentence.")
(should-equal 4 (count-sentences (point-min) (point-max)))
(should-equal 2 (count-sentences 16 50))))
-(ert-deftest major-mode-suspend ()
+(ert-deftest compat-major-mode-suspend ()
(with-temp-buffer
(should (local-variable-if-set-p 'major-mode--suspended))
(should (get 'major-mode--suspended 'permanent-local))
@@ -2900,13 +2900,13 @@
(should sentence-end-double-space)
(should-equal major-mode #'text-mode)))
-(ert-deftest with-delayed-message ()
+(ert-deftest compat-with-delayed-message ()
;; No real test, since the backported function never displays a message.
(should-equal 'result (with-delayed-message (1 "timeout") 'result))
(should-equal 'result (funcall-with-delayed-message
1 "timeout" (lambda () 'result))))
-(ert-deftest set-transient-map ()
+(ert-deftest compat-set-transient-map ()
(let (overriding-terminal-local-map)
;; TODO Implement a proper test. Interactive features like
;; `set-transient-map' are hard to test and Emacs itself is lacking tests.
@@ -2915,7 +2915,7 @@
(compat-call set-transient-map (define-keymap "x" #'ignore))
(compat-call set-transient-map (define-keymap "x" #'ignore) nil nil "msg"
1)))
-(ert-deftest ert-with-temp-file ()
+(ert-deftest compat-ert-with-temp-file ()
(ert-with-temp-file file
(should-not (directory-name-p file))
(should (file-readable-p file))
@@ -2930,7 +2930,7 @@
(should (file-readable-p file))
(should (file-writable-p file))))
-(ert-deftest ert-with-temp-directory ()
+(ert-deftest compat-ert-with-temp-directory ()
(ert-with-temp-directory dir
(should (directory-name-p dir))
(should (file-directory-p dir))))
@@ -2939,27 +2939,27 @@
(cl-with-gensyms (x y)
`(let ((,x 1) (,y 2)) (+ ,x ,y))))
-(ert-deftest cl-with-gensyms ()
+(ert-deftest compat-cl-with-gensyms ()
(should-equal 3 (compat-tests--with-gensyms)))
(defmacro compat-tests--once-only (x)
(cl-once-only (x)
`(cons ,x ,x)))
-(ert-deftest cl-once-only ()
+(ert-deftest compat-cl-once-only ()
(let ((x 0))
(should-equal (cons 1 1) (compat-tests--once-only (cl-incf x)))
(should-equal 1 x)))
-(ert-deftest cl-constantly ()
+(ert-deftest compat-cl-constantly ()
(should-equal (mapcar (cl-constantly 3) '(a b c d))
'(3 3 3 3)))
-(ert-deftest process-lines-ignore-status ()
+(ert-deftest compat-process-lines-ignore-status ()
(should-equal '("line1" "line2" "")
(process-lines-ignore-status "echo" "line1\nline2\n")))
-(ert-deftest process-lines-handling-status ()
+(ert-deftest compat-process-lines-handling-status ()
(let (status)
(should-equal '("line1" "line2")
(process-lines-handling-status
@@ -2969,16 +2969,16 @@
(should-equal status 1)
(should-error (process-lines-handling-status "false" nil))))
-(ert-deftest seq ()
+(ert-deftest compat-seq ()
(should-equal 3 (seq-length '(a b c)))
(should-equal 3 (seq-length [a b c])))
-(ert-deftest widget-natnum ()
+(ert-deftest compat-widget-natnum ()
(with-temp-buffer
(should-error (widget-create 'compat--not-existing))
(should-equal (take 3 (widget-create 'natnum)) '(natnum :value "0"))))
-(ert-deftest widget-key ()
+(ert-deftest compat-widget-key ()
(with-temp-buffer
(should-equal (take 3 (widget-create 'key)) '(key :value ""))))