emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 5514de45e1 26/27: Rewrite test macros to generat


From: ELPA Syncer
Subject: [elpa] externals/compat 5514de45e1 26/27: Rewrite test macros to generate more individual tests
Date: Sat, 5 Mar 2022 04:57:28 -0500 (EST)

branch: externals/compat
commit 5514de45e1489f7c646c21c277c4fcd76f65736f
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Rewrite test macros to generate more individual tests
---
 compat-tests.el | 2783 +++++++++++++++++++++++++++----------------------------
 1 file changed, 1363 insertions(+), 1420 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index bb959dc711..062a01623d 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -44,304 +44,399 @@
 (let ((compat-testing t))
   (load "compat.el"))
 
-(defvar compat--current-fn nil)
-(defvar compat--compat-fn nil)
-
-(defmacro compat--should (result &rest input)
-  "Generate code for test with INPUT evaluating to RESULT."
-  (let ((cfn (or compat--compat-fn
-                 (intern (format "compat--%s" compat--current-fn))))
-        (rfn compat--current-fn))
-    (macroexp-progn
-     (list
-      `(should (equal (,cfn ,@input) ,result))
-      (and (fboundp rfn)
-           `(should (equal (,rfn ,@input) ,result)))))))
-
-(defmacro compat--should* (result &rest input)
-  "Generate code for test with INPUT evaluating to RESULT."
-  (let ((cfn (or compat--compat-fn
-                 (intern (format "compat--%s" compat--current-fn))))
-        (rfn compat--current-fn))
-    (macroexp-progn
-     (list
-      `(should (equal (funcall (apply-partially #',cfn #',rfn) ,@input) 
,result))
-      (and (and (fboundp rfn)
-                (or (not (eq (get cfn 'compat-type) 'advice))
-                    (not (get cfn 'compat-version))
-                    (version<= (get cfn 'compat-version) emacs-version)))
-           `(should (equal (,rfn ,@input) ,result)))))))
-
-(defmacro compat--mshould (result &rest input)
-  "Generate code for test with INPUT evaluating to RESULT."
-  (let ((cfn (or compat--compat-fn
-                 (intern (format "compat--%s" compat--current-fn))))
-        (rfn compat--current-fn))
-    (macroexp-progn
-     (list
-      `(should (equal (macroexpand-all `(,',cfn ,,@input)) ,result))
-      (and (fboundp rfn)
-           `(should (equal (macroexpand-all `(,',rfn ,,@input)) ,result)))))))
-
-(defmacro compat--error (error &rest input)
-  "Generate code for test FN with INPUT to signal ERROR."
-  (let ((cfn (or compat--compat-fn
-                 (intern (format "compat--%s" compat--current-fn))))
-        (rfn compat--current-fn))
-    (macroexp-progn
-     (list
-      `(should-error (,cfn ,@input) :type ',error)
-      (and (fboundp rfn)
-           `(should-error (,rfn ,@input) :type ',error))))))
-
-(defmacro compat--error* (error &rest input)
-  "Generate code for test FN with INPUT to signal ERROR."
-  (let ((cfn (or compat--compat-fn
-                 (intern (format "compat--%s" compat--current-fn))))
-        (rfn compat--current-fn))
-    (macroexp-progn
-     (list
-      `(should-error (funcall (apply-partially #',cfn #',rfn) ,@input) :type 
',error)
-      (and (and (fboundp rfn)
-                (or (not (eq (get cfn 'compat-type) 'advice))
-                    (not (get cfn 'compat-version))
-                    (version<= (get cfn 'compat-version) emacs-version)))
-           `(should-error (,rfn ,@input) :type ',error))))))
-
-;; FIXME: extract the name of the test out of the ERT-test, instead
-;;        of having to re-declare the name of the test redundantly.
-(defmacro compat-test (fn &rest body)
-  "Set `compat--current-fn' to FN in BODY.
-If FN is a list, the car should be the actual function, and cadr
-the compatibility function."
-  (declare (indent 1))
-  (if (consp fn)
-      (setq compat--current-fn (if (symbolp (car fn))
-                                   (car fn)
-                                 ;; Handle expressions
-                                 (eval (car fn) t))
-            compat--compat-fn (if (symbolp (cadr fn))
-                                   (cadr fn)
-                                 ;; Handle expressions
-                                 (eval (cadr fn) t)))
-    (setq compat--current-fn fn
-          compat--compat-fn nil))
-  (macroexp-progn body))
+(defvar compat-test-counter)
+
+(defun compat--ought (name compat)
+  "Implementation for the `ought' macro for NAME.
+COMPAT is the name of the compatibility function the behaviour is
+being compared against."
+  (lambda (result &rest args)
+    (let ((real-test (intern (format "compat-%s-%04d-actual" name 
compat-test-counter)))
+          (comp-test (intern (format "compat-%s-%04d-compat" name 
compat-test-counter))))
+      (setq compat-test-counter (1+ compat-test-counter))
+      (macroexp-progn
+       (list (and (fboundp name)
+                  `(ert-set-test
+                    ',real-test
+                    (make-ert-test
+                     :name ',real-test
+                     :tags '(,name)
+                     :body (lambda () (should (equal ,result (,name 
,@args)))))))
+             (and (fboundp compat)
+                  `(ert-set-test
+                    ',comp-test
+                    (make-ert-test
+                     :name ',comp-test
+                     :tags '(,name)
+                     :body (lambda () (should (equal ,result (,compat 
,@args))))))))))))
+
+(defun compat--expect (name compat)
+  "Implementation for the `expect' macro for NAME.
+COMPAT is the name of the compatibility function the behaviour is
+being compared against."
+  (lambda (code &rest args)
+    (let ((real-test (intern (format "compat-%s-%04d-actual" name 
compat-test-counter)))
+          (comp-test (intern (format "compat-%s-%04d-compat" name 
compat-test-counter))))
+      (setq compat-test-counter (1+ compat-test-counter))
+      (macroexp-progn
+       (list (and (fboundp name)
+                  `(ert-set-test
+                    ',real-test
+                    (ert-set-test
+                     ',real-test
+                     (make-ert-test
+                      :name ',real-test
+                      :tags '(,name)
+                      :body (lambda ()
+                              (condition-case nil
+                                  (progn
+                                    (,name ,@args)
+                                    (ert-fail :fail-reason "did not signal an 
error"))
+                                (,code t)))))))
+             (and (fboundp compat)
+                  `(ert-set-test
+                    ',comp-test
+                    (make-ert-test
+                     :name ',comp-test
+                     :tags '(,name)
+                     :body (lambda ()
+                             (condition-case nil
+                                 (progn
+                                   (,compat ,@args)
+                                   (ert-fail :fail-reason "did not signal an 
error"))
+                               (,code t)))))))))))
+
+(defmacro compat-deftest (name &rest body)
+  "Test NAME in BODY."
+  (declare (debug (sexp &rest body))
+           (indent 1))
+  (let* ((compat-test-counter 0)
+         (real-name (if (consp name) (car name) name))
+         (compat-name (if (consp name)
+                          (cadr name)
+                        (intern (format "compat--%s" real-name))))
+         (env (list
+               (cons 'ought (compat--ought real-name compat-name))
+               (cons 'expect (compat--expect real-name compat-name)))))
+    (macroexpand-all (macroexp-progn body) (append env 
macroexpand-all-environment))))
 
 
 
-(ert-deftest compat-string-search ()
-  "Check if `compat--string-search' was implemented correctly."
-  (compat-test string-search
-    ;; Find needle at the beginning of a haystack:
-    (compat--should 0 "a" "abb")
-    ;; Find needle at the begining of a haystack, with more potential
-    ;; needles that could be found:
-    (compat--should 0 "a" "abba")
-    ;; Find needle with more than one charachter at the beginning of
-    ;; a line:
-    (compat--should 0 "aa" "aabbb")
-    ;; Find a needle midstring:
-    (compat--should 1 "a" "bab")
-    ;; Find a needle at the end:
-    (compat--should 2 "a" "bba")
-    ;; Find a longer needle midstring:
-    (compat--should 1 "aa" "baab")
-    ;; Find a longer needle at the end:
-    (compat--should 2 "aa" "bbaa")
-    ;; Find a case-sensitive needle:
-    (compat--should 2 "a" "AAa")
-    ;; Find another case-sensitive needle:
-    (compat--should 2 "aa" "AAaa")
-    ;; Test regular expression quoting (1):
-    (compat--should 5 "." "abbbb.b")
-    ;; Test regular expression quoting (2):
-    (compat--should 5 ".*" "abbbb.*b")
-    ;; Attempt to find non-existent needle:
-    (compat--should nil "a" "bbb")
-    ;; Attempt to find non-existent needle that has the form of a
-    ;; regular expression:
-    (compat--should nil "." "bbb")
-    ;; Handle empty string as needle:
-    (compat--should 0 "" "abc")
-    ;; Handle empty string as haystack:
-    (compat--should nil "a" "")
-    ;; Handle empty string as needle and haystack:
-    (compat--should 0 "" "")
-    ;; Handle START argument:
-    (compat--should 3 "a" "abba" 1)
-    ;; Additional test copied from:
-    (compat--should 6 "zot" "foobarzot")
-    (compat--should 0 "foo" "foobarzot")
-    (compat--should nil "fooz" "foobarzot")
-    (compat--should nil "zot" "foobarzo")
-    (compat--should 0 "ab" "ab")
-    (compat--should nil "ab\0" "ab")
-    (compat--should 4 "ab" "abababab" 3)
-    (compat--should nil "ab" "ababac" 3)
-    (compat--should nil "aaa" "aa")
-    ;; The `make-string' calls with three arguments have been replaced
-    ;; here with the result of their evaluation, to avoid issues with
-    ;; older versions of Emacs that only support two arguments.
-    (compat--should 5
-                   (make-string 2 130)
-                   ;; Per (concat "helló" (make-string 5 130 t) "bár")
-                   "hell󂂂‚‚bár")
-    (compat--should 5
-                   (make-string 2 127)
-                   ;; Per (concat "helló" (make-string 5 127 t) "bár")
-                   "hellóbár")
-    (compat--should 1 "\377" "a\377ø")
-    (compat--should 1 "\377" "a\377a")
-    (compat--should nil (make-string 1 255) "a\377ø")
-    (compat--should nil (make-string 1 255) "a\377a")
-    (compat--should 3 "fóo" "zotfóo")
-    (compat--should nil "\303" "aøb")
-    (compat--should nil "\270" "aøb")
-    (compat--should nil "ø" "\303\270")
-    (compat--should nil "ø" (make-string 32 ?a))
-    (compat--should nil "ø" (string-to-multibyte (make-string 32 ?a)))
-    (compat--should 14 "o" (string-to-multibyte
-                            (apply #'string (number-sequence ?a ?z))))
-    (compat--should 2 "a\U00010f98z" "a\U00010f98a\U00010f98z")
-    (compat--error (args-out-of-range -1) "a" "abc" -1)
-    (compat--error (args-out-of-range 4) "a" "abc" 4)
-    (compat--error (args-out-of-range 100000000000)
-                   "a" "abc" 100000000000)
-    (compat--should nil "a" "aaa" 3)
-    (compat--should nil "aa" "aa" 1)
-    (compat--should nil "\0" "")
-    (compat--should 0 "" "")
-    (compat--error (args-out-of-range 1) "" "" 1)
-    (compat--should 0 "" "abc")
-    (compat--should 2 "" "abc" 2)
-    (compat--should 3 "" "abc" 3)
-    (compat--error (args-out-of-range 4) "" "abc" 4)
-    (compat--error (args-out-of-range -1) "" "abc" -1)
-    (compat--should nil "ø" "foo\303\270")
-    (compat--should nil "\303\270" "ø")
-    (compat--should nil "\370" "ø")
-    (compat--should nil (string-to-multibyte "\370") "ø")
-    (compat--should nil "ø" "\370")
-    (compat--should nil "ø" (string-to-multibyte "\370"))
-    (compat--should nil "\303\270" "\370")
-    (compat--should nil (string-to-multibyte "\303\270") "\370")
-    (compat--should nil "\303\270" (string-to-multibyte "\370"))
-    (compat--should nil
-                    (string-to-multibyte "\303\270")
-                    (string-to-multibyte "\370"))
-    (compat--should nil "\370" "\303\270")
-    (compat--should nil (string-to-multibyte "\370") "\303\270")
-    (compat--should nil "\370" (string-to-multibyte "\303\270"))
-    (compat--should nil
-                    (string-to-multibyte "\370")
-                    (string-to-multibyte "\303\270"))
-    (compat--should 3 "\303\270" "foo\303\270")
-    (when (version<= "27" emacs-version)
-      ;; FIXME The commit a1f76adfb03c23bb4242928e8efe6193c301f0c1 in
-      ;; emacs.git fixes the behaviour of regular expressions matching
-      ;; raw bytes.  The compatibility functions should updated to
-      ;; backport this behaviour.
-      (compat--should 2 (string-to-multibyte "\377") "ab\377c")
-      (compat--should 2
-                      (string-to-multibyte "o\303\270")
-                      "foo\303\270"))))
-
-(ert-deftest compat-string-replace ()
-  "Check if `compat--string-replace' was implemented correctly."
-  (compat-test string-replace
-    (compat--should "bba" "aa" "bb" "aaa")
-    (compat--should "AAA" "aa" "bb" "AAA")
-    ;; Additional test copied from subr-tests.el:
-    (compat--should "zot" "foo" "bar" "zot")
-    (compat--should "barzot" "foo" "bar" "foozot")
-    (compat--should "barbarzot" "foo" "bar" "barfoozot")
-    (compat--should "barfoobar" "zot" "bar" "barfoozot")
-    (compat--should "barfoobarot" "z" "bar" "barfoozot")
-    (compat--should "zat" "zot" "bar" "zat")
-    (compat--should "zat" "azot" "bar" "zat")
-    (compat--should "bar" "azot" "bar" "azot")
-    (compat--should "foozotbar" "azot" "bar" "foozotbar")
-    (compat--should "labarbarbarzot" "fo" "bar" "lafofofozot")
-    (compat--should "axb" "\377" "x" "a\377b")
-    (compat--should "axø" "\377" "x" "a\377ø")
-    (when (version<= "27" emacs-version)
-      ;; FIXME The commit a1f76adfb03c23bb4242928e8efe6193c301f0c1
-      ;; in emacs.git fixes the behaviour of regular
-      ;; expressions matching raw bytes.  The compatibility
-      ;; functions should updated to backport this
-      ;; behaviour.
-      (compat--should "axb" (string-to-multibyte "\377") "x" "a\377b")
-      (compat--should "axø" (string-to-multibyte "\377") "x" "a\377ø"))
-    (compat--should "ANAnas" "ana" "ANA" "ananas")
-    (compat--should "" "a" "" "")
-    (compat--should "" "a" "" "aaaaa")
-    (compat--should "" "ab" "" "ababab")
-    (compat--should "ccc" "ab" "" "abcabcabc")
-    (compat--should "aaaaaa" "a" "aa" "aaa")
-    (compat--should "defg" "abc" "defg" "abc")
-    (when (version<= "24.4" emacs-version)
-      ;; FIXME: Emacs 24.3 do not know of `wrong-length-argument' and
-      ;; therefore fail this test, even if the right symbol is being
-      ;; thrown.
-      (compat--error wrong-length-argument "" "x" "abc"))))
-
-(ert-deftest compat-length= ()
-  "Check if `compat--string-length=' was implemented correctly."
-  (compat-test length=
-    (compat--should t '() 0)                  ;empty list
-    (compat--should t '(1) 1)                  ;single element
-    (compat--should t '(1 2 3) 3)             ;multiple elements
-    (compat--should nil '(1 2 3) 2)           ;less than
-    (compat--should nil '(1) 0)
-    (compat--should nil '(1 2 3) 4)           ;more than
-    (compat--should nil '(1) 2)
-    (compat--should nil '() 1)
-    (compat--should t [] 0)                   ;empty vector
-    (compat--should t [1] 1)                   ;single element vector
-    (compat--should t [1 2 3] 3)              ;multiple element vector
-    (compat--should nil [1 2 3] 2)            ;less than
-    (compat--should nil [1 2 3] 4)            ;more than
-    (compat--error wrong-type-argument 3 nil)))
-
-(ert-deftest compat-length< ()
-  "Check if `compat--length<' was implemented correctly."
-  (compat-test length<
-    (compat--should nil '(1) 0)               ;single element
-    (compat--should nil '(1 2 3) 2)           ;multiple elements
-    (compat--should nil '(1 2 3) 3)           ;equal length
-    (compat--should nil '(1) 1)
-    (compat--should t '(1 2 3) 4)             ;more than
-    (compat--should t '(1) 2)
-    (compat--should t '() 1)
-    (compat--should nil [1] 0)                ;single element vector
-    (compat--should nil [1 2 3] 2)            ;multiple element vector
-    (compat--should nil [1 2 3] 3)            ;equal length
-    (compat--should t [1 2 3] 4)              ;more than
-    (compat--error wrong-type-argument 3 nil)))
-
-(ert-deftest compat-length> ()
-  "Check if `compat--length>' was implemented correctly."
-  (compat-test length>
-    (compat--should t '(1) 0)                  ;single element
-    (compat--should t '(1 2 3) 2)             ;multiple elements
-    (compat--should nil '(1 2 3) 3)           ;equal length
-    (compat--should nil '(1) 1)
-    (compat--should nil '(1 2 3) 4)           ;more than
-    (compat--should nil '(1) 2)
-    (compat--should nil '() 1)
-    (compat--should t [1] 0)                   ;single element vector
-    (compat--should t [1 2 3] 2)              ;multiple element vector
-    (compat--should nil [1 2 3] 3)            ;equal length
-    (compat--should nil [1 2 3] 4)            ;more than
-    (compat--error wrong-type-argument 3 nil)))
-
-(ert-deftest compat-always ()
-  "Check if `compat--always' was implemented correctly."
-  (compat-test always
-    (compat--should t)                        ;no arguments
-    (compat--should t 1)                      ;single argument
-    (compat--should t 1 2 3 4)))              ;multiple arguments
+(compat-deftest string-search
+  ;; Find needle at the beginning of a haystack:
+  (ought 0 "a" "abb")
+  ;; Find needle at the begining of a haystack, with more potential
+  ;; needles that could be found:
+  (ought 0 "a" "abba")
+  ;; Find needle with more than one charachter at the beginning of
+  ;; a line:
+  (ought 0 "aa" "aabbb")
+  ;; Find a needle midstring:
+  (ought 1 "a" "bab")
+  ;; Find a needle at the end:
+  (ought 2 "a" "bba")
+  ;; Find a longer needle midstring:
+  (ought 1 "aa" "baab")
+  ;; Find a longer needle at the end:
+  (ought 2 "aa" "bbaa")
+  ;; Find a case-sensitive needle:
+  (ought 2 "a" "AAa")
+  ;; Find another case-sensitive needle:
+  (ought 2 "aa" "AAaa")
+  ;; Test regular expression quoting (1):
+  (ought 5 "." "abbbb.b")
+  ;; Test regular expression quoting (2):
+  (ought 5 ".*" "abbbb.*b")
+  ;; Attempt to find non-existent needle:
+  (ought nil "a" "bbb")
+  ;; Attempt to find non-existent needle that has the form of a
+  ;; regular expression:
+  (ought nil "." "bbb")
+  ;; Handle empty string as needle:
+  (ought 0 "" "abc")
+  ;; Handle empty string as haystack:
+  (ought nil "a" "")
+  ;; Handle empty string as needle and haystack:
+  (ought 0 "" "")
+  ;; Handle START argument:
+  (ought 3 "a" "abba" 1)
+  ;; Additional test copied from:
+  (ought 6 "zot" "foobarzot")
+  (ought 0 "foo" "foobarzot")
+  (ought nil "fooz" "foobarzot")
+  (ought nil "zot" "foobarzo")
+  (ought 0 "ab" "ab")
+  (ought nil "ab\0" "ab")
+  (ought 4 "ab" "abababab" 3)
+  (ought nil "ab" "ababac" 3)
+  (ought nil "aaa" "aa")
+  ;; The `make-string' calls with three arguments have been replaced
+  ;; here with the result of their evaluation, to avoid issues with
+  ;; older versions of Emacs that only support two arguments.
+  (ought 5
+                  (make-string 2 130)
+                  ;; Per (concat "helló" (make-string 5 130 t) "bár")
+                  "hell󂂂‚‚bár")
+  (ought 5
+                  (make-string 2 127)
+                  ;; Per (concat "helló" (make-string 5 127 t) "bár")
+                  "hellóbár")
+  (ought 1 "\377" "a\377ø")
+  (ought 1 "\377" "a\377a")
+  (ought nil (make-string 1 255) "a\377ø")
+  (ought nil (make-string 1 255) "a\377a")
+  (ought 3 "fóo" "zotfóo")
+  (ought nil "\303" "aøb")
+  (ought nil "\270" "aøb")
+  (ought nil "ø" "\303\270")
+  (ought nil "ø" (make-string 32 ?a))
+  (ought nil "ø" (string-to-multibyte (make-string 32 ?a)))
+  (ought 14 "o" (string-to-multibyte
+                          (apply #'string (number-sequence ?a ?z))))
+  (ought 2 "a\U00010f98z" "a\U00010f98a\U00010f98z")
+  (expect (args-out-of-range -1) "a" "abc" -1)
+  (expect (args-out-of-range 4) "a" "abc" 4)
+  (expect (args-out-of-range 100000000000)
+                 "a" "abc" 100000000000)
+  (ought nil "a" "aaa" 3)
+  (ought nil "aa" "aa" 1)
+  (ought nil "\0" "")
+  (ought 0 "" "")
+  (expect (args-out-of-range 1) "" "" 1)
+  (ought 0 "" "abc")
+  (ought 2 "" "abc" 2)
+  (ought 3 "" "abc" 3)
+  (expect (args-out-of-range 4) "" "abc" 4)
+  (expect (args-out-of-range -1) "" "abc" -1)
+  (ought nil "ø" "foo\303\270")
+  (ought nil "\303\270" "ø")
+  (ought nil "\370" "ø")
+  (ought nil (string-to-multibyte "\370") "ø")
+  (ought nil "ø" "\370")
+  (ought nil "ø" (string-to-multibyte "\370"))
+  (ought nil "\303\270" "\370")
+  (ought nil (string-to-multibyte "\303\270") "\370")
+  (ought nil "\303\270" (string-to-multibyte "\370"))
+  (ought nil
+                  (string-to-multibyte "\303\270")
+                  (string-to-multibyte "\370"))
+  (ought nil "\370" "\303\270")
+  (ought nil (string-to-multibyte "\370") "\303\270")
+  (ought nil "\370" (string-to-multibyte "\303\270"))
+  (ought nil
+                  (string-to-multibyte "\370")
+                  (string-to-multibyte "\303\270"))
+  (ought 3 "\303\270" "foo\303\270")
+  (when (version<= "27" emacs-version)
+    ;; FIXME The commit a1f76adfb03c23bb4242928e8efe6193c301f0c1 in
+    ;; emacs.git fixes the behaviour of regular expressions matching
+    ;; raw bytes.  The compatibility functions should updated to
+    ;; backport this behaviour.
+    (ought 2 (string-to-multibyte "\377") "ab\377c")
+    (ought 2
+                    (string-to-multibyte "o\303\270")
+                    "foo\303\270")))
+
+(compat-deftest compat-string-search
+  ;; Find needle at the beginning of a haystack:
+  (ought 0 "a" "abb")
+  ;; Find needle at the begining of a haystack, with more potential
+  ;; needles that could be found:
+  (ought 0 "a" "abba")
+  ;; Find needle with more than one charachter at the beginning of
+  ;; a line:
+  (ought 0 "aa" "aabbb")
+  ;; Find a needle midstring:
+  (ought 1 "a" "bab")
+  ;; Find a needle at the end:
+  (ought 2 "a" "bba")
+  ;; Find a longer needle midstring:
+  (ought 1 "aa" "baab")
+  ;; Find a longer needle at the end:
+  (ought 2 "aa" "bbaa")
+  ;; Find a case-sensitive needle:
+  (ought 2 "a" "AAa")
+  ;; Find another case-sensitive needle:
+  (ought 2 "aa" "AAaa")
+  ;; Test regular expression quoting (1):
+  (ought 5 "." "abbbb.b")
+  ;; Test regular expression quoting (2):
+  (ought 5 ".*" "abbbb.*b")
+  ;; Attempt to find non-existent needle:
+  (ought nil "a" "bbb")
+  ;; Attempt to find non-existent needle that has the form of a
+  ;; regular expression:
+  (ought nil "." "bbb")
+  ;; Handle empty string as needle:
+  (ought 0 "" "abc")
+  ;; Handle empty string as haystack:
+  (ought nil "a" "")
+  ;; Handle empty string as needle and haystack:
+  (ought 0 "" "")
+  ;; Handle START argument:
+  (ought 3 "a" "abba" 1)
+  ;; Additional test copied from:
+  (ought 6 "zot" "foobarzot")
+  (ought 0 "foo" "foobarzot")
+  (ought nil "fooz" "foobarzot")
+  (ought nil "zot" "foobarzo")
+  (ought 0 "ab" "ab")
+  (ought nil "ab\0" "ab")
+  (ought 4 "ab" "abababab" 3)
+  (ought nil "ab" "ababac" 3)
+  (ought nil "aaa" "aa")
+  ;; The `make-string' calls with three arguments have been replaced
+  ;; here with the result of their evaluation, to avoid issues with
+  ;; older versions of Emacs that only support two arguments.
+  (ought 5
+                  (make-string 2 130)
+                  ;; Per (concat "helló" (make-string 5 130 t) "bár")
+                  "hell󂂂‚‚bár")
+  (ought 5
+                  (make-string 2 127)
+                  ;; Per (concat "helló" (make-string 5 127 t) "bár")
+                  "hellóbár")
+  (ought 1 "\377" "a\377ø")
+  (ought 1 "\377" "a\377a")
+  (ought nil (make-string 1 255) "a\377ø")
+  (ought nil (make-string 1 255) "a\377a")
+  (ought 3 "fóo" "zotfóo")
+  (ought nil "\303" "aøb")
+  (ought nil "\270" "aøb")
+  (ought nil "ø" "\303\270")
+  (ought nil "ø" (make-string 32 ?a))
+  (ought nil "ø" (string-to-multibyte (make-string 32 ?a)))
+  (ought 14 "o" (string-to-multibyte
+                          (apply #'string (number-sequence ?a ?z))))
+  (ought 2 "a\U00010f98z" "a\U00010f98a\U00010f98z")
+  (expect (args-out-of-range -1) "a" "abc" -1)
+  (expect (args-out-of-range 4) "a" "abc" 4)
+  (expect (args-out-of-range 100000000000)
+                 "a" "abc" 100000000000)
+  (ought nil "a" "aaa" 3)
+  (ought nil "aa" "aa" 1)
+  (ought nil "\0" "")
+  (ought 0 "" "")
+  (expect (args-out-of-range 1) "" "" 1)
+  (ought 0 "" "abc")
+  (ought 2 "" "abc" 2)
+  (ought 3 "" "abc" 3)
+  (expect (args-out-of-range 4) "" "abc" 4)
+  (expect (args-out-of-range -1) "" "abc" -1)
+  (ought nil "ø" "foo\303\270")
+  (ought nil "\303\270" "ø")
+  (ought nil "\370" "ø")
+  (ought nil (string-to-multibyte "\370") "ø")
+  (ought nil "ø" "\370")
+  (ought nil "ø" (string-to-multibyte "\370"))
+  (ought nil "\303\270" "\370")
+  (ought nil (string-to-multibyte "\303\270") "\370")
+  (ought nil "\303\270" (string-to-multibyte "\370"))
+  (ought nil
+                  (string-to-multibyte "\303\270")
+                  (string-to-multibyte "\370"))
+  (ought nil "\370" "\303\270")
+  (ought nil (string-to-multibyte "\370") "\303\270")
+  (ought nil "\370" (string-to-multibyte "\303\270"))
+  (ought nil
+                  (string-to-multibyte "\370")
+                  (string-to-multibyte "\303\270"))
+  (ought 3 "\303\270" "foo\303\270")
+  (when (version<= "27" emacs-version)
+    ;; FIXME The commit a1f76adfb03c23bb4242928e8efe6193c301f0c1 in
+    ;; emacs.git fixes the behaviour of regular expressions matching
+    ;; raw bytes.  The compatibility functions should updated to
+    ;; backport this behaviour.
+    (ought 2 (string-to-multibyte "\377") "ab\377c")
+    (ought 2
+                    (string-to-multibyte "o\303\270")
+                    "foo\303\270")))
+
+(compat-deftest string-replace
+  (ought "bba" "aa" "bb" "aaa")
+  (ought "AAA" "aa" "bb" "AAA")
+  ;; Additional test copied from subr-tests.el:
+  (ought "zot" "foo" "bar" "zot")
+  (ought "barzot" "foo" "bar" "foozot")
+  (ought "barbarzot" "foo" "bar" "barfoozot")
+  (ought "barfoobar" "zot" "bar" "barfoozot")
+  (ought "barfoobarot" "z" "bar" "barfoozot")
+  (ought "zat" "zot" "bar" "zat")
+  (ought "zat" "azot" "bar" "zat")
+  (ought "bar" "azot" "bar" "azot")
+  (ought "foozotbar" "azot" "bar" "foozotbar")
+  (ought "labarbarbarzot" "fo" "bar" "lafofofozot")
+  (ought "axb" "\377" "x" "a\377b")
+  (ought "axø" "\377" "x" "a\377ø")
+  (when (version<= "27" emacs-version)
+    ;; FIXME The commit a1f76adfb03c23bb4242928e8efe6193c301f0c1
+    ;; in emacs.git fixes the behaviour of regular
+    ;; expressions matching raw bytes.  The compatibility
+    ;; functions should updated to backport this
+    ;; behaviour.
+    (ought "axb" (string-to-multibyte "\377") "x" "a\377b")
+    (ought "axø" (string-to-multibyte "\377") "x" "a\377ø"))
+  (ought "ANAnas" "ana" "ANA" "ananas")
+  (ought "" "a" "" "")
+  (ought "" "a" "" "aaaaa")
+  (ought "" "ab" "" "ababab")
+  (ought "ccc" "ab" "" "abcabcabc")
+  (ought "aaaaaa" "a" "aa" "aaa")
+  (ought "defg" "abc" "defg" "abc")
+  (when (version<= "24.4" emacs-version)
+    ;; FIXME: Emacs 24.3 do not know of `wrong-length-argument' and
+    ;; therefore fail this test, even if the right symbol is being
+    ;; thrown.
+    (expect wrong-length-argument "" "x" "abc")))
+
+(compat-deftest length=
+  (ought t '() 0)                  ;empty list
+  (ought t '(1) 1)                     ;single element
+  (ought t '(1 2 3) 3)             ;multiple elements
+  (ought nil '(1 2 3) 2)           ;less than
+  (ought nil '(1) 0)
+  (ought nil '(1 2 3) 4)           ;more than
+  (ought nil '(1) 2)
+  (ought nil '() 1)
+  (ought t [] 0)                   ;empty vector
+  (ought t [1] 1)                      ;single element vector
+  (ought t [1 2 3] 3)              ;multiple element vector
+  (ought nil [1 2 3] 2)            ;less than
+  (ought nil [1 2 3] 4)            ;more than
+  (expect wrong-type-argument 3 nil))
+
+(compat-deftest length<
+  (ought nil '(1) 0)               ;single element
+  (ought nil '(1 2 3) 2)           ;multiple elements
+  (ought nil '(1 2 3) 3)           ;equal length
+  (ought nil '(1) 1)
+  (ought t '(1 2 3) 4)             ;more than
+  (ought t '(1) 2)
+  (ought t '() 1)
+  (ought nil [1] 0)                ;single element vector
+  (ought nil [1 2 3] 2)            ;multiple element vector
+  (ought nil [1 2 3] 3)            ;equal length
+  (ought t [1 2 3] 4)              ;more than
+  (expect wrong-type-argument 3 nil))
+
+(compat-deftest length>
+  (ought t '(1) 0)                     ;single element
+  (ought t '(1 2 3) 2)             ;multiple elements
+  (ought nil '(1 2 3) 3)           ;equal length
+  (ought nil '(1) 1)
+  (ought nil '(1 2 3) 4)           ;more than
+  (ought nil '(1) 2)
+  (ought nil '() 1)
+  (ought t [1] 0)                      ;single element vector
+  (ought t [1 2 3] 2)              ;multiple element vector
+  (ought nil [1 2 3] 3)            ;equal length
+  (ought nil [1 2 3] 4)            ;more than
+  (expect wrong-type-argument 3 nil))
+
+(compat-deftest always
+  (ought t)                        ;no arguments
+  (ought t 1)                      ;single argument
+  (ought t 1 2 3 4))              ;multiple arguments
 
 (ert-deftest compat-insert-into-buffer ()
   "Check if `insert-into-buffer' was implemented correctly."
@@ -394,138 +489,121 @@ the compatibility function."
          (insert-into-buffer other 2 3))
        (should (string= (buffer-string) "abce"))))))
 
-(ert-deftest compat-file-name-with-extension ()
-  "Check if `compat--file-name-with-extension' was implemented correctly."
-  (compat-test file-name-with-extension
-    (compat--should "file.ext" "file" "ext")
-    (compat--should "file.ext" "file" ".ext")
-    (compat--should "file.ext" "file." ".ext")
-    (compat--should "file..ext" "file.." ".ext")
-    (compat--should "file..ext" "file." "..ext")
-    (compat--should "file...ext" "file.." "..ext")
-    (compat--should "/abs/file.ext" "/abs/file" "ext")
-    (compat--should "/abs/file.ext" "/abs/file" ".ext")
-    (compat--should "/abs/file.ext" "/abs/file." ".ext")
-    (compat--should "/abs/file..ext" "/abs/file.." ".ext")
-    (compat--should "/abs/file..ext" "/abs/file." "..ext")
-    (compat--should "/abs/file...ext" "/abs/file.." "..ext")
-    (compat--error error "file" "")
-    (compat--error error "" "ext")
-    (compat--error error "file" "")
-    (compat--error error "rel/" "ext")
-    (compat--error error "/abs/" "ext")))
-
-(ert-deftest compat-string-width ()
-  "Check if `compat--string-width' was implemented correctly."
-  (compat-test compat-string-width
-    (compat--should 0 "")
-    (compat--should 3 "abc")                   ;no argument
-    (compat--should 5 "abcあ")
-    (compat--should (1+ tab-width) "a  ")
-    (compat--should 2 "abc" 1)               ;with from
-    (compat--should 4 "abcあ" 1)
-    (compat--should tab-width "a       " 1)
-    (compat--should 2 "abc" 0 2)             ;with to
-    (compat--should 3 "abcあ" 0 3)
-    (compat--should 1 "a       " 0 1)
-    (compat--should 1 "abc" 1 2)             ;with from and to
-    (compat--should 2 "abcあ" 3 4)
-    (compat--should 0 "a       " 1 1)))
-
-(ert-deftest compat-ensure-list ()
-  "Check if `compat--ensure-list' was implemented correctly."
-  (compat-test ensure-list
-    (compat--should nil nil)                        ;empty list
-    (compat--should '(1) '(1))                        ;single element list
-    (compat--should '(1 2 3) '(1 2 3))                ;multiple element list
-    (compat--should '(1) 1)))                          ;atom
-
-(ert-deftest compat-proper-list-p-1 ()
-  "Check if `compat--proper-list-p' was implemented correctly (>=26.1)."
-  (unless (version< emacs-version "26")
-    (compat-test (proper-list-p compat--proper-list-p-length-signal)
-      (compat--should 0 ())                            ;empty list
-      (compat--should 1 '(1))                          ;single element
-      (compat--should 3 '(1 2 3))                      ;multiple elements
-      (compat--should nil '(1 . 2))                    ;cons
-      (compat--should nil '(1 2 . 3))                  ;dotted
-      (compat--should nil (let ((l (list 1 2 3)))              ;circular
-                            (setf (nthcdr 3 l) l)
-                            l))
-      (compat--should nil 1)                              ;non-lists
-      (compat--should nil "")
-      (compat--should nil "abc")
-      (compat--should nil [])
-      (compat--should nil [1 2 3]))))
-
-(ert-deftest compat-proper-list-p-2 ()
-  "Check if `compat--proper-list-p' was implemented correctly (<25.3)."
-  (compat-test (proper-list-p compat--proper-list-p-tortoise-hare)
-    (compat--should 0 ())                              ;empty list
-    (compat--should 1 '(1))                            ;single element
-    (compat--should 3 '(1 2 3))                        ;multiple elements
-    (compat--should nil '(1 . 2))                      ;cons
-    (compat--should nil '(1 2 . 3))                    ;dotted
-    (compat--should nil (let ((l (list 1 2 3)))                ;circular
-                          (setf (nthcdr 3 l) l)
-                          l))
-    (compat--should nil 1)                              ;non-lists
-    (compat--should nil "")
-    (compat--should nil "abc")
-    (compat--should nil [])
-    (compat--should nil [1 2 3])))
-
-
-(ert-deftest compat-flatten-tree ()
-  "Check if `compat--flatten-tree' was implemented correctly."
-  (compat-test flatten-tree
-    ;; Example from docstring:
-    (compat--should '(1 2 3 4 5 6 7) '(1 (2 . 3) nil (4 5 (6)) 7))
-    ;; Trivial example
-    (compat--should nil ())
-    ;; Simple examples
-    (compat--should '(1) '(1))
-    (compat--should '(1 2) '(1 2))
-    (compat--should '(1 2 3) '(1 2 3))
-    ;; Regular sublists
-    (compat--should '(1) '((1)))
-    (compat--should '(1 2) '((1) (2)))
-    (compat--should '(1 2 3) '((1) (2) (3)))
-    ;; Complex examples
-    (compat--should '(1) '(((((1))))))
-    (compat--should '(1 2 3 4) '((1) nil 2 ((3 4))))
-    (compat--should '(1 2 3 4) '(((1 nil)) 2 (((3 nil nil) 4))))))
-
-(ert-deftest compat-xor ()
-  "Check if `compat--xor' was implemented correctly."
-  (compat-test xor
-    (compat--should t t nil)
-    (compat--should t nil t)
-    (compat--should nil nil nil)
-    (compat--should nil t t)))
-
-(ert-deftest compat-string-distance ()
-  "Check if `compat--string-distance' was implemented correctly."
-  (compat-test string-distance
-    (compat--should 3 "kitten" "sitting")     ;from wikipedia
-    (if (version<= "28" emacs-version) ;trivial examples
-        (compat--should 0 "" "")
-      ;; Up until Emacs 28, `string-distance' had a bug
-      ;; when comparing two empty strings. This was fixed
-      ;; in the following commit:
-      ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c44190c
-      ;;
-      ;; Therefore, we must make sure, that the test
-      ;; doesn't fail because of this bug:
-      (should (= (compat--string-distance "" "") 0)))
-    (compat--should 0 "a" "a")
-    (compat--should 1 "" "a")
-    (compat--should 1 "b" "a")
-    (compat--should 2 "aa" "bb")
-    (compat--should 2 "aa" "bba")
-    (compat--should 2 "aaa" "bba")
-    (compat--should 3 "a" "あ" t)             ;byte example
-    (compat--should 1 "a" "あ")))
+(compat-deftest file-name-with-extension
+  (ought "file.ext" "file" "ext")
+  (ought "file.ext" "file" ".ext")
+  (ought "file.ext" "file." ".ext")
+  (ought "file..ext" "file.." ".ext")
+  (ought "file..ext" "file." "..ext")
+  (ought "file...ext" "file.." "..ext")
+  (ought "/abs/file.ext" "/abs/file" "ext")
+  (ought "/abs/file.ext" "/abs/file" ".ext")
+  (ought "/abs/file.ext" "/abs/file." ".ext")
+  (ought "/abs/file..ext" "/abs/file.." ".ext")
+  (ought "/abs/file..ext" "/abs/file." "..ext")
+  (ought "/abs/file...ext" "/abs/file.." "..ext")
+  (expect error "file" "")
+  (expect error "" "ext")
+  (expect error "file" "")
+  (expect error "rel/" "ext")
+  (expect error "/abs/" "ext"))
+
+(compat-deftest compat-string-width
+  (ought 0 "")
+  (ought 3 "abc")                      ;no argument
+  (ought 5 "abcあ")
+  (ought (1+ tab-width) "a     ")
+  (ought 2 "abc" 1)               ;with from
+  (ought 4 "abcあ" 1)
+  (ought tab-width "a  " 1)
+  (ought 2 "abc" 0 2)             ;with to
+  (ought 3 "abcあ" 0 3)
+  (ought 1 "a  " 0 1)
+  (ought 1 "abc" 1 2)             ;with from and to
+  (ought 2 "abcあ" 3 4)
+  (ought 0 "a  " 1 1))
+
+(compat-deftest ensure-list
+  (ought nil nil)                        ;empty list
+  (ought '(1) '(1))                        ;single element list
+  (ought '(1 2 3) '(1 2 3))                ;multiple element list
+  (ought '(1) 1))                          ;atom
+
+(unless (version< emacs-version "26")
+  (compat-deftest (proper-list-p compat--proper-list-p-length-signal)
+    (ought 0 ())                               ;empty list
+    (ought 1 '(1))                             ;single element
+    (ought 3 '(1 2 3))                 ;multiple elements
+    (ought nil '(1 . 2))                       ;cons
+    (ought nil '(1 2 . 3))                     ;dotted
+    (ought nil (let ((l (list 1 2 3)))         ;circular
+                 (setf (nthcdr 3 l) l)
+                 l))
+    (ought nil 1)                       ;non-lists
+    (ought nil "")
+    (ought nil "abc")
+    (ought nil [])
+    (ought nil [1 2 3])))
+
+(compat-deftest (proper-list-p compat--proper-list-p-tortoise-hare)
+  (ought 0 ())                         ;empty list
+  (ought 1 '(1))                        ;single element
+  (ought 3 '(1 2 3))                   ;multiple elements
+  (ought nil '(1 . 2))                 ;cons
+  (ought nil '(1 2 . 3))                ;dotted
+  (ought nil (let ((l (list 1 2 3)))    ;circular
+               (setf (nthcdr 3 l) l)
+               l))
+  (ought nil 1)                         ;non-lists
+  (ought nil "")
+  (ought nil "abc")
+  (ought nil [])
+  (ought nil [1 2 3]))
+
+(compat-deftest flatten-tree
+  ;; Example from docstring:
+  (ought '(1 2 3 4 5 6 7) '(1 (2 . 3) nil (4 5 (6)) 7))
+  ;; Trivial example
+  (ought nil ())
+  ;; Simple examples
+  (ought '(1) '(1))
+  (ought '(1 2) '(1 2))
+  (ought '(1 2 3) '(1 2 3))
+  ;; Regular sublists
+  (ought '(1) '((1)))
+  (ought '(1 2) '((1) (2)))
+  (ought '(1 2 3) '((1) (2) (3)))
+  ;; Complex examples
+  (ought '(1) '(((((1))))))
+  (ought '(1 2 3 4) '((1) nil 2 ((3 4))))
+  (ought '(1 2 3 4) '(((1 nil)) 2 (((3 nil nil) 4)))))
+
+(compat-deftest xor
+  (ought t t nil)
+  (ought t nil t)
+  (ought nil nil nil)
+  (ought nil t t))
+
+(compat-deftest string-distance
+  (ought 3 "kitten" "sitting")     ;from wikipedia
+  (if (version<= "28" emacs-version) ;trivial examples
+      (ought 0 "" "")
+    ;; Up until Emacs 28, `string-distance' had a bug
+    ;; when comparing two empty strings. This was fixed
+    ;; in the following commit:
+    ;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c44190c
+    ;;
+    ;; Therefore, we must make sure, that the test
+    ;; doesn't fail because of this bug:
+    (should (= (compat--string-distance "" "") 0)))
+  (ought 0 "a" "a")
+  (ought 1 "" "a")
+  (ought 1 "b" "a")
+  (ought 2 "aa" "bb")
+  (ought 2 "aa" "bba")
+  (ought 2 "aaa" "bba")
+  (ought 3 "a" "あ" t)             ;byte example
+  (ought 1 "a" "あ"))
 
 (ert-deftest compat-regexp-unmatchable ()
   "Check if `compat--string-distance' was implemented correctly."
@@ -537,205 +615,194 @@ the compatibility function."
     (when (boundp 'regexp-unmatchable)
       (should-not (string-match-p regexp-unmatchable str)))))
 
+(compat-deftest compat-regexp-opt
+  ;; Ensure `compat--regexp-opt' doesn't change the existing
+  ;; behaviour:
+  (ought (regexp-opt '("a" "b" "c")) '("a" "b" "c"))
+  (ought (regexp-opt '("abc" "def" "ghe")) '("abc" "def" "ghe"))
+  (ought (regexp-opt '("a" "b" "c") 'words) '("a" "b" "c") 'words)
+  ;; Test empty list:
+  (ought "\\(?:\\`a\\`\\)" '())
+  (ought "\\<\\(\\`a\\`\\)\\>" '() 'words))
+
 (ert-deftest compat-regexp-opt ()
   "Check if `compat--regexp-opt' advice was defined correctly."
-  (compat-test compat-regexp-opt
-               ;; Ensure `compat--regexp-opt' doesn't change the existing
-               ;; behaviour:
-               (compat--should (regexp-opt '("a" "b" "c")) '("a" "b" "c"))
-               (compat--should (regexp-opt '("abc" "def" "ghe")) '("abc" "def" 
"ghe"))
-               (compat--should (regexp-opt '("a" "b" "c") 'words) '("a" "b" 
"c") 'words)
-               ;; Test empty list:
-               (compat--should "\\(?:\\`a\\`\\)" '())
-               (compat--should "\\<\\(\\`a\\`\\)\\>" '() 'words))
-  (let ((unmatchable (compat--compat-regexp-opt '())))
+  (let ((unmatchable "\\(?:\\`a\\`\\)"))
     (dolist (str '(""                   ;empty string
                    "a"                  ;simple string
                    "aaa"                ;longer string
                    ))
       (should-not (string-match-p unmatchable str)))))
 
-(ert-deftest compat-assoc ()
-  "Check if `compat--assoc' advice was advised correctly."
-  (compat-test compat-assoc
-    ;; Fallback behaviour:
-    (compat--should nil 1 nil)               ;empty list
-    (compat--should '(1) 1 '((1)))            ;single element list
-    (compat--should nil 1 '(1))
-    (compat--should '(2) 2 '((1) (2) (3)))    ;multiple element list
-    (compat--should nil 2 '(1 2 3))
-    (compat--should '(2) 2 '(1 (2) 3))
-    (compat--should nil 2 '((1) 2 (3)))
-    (compat--should '(1) 1 '((3) (2) (1)))
-    (compat--should '("a") "a" '(("a") ("b") ("c")))  ;non-primitive elements
-    (compat--should '("a" 0) "a" '(("c" . "a") "b" ("a" 0)))
-    ;; With testfn (advised behaviour):
-    (compat--should '(1) 3 '((10) (4) (1) (9)) #'<)
-    (compat--should '("a") "b" '(("c") ("a") ("b")) #'string-lessp)
-    (compat--should '("b") "a" '(("a") ("a") ("b"))
-                     (lambda (s1 s2) (not (string= s1 s2))))
-    (compat--should
-     '("\\.el\\'" . emacs-lisp-mode)
-     "file.el"
-     '(("\\.c\\'" . c-mode)
-       ("\\.p\\'" . pascal-mode)
-       ("\\.el\\'" . emacs-lisp-mode)
-       ("\\.awk\\'" . awk-mode))
-     #'string-match-p)))
+(compat-deftest compat-assoc
+  ;; Fallback behaviour:
+  (ought nil 1 nil)               ;empty list
+  (ought '(1) 1 '((1)))            ;single element list
+  (ought nil 1 '(1))
+  (ought '(2) 2 '((1) (2) (3)))    ;multiple element list
+  (ought nil 2 '(1 2 3))
+  (ought '(2) 2 '(1 (2) 3))
+  (ought nil 2 '((1) 2 (3)))
+  (ought '(1) 1 '((3) (2) (1)))
+  (ought '("a") "a" '(("a") ("b") ("c")))  ;non-primitive elements
+  (ought '("a" 0) "a" '(("c" . "a") "b" ("a" 0)))
+  ;; With testfn (advised behaviour):
+  (ought '(1) 3 '((10) (4) (1) (9)) #'<)
+  (ought '("a") "b" '(("c") ("a") ("b")) #'string-lessp)
+  (ought '("b") "a" '(("a") ("a") ("b"))
+         (lambda (s1 s2) (not (string= s1 s2))))
+  (ought
+   '("\\.el\\'" . emacs-lisp-mode)
+   "file.el"
+   '(("\\.c\\'" . c-mode)
+     ("\\.p\\'" . pascal-mode)
+     ("\\.el\\'" . emacs-lisp-mode)
+     ("\\.awk\\'" . awk-mode))
+   #'string-match-p))
 
 ;; (when (fboundp 'alist-get)
 ;;   (ert-deftest compat-alist-get-1 ()
 ;;     "Check if `compat--alist-get' was advised correctly."
-;;     (compat-test compat-alist-get
+;;     (compat-deftest compat-alist-get
 ;;       ;; Fallback behaviour:
-;;       (compat--should nil 1 nil)                      ;empty list
-;;       (compat--should 'a 1 '((1 . a)))                  ;single element list
-;;       (compat--should nil 1 '(1))
-;;       (compat--should 'b 2 '((1 . a) (2 . b) (3 . c)))  ;multiple element 
list
-;;       (compat--should nil 2 '(1 2 3))
-;;       (compat--should 'b 2 '(1 (2 . b) 3))
-;;       (compat--should nil 2 '((1 . a) 2 (3 . c)))
-;;       (compat--should 'a 1 '((3 . c) (2 . b) (1 . a)))
-;;       (compat--should nil "a" '(("a" . 1) ("b" . 2) ("c" . 3)))  
;non-primitive elements
+;;       (ought nil 1 nil)                      ;empty list
+;;       (ought 'a 1 '((1 . a)))                  ;single element list
+;;       (ought nil 1 '(1))
+;;       (ought 'b 2 '((1 . a) (2 . b) (3 . c)))  ;multiple element list
+;;       (ought nil 2 '(1 2 3))
+;;       (ought 'b 2 '(1 (2 . b) 3))
+;;       (ought nil 2 '((1 . a) 2 (3 . c)))
+;;       (ought 'a 1 '((3 . c) (2 . b) (1 . a)))
+;;       (ought nil "a" '(("a" . 1) ("b" . 2) ("c" . 3)))  ;non-primitive 
elements
 
 ;;       ;; With testfn (advised behaviour):
-;;       (compat--should 1 "a" '(("a" . 1) ("b" . 2) ("c" . 3)) nil nil 
#'equal)
-;;       (compat--should 1 3 '((10 . 10) (4 . 4) (1 . 1) (9 . 9)) nil nil #'<)
-;;       (compat--should '(a) "b" '(("c" c) ("a" a) ("b" b)) nil nil 
#'string-lessp)
-;;       (compat--should 'c "a" '(("a" . a) ("a" . b) ("b" . c)) nil nil
+;;       (ought 1 "a" '(("a" . 1) ("b" . 2) ("c" . 3)) nil nil #'equal)
+;;       (ought 1 3 '((10 . 10) (4 . 4) (1 . 1) (9 . 9)) nil nil #'<)
+;;       (ought '(a) "b" '(("c" c) ("a" a) ("b" b)) nil nil #'string-lessp)
+;;       (ought 'c "a" '(("a" . a) ("a" . b) ("b" . c)) nil nil
 ;;                        (lambda (s1 s2) (not (string= s1 s2))))
-;;       (compat--should 'emacs-lisp-mode
+;;       (ought 'emacs-lisp-mode
 ;;                        "file.el"
 ;;                        '(("\\.c\\'" . c-mode)
 ;;                          ("\\.p\\'" . pascal-mode)
 ;;                          ("\\.el\\'" . emacs-lisp-mode)
 ;;                          ("\\.awk\\'" . awk-mode))
 ;;                        nil nil #'string-match-p)
-;;       (compat--should 'd 0 '((1 . a) (2 . b) (3 . c)) 'd) ;default value
-;;       (compat--should 'd 2 '((1 . a) (2 . b) (3 . c)) 'd nil #'ignore))))
-
-(ert-deftest compat-alist-get-2 ()
-  "Check if `compat--alist-get' was implemented correctly."
-  (compat-test (alist-get compat--alist-get-full-elisp)
-    ;; Fallback behaviour:
-    (compat--should nil 1 nil)                      ;empty list
-    (compat--should 'a 1 '((1 . a)))                  ;single element list
-    (compat--should nil 1 '(1))
-    (compat--should 'b 2 '((1 . a) (2 . b) (3 . c)))  ;multiple element list
-    (compat--should nil 2 '(1 2 3))
-    (compat--should 'b 2 '(1 (2 . b) 3))
-    (compat--should nil 2 '((1 . a) 2 (3 . c)))
-    (compat--should 'a 1 '((3 . c) (2 . b) (1 . a)))
-    (compat--should nil "a" '(("a" . 1) ("b" . 2) ("c" . 3))))  ;non-primitive 
elements
-  (compat-test ((and (version<= "26.1" emacs-version) #'alist-get)
-                compat--alist-get-full-elisp)
+;;       (ought 'd 0 '((1 . a) (2 . b) (3 . c)) 'd) ;default value
+;;       (ought 'd 2 '((1 . a) (2 . b) (3 . c)) 'd nil #'ignore))))
+
+(compat-deftest (alist-get compat--alist-get-full-elisp)
+  ;; Fallback behaviour:
+  (ought nil 1 nil)                      ;empty list
+  (ought 'a 1 '((1 . a)))                  ;single element list
+  (ought nil 1 '(1))
+  (ought 'b 2 '((1 . a) (2 . b) (3 . c)))  ;multiple element list
+  (ought nil 2 '(1 2 3))
+  (ought 'b 2 '(1 (2 . b) 3))
+  (ought nil 2 '((1 . a) 2 (3 . c)))
+  (ought 'a 1 '((3 . c) (2 . b) (1 . a)))
+  (ought nil "a" '(("a" . 1) ("b" . 2) ("c" . 3))))  ;non-primitive elements
+(when (version<= "26.1" emacs-version)
+  (compat-deftest (alist-get compat--alist-get-full-elisp)
     ;; With testfn (advised behaviour):
-    (compat--should 1 "a" '(("a" . 1) ("b" . 2) ("c" . 3)) nil nil #'equal)
-    (compat--should 1 3 '((10 . 10) (4 . 4) (1 . 1) (9 . 9)) nil nil #'<)
-    (compat--should '(a) "b" '(("c" c) ("a" a) ("b" b)) nil nil #'string-lessp)
-    (compat--should 'c "a" '(("a" . a) ("a" . b) ("b" . c)) nil nil
+    (ought 1 "a" '(("a" . 1) ("b" . 2) ("c" . 3)) nil nil #'equal)
+    (ought 1 3 '((10 . 10) (4 . 4) (1 . 1) (9 . 9)) nil nil #'<)
+    (ought '(a) "b" '(("c" c) ("a" a) ("b" b)) nil nil #'string-lessp)
+    (ought 'c "a" '(("a" . a) ("a" . b) ("b" . c)) nil nil
                     (lambda (s1 s2) (not (string= s1 s2))))
-    (compat--should 'emacs-lisp-mode
+    (ought 'emacs-lisp-mode
                     "file.el"
                     '(("\\.c\\'" . c-mode)
                       ("\\.p\\'" . pascal-mode)
                       ("\\.el\\'" . emacs-lisp-mode)
                       ("\\.awk\\'" . awk-mode))
                     nil nil #'string-match-p)
-    (compat--should 'd 0 '((1 . a) (2 . b) (3 . c)) 'd) ;default value
-    (compat--should 'd 2 '((1 . a) (2 . b) (3 . c)) 'd nil #'ignore)))
-
-(ert-deftest compat-string-trim-left ()
-  "Check if `compat--string-trim-left' was implemented correctly."
-  (compat-test string-trim-left'
-    (compat--should "" "")                          ;empty string
-    (compat--should "a" "a")                        ;"full" string
-    (compat--should "aaa" "aaa")
-    (compat--should "へっろ" "へっろ")
-    (compat--should "hello world" "hello world")
-    (compat--should "a " "a ")                        ;right trailing
-    (compat--should "aaa " "aaa ")
-    (compat--should "a    " "a    ")
-    (compat--should "a\t\t" "a\t\t")
-    (compat--should "a\n  \t" "a\n  \t")
-    (compat--should "a" " a")                        ;left trailing
-    (compat--should "aaa" " aaa")
-    (compat--should "a" "a")
-    (compat--should "a" "\t\ta")
-    (compat--should "a" "\n  \ta")
-    (compat--should "a " " a ")                        ;both trailing
-    (compat--should "aaa  " " aaa  ")
-    (compat--should "a\t\n" "\t\ta\t\n")
-    (compat--should "a  \n" "\n  \ta  \n")))
-
-(ert-deftest compat-string-trim-right ()
-  "Check if `compat--string-trim-right' was implemented correctly."
-  (compat-test string-trim-right
-    (compat--should "" "")                          ;empty string
-    (compat--should "a" "a")                        ;"full" string
-    (compat--should "aaa" "aaa")
-    (compat--should "へっろ" "へっろ")
-    (compat--should "hello world" "hello world")
-    (compat--should "a" "a")                      ;right trailing
-    (compat--should "aaa" "aaa")
-    (compat--should "a" "a    ")
-    (compat--should "a" "a\t\t")
-    (compat--should "a" "a\n  \t")
-    (compat--should " a" " a")                       ;left trailing
-    (compat--should " aaa" " aaa")
-    (compat--should "a" "a")
-    (compat--should "\t\ta" "\t\ta")
-    (compat--should "\n  \ta" "\n  \ta")
-    (compat--should " a" " a ")                        ;both trailing
-    (compat--should " aaa" " aaa")
-    (compat--should "\t\ta" "\t\ta\t\n")
-    (compat--should "\n  \ta" "\n  \ta  \n")))
-
-(ert-deftest compat-string-trim ()
-  "Check if `compat--string-trim' was implemented correctly."
-  (compat-test string-trim
-    (compat--should "" "")                          ;empty string
-    (compat--should "a" "a")                        ;"full" string
-    (compat--should "aaa" "aaa")
-    (compat--should "へっろ" "へっろ")
-    (compat--should "hello world" "hello world")
-    (compat--should "a" "a ")                       ;right trailing
-    (compat--should "aaa" "aaa ")
-    (compat--should "a" "a    ")
-    (compat--should "a" "a\t\t")
-    (compat--should "a" "a\n  \t")
-    (compat--should "a" " a")                       ;left trailing
-    (compat--should "aaa" " aaa")
-    (compat--should "a" "a")
-    (compat--should "a" "\t\ta")
-    (compat--should "a" "\n  \ta")
-    (compat--should "a" " a ")                      ;both trailing
-    (compat--should "aaa" " aaa  ")
-    (compat--should "t\ta" "t\ta\t\n")
-    (compat--should "a" "\n  \ta  \n")))
-
-(ert-deftest compat-mapcan ()
-  "Check if `compat--mapcan' was implemented correctly."
-  (compat-test mapcan
-    (compat--should nil #'identity nil)
-    (compat--should (list 1)
-                    #'identity
-                    (list (list 1)))
-    (compat--should (list 1 2 3 4)
-                    #'identity
-                    (list (list 1) (list 2 3) (list 4)))
-    (compat--should (list (list 1) (list 2 3) (list 4))
-                    #'list
-                    (list (list 1) (list 2 3) (list 4)))
-    (compat--should (list 1 2 3 4)
-                    #'identity
-                    (list (list 1) (list) (list 2 3) (list 4)))
-    (compat--should (list (list 1) (list) (list 2 3) (list 4))
-                    #'list
-                    (list (list 1) (list) (list 2 3) (list 4)))
-    (compat--should (list)
-                    #'identity
-                    (list (list) (list) (list) (list)))))
+    (ought 'd 0 '((1 . a) (2 . b) (3 . c)) 'd) ;default value
+    (ought 'd 2 '((1 . a) (2 . b) (3 . c)) 'd nil #'ignore)))
+
+(compat-deftest string-trim-left'
+  (ought "" "")                          ;empty string
+  (ought "a" "a")                        ;"full" string
+  (ought "aaa" "aaa")
+  (ought "へっろ" "へっろ")
+  (ought "hello world" "hello world")
+  (ought "a " "a ")                        ;right trailing
+  (ought "aaa " "aaa ")
+  (ought "a    " "a    ")
+  (ought "a\t\t" "a\t\t")
+  (ought "a\n  \t" "a\n  \t")
+  (ought "a" " a")                        ;left trailing
+  (ought "aaa" " aaa")
+  (ought "a" "a")
+  (ought "a" "\t\ta")
+  (ought "a" "\n  \ta")
+  (ought "a " " a ")                        ;both trailing
+  (ought "aaa  " " aaa  ")
+  (ought "a\t\n" "\t\ta\t\n")
+  (ought "a  \n" "\n  \ta  \n"))
+
+(compat-deftest string-trim-right
+  (ought "" "")                          ;empty string
+  (ought "a" "a")                        ;"full" string
+  (ought "aaa" "aaa")
+  (ought "へっろ" "へっろ")
+  (ought "hello world" "hello world")
+  (ought "a" "a")                      ;right trailing
+  (ought "aaa" "aaa")
+  (ought "a" "a    ")
+  (ought "a" "a\t\t")
+  (ought "a" "a\n  \t")
+  (ought " a" " a")                       ;left trailing
+  (ought " aaa" " aaa")
+  (ought "a" "a")
+  (ought "\t\ta" "\t\ta")
+  (ought "\n  \ta" "\n  \ta")
+  (ought " a" " a ")                        ;both trailing
+  (ought " aaa" " aaa")
+  (ought "\t\ta" "\t\ta\t\n")
+  (ought "\n  \ta" "\n  \ta  \n"))
+
+(compat-deftest string-trim
+  (ought "" "")                          ;empty string
+  (ought "a" "a")                        ;"full" string
+  (ought "aaa" "aaa")
+  (ought "へっろ" "へっろ")
+  (ought "hello world" "hello world")
+  (ought "a" "a ")                       ;right trailing
+  (ought "aaa" "aaa ")
+  (ought "a" "a    ")
+  (ought "a" "a\t\t")
+  (ought "a" "a\n  \t")
+  (ought "a" " a")                       ;left trailing
+  (ought "aaa" " aaa")
+  (ought "a" "a")
+  (ought "a" "\t\ta")
+  (ought "a" "\n  \ta")
+  (ought "a" " a ")                      ;both trailing
+  (ought "aaa" " aaa  ")
+  (ought "t\ta" "t\ta\t\n")
+  (ought "a" "\n  \ta  \n"))
+
+(compat-deftest mapcan
+  (ought nil #'identity nil)
+  (ought (list 1)
+         #'identity
+         (list (list 1)))
+  (ought (list 1 2 3 4)
+         #'identity
+         (list (list 1) (list 2 3) (list 4)))
+  (ought (list (list 1) (list 2 3) (list 4))
+         #'list
+         (list (list 1) (list 2 3) (list 4)))
+  (ought (list 1 2 3 4)
+         #'identity
+         (list (list 1) (list) (list 2 3) (list 4)))
+  (ought (list (list 1) (list) (list 2 3) (list 4))
+         #'list
+         (list (list 1) (list) (list 2 3) (list 4)))
+  (ought (list)
+         #'identity
+         (list (list) (list) (list) (list))))
 
 ;; Note: as the cXXX+r implementations are relatively trivial, their
 ;; tests are not as extensive.
@@ -749,443 +816,357 @@ the compatibility function."
     (((i . j) . (k . l)) . ((m . j) . (o . p))))
   "Testcase for cXXXXr functions.")
 
-(ert-deftest compat-caaar ()
-  "Check if `compat--caaar' was implemented correctly."
-  (compat-test caaar
-    (compat--should nil ())
-    (compat--should 'a compat-cXXXr-test)))
-
-(ert-deftest compat-caadr ()
-  "Check if `compat--caadr' was implemented correctly."
-  (compat-test caadr
-    (compat--should nil ())
-    (compat--should 'e compat-cXXXr-test)))
-
-(ert-deftest compat-cadar ()
-  "Check if `compat--cadar' was implemented correctly."
-  (compat-test cadar
-    (compat--should nil ())
-    (compat--should 'c compat-cXXXr-test)))
-
-(ert-deftest compat-caddr ()
-  "Check if `compat--caddr' was implemented correctly."
-  (compat-test caddr
-    (compat--should nil ())
-    (compat--should 'g compat-cXXXr-test)))
-
-(ert-deftest compat-cdaar ()
-  "Check if `compat--cdaar' was implemented correctly."
-  (compat-test cdaar
-    (compat--should nil ())
-    (compat--should 'b compat-cXXXr-test)))
-
-(ert-deftest compat-cdadr ()
-  "Check if `compat--cdadr' was implemented correctly."
-  (compat-test cdadr
-    (compat--should nil ())
-    (compat--should 'f compat-cXXXr-test)))
-
-(ert-deftest compat-cddar ()
-  "Check if `compat--cddar' was implemented correctly."
-  (compat-test cddar
-    (compat--should nil ())
-    (compat--should 'd compat-cXXXr-test)))
-
-(ert-deftest compat-cdddr ()
-  "Check if `compat--cdddr' was implemented correctly."
-  (compat-test cdddr
-    (compat--should nil ())
-    (compat--should 'h compat-cXXXr-test)
-    #'cdddr))
-
-(ert-deftest compat-caaaar ()
-  "Check if `compat--caaaar' was implemented correctly."
-  (compat-test caaaar
-    (compat--should nil ())
-    (compat--should 'a compat-cXXXXr-test)))
-
-(ert-deftest compat-caaadr ()
-  "Check if `compat--caaadr' was implemented correctly."
-  (compat-test caaadr
-    (compat--should nil ())
-    (compat--should 'i compat-cXXXXr-test)))
-
-(ert-deftest compat-caadar ()
-  "Check if `compat--caadar' was implemented correctly."
-  (compat-test caadar
-    (compat--should nil ())
-    (compat--should 'e compat-cXXXXr-test)))
-
-(ert-deftest compat-caaddr ()
-  "Check if `compat--caaddr' was implemented correctly."
-  (compat-test caaddr
-    (compat--should nil ())
-    (compat--should 'm compat-cXXXXr-test)))
-
-(ert-deftest compat-cadaar ()
-  "Check if `compat--cadaar' was implemented correctly."
-  (compat-test cadaar
-    (compat--should nil ())
-    (compat--should 'c compat-cXXXXr-test)))
-
-(ert-deftest compat-cadadr ()
-  "Check if `compat--cadadr' was implemented correctly."
-  (compat-test cadadr
-    (compat--should nil ())
-    (compat--should 'k compat-cXXXXr-test)))
-
-(ert-deftest compat-caddar ()
-  "Check if `compat--caddar' was implemented correctly."
-  (compat-test caddar
-    (compat--should nil ())
-    (compat--should 'g compat-cXXXXr-test)))
-
-(ert-deftest compat-cadddr ()
-  "Check if `compat--cadddr' was implemented correctly."
-  (compat-test cadddr
-    (compat--should nil ())
-    (compat--should 'o compat-cXXXXr-test)))
-
-(ert-deftest compat-cdaaar ()
-  "Check if `compat--cdaaar' was implemented correctly."
-  (compat-test cdaaar
-    (compat--should nil ())
-    (compat--should 'b compat-cXXXXr-test)))
-
-(ert-deftest compat-cdaadr ()
-  "Check if `compat--cdaadr' was implemented correctly."
-  (compat-test cdaadr
-    (compat--should nil ())
-    (compat--should 'j compat-cXXXXr-test)))
-
-(ert-deftest compat-cdadar ()
-  "Check if `compat--cdadar' was implemented correctly."
-  (compat-test cdadar
-    (compat--should nil ())
-    (compat--should 'f compat-cXXXXr-test)))
-
-(ert-deftest compat-cdaddr ()
-  "Check if `compat--cdaddr' was implemented correctly."
-  (compat-test cdaddr
-    (compat--should nil ())
-    (compat--should 'j compat-cXXXXr-test)))
-
-(ert-deftest compat-cddaar ()
-  "Check if `compat--cddaar' was implemented correctly."
-  (compat-test cddaar
-    (compat--should nil ())
-    (compat--should 'd compat-cXXXXr-test)))
-
-(ert-deftest compat-cddadr ()
-  "Check if `compat--cddadr' was implemented correctly."
-  (compat-test cddadr
-    (compat--should nil ())
-    (compat--should 'l compat-cXXXXr-test)))
-
-(ert-deftest compat-cdddar ()
-  "Check if `compat--cdddar' was implemented correctly."
-  (compat-test cdddar
-    (compat--should nil ())
-    (compat--should 'h compat-cXXXXr-test)))
-
-(ert-deftest compat-string-greaterp ()
-  "Check if `compat--string-greaterp' was implemented correctly."
-  (compat-test string-greaterp
-    (compat--should t "b" "a")
-    (compat--should nil "a" "b")
-    (compat--should t "aaab" "aaaa")
-    (compat--should nil "aaaa" "aaab")))
-
-(ert-deftest compat-sort ()
-  "Check if `compat--sort' was advised correctly."
-  (compat-test compat-sort
-    (compat--should (list 1 2 3) (list 1 2 3) #'<)
-    (compat--should (list 1 2 3) (list 3 2 1) #'<)
-    (compat--should '[1 2 3] '[1 2 3] #'<)
-    (compat--should '[1 2 3] '[3 2 1] #'<)))
-
-(ert-deftest compat-= ()
-  "Check if `compat--=' was advised correctly."
-  (compat-test compat-=
-    (compat--should t 0 0)
-    (compat--should t 0 0 0)
-    (compat--should t 0 0 0 0)
-    (compat--should t 0 0 0 0 0)
-    (compat--should t 0.0 0.0)
-    (compat--should t +0.0 -0.0)
-    (compat--should t 0.0 0.0 0.0)
-    (compat--should t 0.0 0.0 0.0 0.0)
-    (compat--should nil 0 1)
-    (compat--should nil 0 0 1)
-    (compat--should nil 0 0 0 0 1)
-    (compat--error wrong-type-argument 0 0 'a)
-    (compat--should nil 0 1 'a)
-    (compat--should nil 0.0 0.0 0.0 0.1)))
-
-(ert-deftest compat-< ()
-  "Check if `compat--<' was advised correctly."
-  (compat-test compat-<
-    (compat--should nil 0 0)
-    (compat--should nil 0 0 0)
-    (compat--should nil 0 0 0 0)
-    (compat--should nil 0 0 0 0 0)
-    (compat--should nil 0.0 0.0)
-    (compat--should nil +0.0 -0.0)
-    (compat--should nil 0.0 0.0 0.0)
-    (compat--should nil 0.0 0.0 0.0 0.0)
-    (compat--should t 0 1)
-    (compat--should nil 1 0)
-    (compat--should nil 0 0 1)
-    (compat--should t 0 1 2)
-    (compat--should nil 2 1 0)
-    (compat--should nil 0 0 0 0 1)
-    (compat--should t 0 1 2 3 4)
-    (compat--error wrong-type-argument 0 1 'a)
-    (compat--should nil 0 0 'a)
-    (compat--should nil 0.0 0.0 0.0 0.1)
-    (compat--should t -0.1 0.0 0.2 0.4)
-    (compat--should t -0.1 0 0.2 0.4)))
-
-(ert-deftest compat-> ()
-  "Check if `compat-->' was advised correctly."
-  (compat-test compat->
-    (compat--should nil 0 0)
-    (compat--should nil 0 0 0)
-    (compat--should nil 0 0 0 0)
-    (compat--should nil 0 0 0 0 0)
-    (compat--should nil 0.0 0.0)
-    (compat--should nil +0.0 -0.0)
-    (compat--should nil 0.0 0.0 0.0)
-    (compat--should nil 0.0 0.0 0.0 0.0)
-    (compat--should t 1 0)
-    (compat--should nil 1 0 0)
-    (compat--should nil 0 1 2)
-    (compat--should t 2 1 0)
-    (compat--should nil 1 0 0 0 0)
-    (compat--should t 4 3 2 1 0)
-    (compat--should nil 4 3 2 1 1)
-    (compat--error wrong-type-argument 1 0 'a)
-    (compat--should nil 0 0 'a)
-    (compat--should nil 0.1 0.0 0.0 0.0)
-    (compat--should t 0.4 0.2 0.0 -0.1)
-    (compat--should t 0.4 0.2 0 -0.1)))
-
-(ert-deftest compat-<= ()
-  "Check if `compat--<=' was advised correctly."
-  (compat-test compat-<=
-    (compat--should t 0 0)
-    (compat--should t 0 0 0)
-    (compat--should t 0 0 0 0)
-    (compat--should t 0 0 0 0 0)
-    (compat--should t 0.0 0.0)
-    (compat--should t +0.0 -0.0)
-    (compat--should t 0.0 0.0 0.0)
-    (compat--should t 0.0 0.0 0.0 0.0)
-    (compat--should nil 1 0)
-    (compat--should nil 1 0 0)
-    (compat--should t 0 1 2)
-    (compat--should nil 2 1 0)
-    (compat--should nil 1 0 0 0 0)
-    (compat--should nil 4 3 2 1 0)
-    (compat--should nil 4 3 2 1 1)
-    (compat--should t 0 1 2 3 4)
-    (compat--should t 1 1 2 3 4)
-    (compat--error wrong-type-argument 0 0 'a)
-    (compat--error wrong-type-argument 0 1 'a)
-    (compat--should nil 1 0 'a)
-    (compat--should nil 0.1 0.0 0.0 0.0)
-    (compat--should t 0.0 0.0 0.0 0.1)
-    (compat--should t -0.1 0.0 0.2 0.4)
-    (compat--should t -0.1 0.0 0.0 0.2 0.4)
-    (compat--should t -0.1 0.0 0 0.2 0.4)
-    (compat--should t -0.1 0 0.2 0.4)
-    (compat--should nil 0.4 0.2 0.0 -0.1)
-    (compat--should nil 0.4 0.2 0.0 0.0 -0.1)
-    (compat--should nil 0.4 0.2 0 0.0 0.0 -0.1)
-    (compat--should nil 0.4 0.2 0 -0.1)))
-
-(ert-deftest compat->= ()
-  "Check if `compat-->=' was implemented correctly."
-  (compat-test compat->=
-    (compat--should t 0 0)
-    (compat--should t 0 0 0)
-    (compat--should t 0 0 0 0)
-    (compat--should t 0 0 0 0 0)
-    (compat--should t 0.0 0.0)
-    (compat--should t +0.0 -0.0)
-    (compat--should t 0.0 0.0 0.0)
-    (compat--should t 0.0 0.0 0.0 0.0)
-    (compat--should t 1 0)
-    (compat--should t 1 0 0)
-    (compat--should nil 0 1 2)
-    (compat--should t 2 1 0)
-    (compat--should t 1 0 0 0 0)
-    (compat--should t 4 3 2 1 0)
-    (compat--should t 4 3 2 1 1)
-    (compat--error wrong-type-argument 0 0 'a)
-    (compat--error wrong-type-argument 1 0 'a)
-    (compat--should nil 0 1 'a)
-    (compat--should t 0.1 0.0 0.0 0.0)
-    (compat--should nil 0.0 0.0 0.0 0.1)
-    (compat--should nil -0.1 0.0 0.2 0.4)
-    (compat--should nil -0.1 0.0 0.0 0.2 0.4)
-    (compat--should nil -0.1 0.0 0 0.2 0.4)
-    (compat--should nil -0.1 0 0.2 0.4)
-    (compat--should t 0.4 0.2 0.0 -0.1)
-    (compat--should t 0.4 0.2 0.0 0.0 -0.1)
-    (compat--should t 0.4 0.2 0 0.0 0.0 -0.1)
-    (compat--should t 0.4 0.2 0 -0.1)))
-
-(ert-deftest compat-special-form-p ()
-  "Check if `compat--special-form-p' was implemented correctly."
-  (compat-test special-form-p
-    (compat--should t 'if)
-    (compat--should t 'cond)
-    (compat--should nil 'when)
-    (compat--should nil 'defun)
-    (compat--should nil '+)
-    (compat--should nil nil)
-    (compat--should nil "macro")
-    (compat--should nil '(macro . +))))
-
-(ert-deftest compat-macrop ()
-  "Check if `compat--macrop' was implemented correctly."
-  (compat-test macrop
-    (compat--should t 'lambda)
-    (compat--should t 'defun)
-    (compat--should t 'defmacro)
-    (compat--should nil 'defalias)
-    (compat--should nil 'foobar)
-    (compat--should nil 'if)
-    (compat--should nil '+)
-    (compat--should nil 1)
-    (compat--should nil nil)
-    (compat--should nil "macro")
-    (compat--should t '(macro . +))))
-
-(ert-deftest compat-string-suffix-p ()
-  "Check if `compat--string-suffix-p' was implemented correctly."
-  (compat-test string-suffix-p
-    (compat--should t "a" "abba")
-    (compat--should t "ba" "abba")
-    (compat--should t "abba" "abba")
-    (compat--should nil "a" "ABBA")
-    (compat--should nil "bA" "ABBA")
-    (compat--should nil "aBBA" "ABBA")
-    (compat--should nil "c" "ABBA")
-    (compat--should nil "c" "abba")
-    (compat--should nil "cddc" "abba")
-    (compat--should nil "aabba" "abba")))
-
-(ert-deftest compat-split-string ()
-  "Check if `compat--split-string' was advised correctly."
-  (compat-test compat-split-string
-    (compat--should '("a" "b" "c") "a b c")
-    (compat--should '("..a.." "..b.." "..c..") "..a.. ..b.. ..c..")
-    (compat--should '("a" "b" "c") "..a.. ..b.. ..c.." nil nil "\\.+")))
-
-(ert-deftest compat-delete-consecutive-dups ()
-  "Check if `compat--delete-consecutive-dups' was implemented correctly."
-  (compat-test delete-consecutive-dups
-    (compat--should '(1 2 3 4) '(1 2 3 4))
-    (compat--should '(1 2 3 4) '(1 2 2 3 4 4))
-    (compat--should '(1 2 3 2 4) '(1 2 2 3 2 4 4))))
-
-(ert-deftest compat-string-clean-whitespace ()
-  "Check if `compat--string-clean-whitespace' was implemented correctly."
-  (compat-test string-clean-whitespace
-    (compat--should "a b c" "a b c")
-    (compat--should "a b c" "   a b c")
-    (compat--should "a b c" "a b c   ")
-    (compat--should "a b c" "a    b c")
-    (compat--should "a b c" "a b    c")
-    (compat--should "a b c" "a    b    c")
-    (compat--should "a b c" "   a    b    c")
-    (compat--should "a b c" "a    b    c    ")
-    (compat--should "a b c" "   a    b    c    ")
-    (compat--should "aa bb cc" "aa bb cc")
-    (compat--should "aa bb cc" "   aa bb cc")
-    (compat--should "aa bb cc" "aa bb cc   ")
-    (compat--should "aa bb cc" "aa    bb cc")
-    (compat--should "aa bb cc" "aa bb    cc")
-    (compat--should "aa bb cc" "aa    bb    cc")
-    (compat--should "aa bb cc" "   aa    bb    cc")
-    (compat--should "aa bb cc" "aa    bb    cc    ")
-    (compat--should "aa bb cc" "   aa    bb    cc    ")))
-
-(ert-deftest compat-string-fill ()
-  "Check if `compat--string-fill' was implemented correctly."
-  (compat-test string-fill
-    (compat--should "a a a a a" "a a a a a" 9)
-    (compat--should "a a a a a" "a a a a a" 10)
-    (compat--should "a a a a\na" "a a a a a" 8)
-    (compat--should "a a a a\na" "a  a  a  a  a" 8)
-    (compat--should "a a\na a\na" "a a a a a" 4)
-    (compat--should "a\na\na\na\na" "a a a a a" 2)
-    (compat--should "a\na\na\na\na" "a a a a a" 1)))
-
-(ert-deftest compat-string-lines ()
-  "Check if `compat--string-lines' was implemented correctly."
-  (compat-test string-lines
-    (compat--should '("a" "b" "c") "a\nb\nc")
-    (compat--should '("a" "b" "c" "") "a\nb\nc\n")
-    (compat--should '("a" "b" "c") "a\nb\nc\n" t)
-    (compat--should '("abc" "bcd" "cde") "abc\nbcd\ncde")
-    (compat--should '(" abc" " bcd " "cde ") " abc\n bcd \ncde ")))
-
-(ert-deftest compat-string-pad ()
-  "Check if `compat--string-pad' was implemented correctly."
-  (compat-test string-pad
-    (compat--should "a   " "a" 4)
-    (compat--should "aaaa" "aaaa" 4)
-    (compat--should "aaaaaa" "aaaaaa" 4)
-    (compat--should "a..." "a" 4 ?.)
-    (compat--should "   a" "a" 4 nil t)
-    (compat--should "...a" "a" 4 ?. t)))
-
-(ert-deftest compat-string-chop-newline ()
-  "Check if `compat--string-chop-newline' was implemented correctly."
-  (compat-test string-chop-newline
-    (compat--should "" "")
-    (compat--should "" "\n")
-    (compat--should "aaa" "aaa")
-    (compat--should "aaa" "aaa\n")
-    (compat--should "aaa\n" "aaa\n\n")))
-
-(ert-deftest compat-macroexpand-1 ()
-  "Check if `compat--macroexpand-1' was implemented correctly."
-  (compat-test macroexpand-1
-    (compat--should '(if a b c) '(if a b c))
-    (compat--should '(if a (progn b)) '(when a b))
-    (compat--should '(if a (progn (unless b c))) '(when a (unless b c)))))
-
-(ert-deftest compat-file-size-human-readable ()
-  "Check if `compat--file-size-human-readable' was advised properly."
-  (compat-test compat-file-size-human-readable
-    (compat--should "1000" 1000)
-    (compat--should "1k" 1024)
-    (compat--should "1M" (* 1024 1024))
-    (compat--should "1G" (expt 1024 3))
-    (compat--should "1T" (expt 1024 4))
-    (compat--should "1k" 1000 'si)
-    (compat--should "1KiB" 1024 'iec)
-    (compat--should "1KiB" 1024 'iec)
-    (compat--should "1 KiB" 1024 'iec " ")
-    (compat--should "1KiA" 1024 'iec nil "A")
-    (compat--should "1 KiA" 1024 'iec " " "A")
-    (compat--should "1kA" 1000 'si nil "A")
-    (compat--should "1 k" 1000 'si " ")
-    (compat--should "1 kA" 1000 'si " " "A")))
-
-(ert-deftest compat-format-prompt ()
-  "Check if `compat--file-size-human-readable' was implemented properly."
-  (compat-test format-prompt
-    (compat--should "Prompt: " "Prompt" nil)
-    (compat--should "Prompt (default 3): " "Prompt" 3)
-    (compat--should "Prompt (default abc): " "Prompt" "abc")
-    (compat--should "Prompt (default abc def): " "Prompt" "abc def")
-    (compat--should "Prompt 10: " "Prompt %d" nil 10)
-    (compat--should "Prompt \"abc\" (default 3): " "Prompt %S" 3 "abc")))
+(compat-deftest caaar
+  (ought nil ())
+  (ought 'a compat-cXXXr-test))
+
+(compat-deftest caadr
+  (ought nil ())
+  (ought 'e compat-cXXXr-test))
+
+(compat-deftest cadar
+  (ought nil ())
+  (ought 'c compat-cXXXr-test))
+
+(compat-deftest caddr
+  (ought nil ())
+  (ought 'g compat-cXXXr-test))
+
+(compat-deftest cdaar
+  (ought nil ())
+  (ought 'b compat-cXXXr-test))
+
+(compat-deftest cdadr
+  (ought nil ())
+  (ought 'f compat-cXXXr-test))
+
+(compat-deftest cddar
+  (ought nil ())
+  (ought 'd compat-cXXXr-test))
+
+(compat-deftest cdddr
+  (ought nil ())
+  (ought 'h compat-cXXXr-test)
+  #'cdddr)
+
+(compat-deftest caaaar
+  (ought nil ())
+  (ought 'a compat-cXXXXr-test))
+
+(compat-deftest caaadr
+  (ought nil ())
+  (ought 'i compat-cXXXXr-test))
+
+(compat-deftest caadar
+  (ought nil ())
+  (ought 'e compat-cXXXXr-test))
+
+(compat-deftest caaddr
+  (ought nil ())
+  (ought 'm compat-cXXXXr-test))
+
+(compat-deftest cadaar
+  (ought nil ())
+  (ought 'c compat-cXXXXr-test))
+
+(compat-deftest cadadr
+  (ought nil ())
+  (ought 'k compat-cXXXXr-test))
+
+(compat-deftest caddar
+  (ought nil ())
+  (ought 'g compat-cXXXXr-test))
+
+(compat-deftest cadddr
+  (ought nil ())
+  (ought 'o compat-cXXXXr-test))
+
+(compat-deftest cdaaar
+  (ought nil ())
+  (ought 'b compat-cXXXXr-test))
+
+(compat-deftest cdaadr
+  (ought nil ())
+  (ought 'j compat-cXXXXr-test))
+
+(compat-deftest cdadar
+  (ought nil ())
+  (ought 'f compat-cXXXXr-test))
+
+(compat-deftest cdaddr
+  (ought nil ())
+  (ought 'j compat-cXXXXr-test))
+
+(compat-deftest cddaar
+  (ought nil ())
+  (ought 'd compat-cXXXXr-test))
+
+(compat-deftest cddadr
+  (ought nil ())
+  (ought 'l compat-cXXXXr-test))
+
+(compat-deftest cdddar
+  (ought nil ())
+  (ought 'h compat-cXXXXr-test))
+
+(compat-deftest string-greaterp
+  (ought t "b" "a")
+  (ought nil "a" "b")
+  (ought t "aaab" "aaaa")
+  (ought nil "aaaa" "aaab"))
+
+(compat-deftest compat-sort
+  (ought (list 1 2 3) (list 1 2 3) #'<)
+  (ought (list 1 2 3) (list 3 2 1) #'<)
+  (ought '[1 2 3] '[1 2 3] #'<)
+  (ought '[1 2 3] '[3 2 1] #'<))
+
+(compat-deftest compat-=
+  (ought t 0 0)
+  (ought t 0 0 0)
+  (ought t 0 0 0 0)
+  (ought t 0 0 0 0 0)
+  (ought t 0.0 0.0)
+  (ought t +0.0 -0.0)
+  (ought t 0.0 0.0 0.0)
+  (ought t 0.0 0.0 0.0 0.0)
+  (ought nil 0 1)
+  (ought nil 0 0 1)
+  (ought nil 0 0 0 0 1)
+  (expect wrong-type-argument 0 0 'a)
+  (ought nil 0 1 'a)
+  (ought nil 0.0 0.0 0.0 0.1))
+
+(compat-deftest compat-<
+  (ought nil 0 0)
+  (ought nil 0 0 0)
+  (ought nil 0 0 0 0)
+  (ought nil 0 0 0 0 0)
+  (ought nil 0.0 0.0)
+  (ought nil +0.0 -0.0)
+  (ought nil 0.0 0.0 0.0)
+  (ought nil 0.0 0.0 0.0 0.0)
+  (ought t 0 1)
+  (ought nil 1 0)
+  (ought nil 0 0 1)
+  (ought t 0 1 2)
+  (ought nil 2 1 0)
+  (ought nil 0 0 0 0 1)
+  (ought t 0 1 2 3 4)
+  (expect wrong-type-argument 0 1 'a)
+  (ought nil 0 0 'a)
+  (ought nil 0.0 0.0 0.0 0.1)
+  (ought t -0.1 0.0 0.2 0.4)
+  (ought t -0.1 0 0.2 0.4))
+
+(compat-deftest compat->
+  (ought nil 0 0)
+  (ought nil 0 0 0)
+  (ought nil 0 0 0 0)
+  (ought nil 0 0 0 0 0)
+  (ought nil 0.0 0.0)
+  (ought nil +0.0 -0.0)
+  (ought nil 0.0 0.0 0.0)
+  (ought nil 0.0 0.0 0.0 0.0)
+  (ought t 1 0)
+  (ought nil 1 0 0)
+  (ought nil 0 1 2)
+  (ought t 2 1 0)
+  (ought nil 1 0 0 0 0)
+  (ought t 4 3 2 1 0)
+  (ought nil 4 3 2 1 1)
+  (expect wrong-type-argument 1 0 'a)
+  (ought nil 0 0 'a)
+  (ought nil 0.1 0.0 0.0 0.0)
+  (ought t 0.4 0.2 0.0 -0.1)
+  (ought t 0.4 0.2 0 -0.1))
+
+(compat-deftest compat-<=
+  (ought t 0 0)
+  (ought t 0 0 0)
+  (ought t 0 0 0 0)
+  (ought t 0 0 0 0 0)
+  (ought t 0.0 0.0)
+  (ought t +0.0 -0.0)
+  (ought t 0.0 0.0 0.0)
+  (ought t 0.0 0.0 0.0 0.0)
+  (ought nil 1 0)
+  (ought nil 1 0 0)
+  (ought t 0 1 2)
+  (ought nil 2 1 0)
+  (ought nil 1 0 0 0 0)
+  (ought nil 4 3 2 1 0)
+  (ought nil 4 3 2 1 1)
+  (ought t 0 1 2 3 4)
+  (ought t 1 1 2 3 4)
+  (expect wrong-type-argument 0 0 'a)
+  (expect wrong-type-argument 0 1 'a)
+  (ought nil 1 0 'a)
+  (ought nil 0.1 0.0 0.0 0.0)
+  (ought t 0.0 0.0 0.0 0.1)
+  (ought t -0.1 0.0 0.2 0.4)
+  (ought t -0.1 0.0 0.0 0.2 0.4)
+  (ought t -0.1 0.0 0 0.2 0.4)
+  (ought t -0.1 0 0.2 0.4)
+  (ought nil 0.4 0.2 0.0 -0.1)
+  (ought nil 0.4 0.2 0.0 0.0 -0.1)
+  (ought nil 0.4 0.2 0 0.0 0.0 -0.1)
+  (ought nil 0.4 0.2 0 -0.1))
+
+(compat-deftest compat->=
+  (ought t 0 0)
+  (ought t 0 0 0)
+  (ought t 0 0 0 0)
+  (ought t 0 0 0 0 0)
+  (ought t 0.0 0.0)
+  (ought t +0.0 -0.0)
+  (ought t 0.0 0.0 0.0)
+  (ought t 0.0 0.0 0.0 0.0)
+  (ought t 1 0)
+  (ought t 1 0 0)
+  (ought nil 0 1 2)
+  (ought t 2 1 0)
+  (ought t 1 0 0 0 0)
+  (ought t 4 3 2 1 0)
+  (ought t 4 3 2 1 1)
+  (expect wrong-type-argument 0 0 'a)
+  (expect wrong-type-argument 1 0 'a)
+  (ought nil 0 1 'a)
+  (ought t 0.1 0.0 0.0 0.0)
+  (ought nil 0.0 0.0 0.0 0.1)
+  (ought nil -0.1 0.0 0.2 0.4)
+  (ought nil -0.1 0.0 0.0 0.2 0.4)
+  (ought nil -0.1 0.0 0 0.2 0.4)
+  (ought nil -0.1 0 0.2 0.4)
+  (ought t 0.4 0.2 0.0 -0.1)
+  (ought t 0.4 0.2 0.0 0.0 -0.1)
+  (ought t 0.4 0.2 0 0.0 0.0 -0.1)
+  (ought t 0.4 0.2 0 -0.1))
+
+(compat-deftest special-form-p
+  (ought t 'if)
+  (ought t 'cond)
+  (ought nil 'when)
+  (ought nil 'defun)
+  (ought nil '+)
+  (ought nil nil)
+  (ought nil "macro")
+  (ought nil '(macro . +)))
+
+(compat-deftest macrop
+  (ought t 'lambda)
+  (ought t 'defun)
+  (ought t 'defmacro)
+  (ought nil 'defalias)
+  (ought nil 'foobar)
+  (ought nil 'if)
+  (ought nil '+)
+  (ought nil 1)
+  (ought nil nil)
+  (ought nil "macro")
+  (ought t '(macro . +)))
+
+(compat-deftest string-suffix-p
+  (ought t "a" "abba")
+  (ought t "ba" "abba")
+  (ought t "abba" "abba")
+  (ought nil "a" "ABBA")
+  (ought nil "bA" "ABBA")
+  (ought nil "aBBA" "ABBA")
+  (ought nil "c" "ABBA")
+  (ought nil "c" "abba")
+  (ought nil "cddc" "abba")
+  (ought nil "aabba" "abba"))
+
+(compat-deftest compat-split-string
+  (ought '("a" "b" "c") "a b c")
+  (ought '("..a.." "..b.." "..c..") "..a.. ..b.. ..c..")
+  (ought '("a" "b" "c") "..a.. ..b.. ..c.." nil nil "\\.+"))
+
+(compat-deftest delete-consecutive-dups
+  (ought '(1 2 3 4) '(1 2 3 4))
+  (ought '(1 2 3 4) '(1 2 2 3 4 4))
+  (ought '(1 2 3 2 4) '(1 2 2 3 2 4 4)))
+
+(compat-deftest string-clean-whitespace
+  (ought "a b c" "a b c")
+  (ought "a b c" "   a b c")
+  (ought "a b c" "a b c   ")
+  (ought "a b c" "a    b c")
+  (ought "a b c" "a b    c")
+  (ought "a b c" "a    b    c")
+  (ought "a b c" "   a    b    c")
+  (ought "a b c" "a    b    c    ")
+  (ought "a b c" "   a    b    c    ")
+  (ought "aa bb cc" "aa bb cc")
+  (ought "aa bb cc" "   aa bb cc")
+  (ought "aa bb cc" "aa bb cc   ")
+  (ought "aa bb cc" "aa    bb cc")
+  (ought "aa bb cc" "aa bb    cc")
+  (ought "aa bb cc" "aa    bb    cc")
+  (ought "aa bb cc" "   aa    bb    cc")
+  (ought "aa bb cc" "aa    bb    cc    ")
+  (ought "aa bb cc" "   aa    bb    cc    "))
+
+(compat-deftest string-fill
+  (ought "a a a a a" "a a a a a" 9)
+  (ought "a a a a a" "a a a a a" 10)
+  (ought "a a a a\na" "a a a a a" 8)
+  (ought "a a a a\na" "a  a  a  a  a" 8)
+  (ought "a a\na a\na" "a a a a a" 4)
+  (ought "a\na\na\na\na" "a a a a a" 2)
+  (ought "a\na\na\na\na" "a a a a a" 1))
+
+(compat-deftest string-lines
+  (ought '("a" "b" "c") "a\nb\nc")
+  (ought '("a" "b" "c" "") "a\nb\nc\n")
+  (ought '("a" "b" "c") "a\nb\nc\n" t)
+  (ought '("abc" "bcd" "cde") "abc\nbcd\ncde")
+  (ought '(" abc" " bcd " "cde ") " abc\n bcd \ncde "))
+
+(compat-deftest string-pad
+  (ought "a   " "a" 4)
+  (ought "aaaa" "aaaa" 4)
+  (ought "aaaaaa" "aaaaaa" 4)
+  (ought "a..." "a" 4 ?.)
+  (ought "   a" "a" 4 nil t)
+  (ought "...a" "a" 4 ?. t))
+
+(compat-deftest string-chop-newline
+  (ought "" "")
+  (ought "" "\n")
+  (ought "aaa" "aaa")
+  (ought "aaa" "aaa\n")
+  (ought "aaa\n" "aaa\n\n"))
+
+(compat-deftest macroexpand-1
+  (ought '(if a b c) '(if a b c))
+  (ought '(if a (progn b)) '(when a b))
+  (ought '(if a (progn (unless b c))) '(when a (unless b c))))
+
+(compat-deftest compat-file-size-human-readable
+    (ought "1000" 1000)
+    (ought "1k" 1024)
+    (ought "1M" (* 1024 1024))
+    (ought "1G" (expt 1024 3))
+    (ought "1T" (expt 1024 4))
+    (ought "1k" 1000 'si)
+    (ought "1KiB" 1024 'iec)
+    (ought "1KiB" 1024 'iec)
+    (ought "1 KiB" 1024 'iec " ")
+    (ought "1KiA" 1024 'iec nil "A")
+    (ought "1 KiA" 1024 'iec " " "A")
+    (ought "1kA" 1000 'si nil "A")
+    (ought "1 k" 1000 'si " ")
+    (ought "1 kA" 1000 'si " " "A"))
+
+(compat-deftest format-prompt
+  (ought "Prompt: " "Prompt" nil)
+  (ought "Prompt (default 3): " "Prompt" 3)
+  (ought "Prompt (default abc): " "Prompt" "abc")
+  (ought "Prompt (default abc def): " "Prompt" "abc def")
+  (ought "Prompt 10: " "Prompt %d" nil 10)
+  (ought "Prompt \"abc\" (default 3): " "Prompt %S" 3 "abc"))
 
 (ert-deftest compat-named-let ()
   "Check if `compat--named-let' was implemented properly."
@@ -1246,21 +1227,19 @@ the compatibility function."
                t)
               'ok)))
 
-(ert-deftest compat-directory-name-p ()
-  "Check if `compat--directory-name-p' was implemented properly."
-  (compat-test directory-name-p
-    (compat--should t "/")
-    (compat--should nil "/file")
-    (compat--should nil "/dir/file")
-    (compat--should t "/dir/")
-    (compat--should nil "/dir")
-    (compat--should t "/dir/subdir/")
-    (compat--should nil "/dir/subdir")
-    (compat--should t "dir/")
-    (compat--should nil "file")
-    (compat--should nil "dir/file")
-    (compat--should t "dir/subdir/")
-    (compat--should nil "dir/subdir")))
+(compat-deftest directory-name-p
+  (ought t "/")
+  (ought nil "/file")
+  (ought nil "/dir/file")
+  (ought t "/dir/")
+  (ought nil "/dir")
+  (ought t "/dir/subdir/")
+  (ought nil "/dir/subdir")
+  (ought t "dir/")
+  (ought nil "file")
+  (ought nil "dir/file")
+  (ought t "dir/subdir/")
+  (ought nil "dir/subdir"))
 
 (ert-deftest compat-if-let* ()
   "Check if `compat--if-let*' was implemented properly."
@@ -1308,21 +1287,19 @@ the compatibility function."
   (should-not
    (compat--and-let* (((= 5 6))) t)))
 
+(compat-deftest compat-json-parse-string
+  (ought 0 "0")
+  (ought 1 "1")
+  (ought 0.5 "0.5")
+  (ought [1 2 3] "[1,2,3]")
+  (ought ["a" 2 3] "[\"a\",2,3]")
+  (ought [["a" 2] 3] "[[\"a\",2],3]")
+  (ought '(("a" 2) 3) "[[\"a\",2],3]" :array-type 'list)
+  (ought 'foo "null" :null-object 'foo)
+  (ought ["false" t] "[false, true]" :false-object "false"))
+
 (ert-deftest compat-json-parse-string ()
   "Check if `compat--json-parse-string' was implemented properly."
-  (compat-test (json-parse-string (if (version<= "28" emacs-version)
-                                      (apply-partially 
#'compat--json-parse-string-handle-tlo
-                                                       #'json-parse-string)
-                                    #'compat--json-parse-string))
-    (compat--should 0 "0")
-    (compat--should 1 "1")
-    (compat--should 0.5 "0.5")
-    (compat--should [1 2 3] "[1,2,3]")
-    (compat--should ["a" 2 3] "[\"a\",2,3]")
-    (compat--should [["a" 2] 3] "[[\"a\",2],3]")
-    (compat--should '(("a" 2) 3) "[[\"a\",2],3]" :array-type 'list)
-    (compat--should 'foo "null" :null-object 'foo)
-    (compat--should ["false" t] "[false, true]" :false-object "false"))
   (let ((input "{\"key\":[\"abc\", 2], \"yek\": null}"))
     (let ((obj (compat--json-parse-string input)))
       (should (equal (gethash "key" obj) ["abc" 2]))
@@ -1344,373 +1321,339 @@ the compatibility function."
         (should (equal (gethash "key" obj) ["abc" 2]))
         (should (equal (gethash "yek" obj) :null))))))
 
-(ert-deftest compat-lookup-key ()
-  "Check if `compat-lookup-key' was implemented properly."
+(compat-deftest compat-lookup-key
   (let ((a-map (make-sparse-keymap))
         (b-map (make-sparse-keymap)))
     (define-key a-map "x" 'foo)
     (define-key b-map "x" 'bar)
-    (compat-test compat-lookup-key
-      (compat--should 'foo a-map "x")
-      (compat--should 'bar b-map "x")
-      (compat--should 'foo (list a-map b-map) "x")
-      (compat--should 'bar (list b-map a-map) "x"))))
+    (ought 'foo a-map "x")
+    (ought 'bar b-map "x")
+    (ought 'foo (list a-map b-map) "x")
+    (ought 'bar (list b-map a-map) "x")))
 
 (ert-deftest compat-hash-table-keys ()
-  "Check if `compat--hash-table-keys' was implemented properly."
   (let ((ht (make-hash-table)))
-    (compat-test hash-table-keys
-      (compat--should '() ht)
-      (puthash 1 'one ht)
-      (compat--should '(1) ht)
-      (puthash 1 'one ht)
-      (compat--should '(1) ht)
-      (remhash 1 ht)
-      (compat--should '() ht)
-      (puthash 2 'two ht)
-      (compat--should '(2) ht))))
+    (should (null (compat--hash-table-keys ht)))
+    (puthash 1 'one ht)
+    (should (equal '(1) (compat--hash-table-keys ht)))
+    (puthash 1 'one ht)
+    (should (equal '(1) (compat--hash-table-keys ht)))
+    (puthash 2 'two ht)
+    (should (memq 1 (compat--hash-table-keys ht)))
+    (should (memq 2 (compat--hash-table-keys ht)))
+    (should (= 2 (length (compat--hash-table-keys ht))))
+    (remhash 1 ht)
+    (should (equal '(2) (compat--hash-table-keys ht)))))
 
 (ert-deftest compat-hash-table-values ()
-  "Check if `compat--hash-table-values' was implemented properly."
   (let ((ht (make-hash-table)))
-    (compat-test hash-table-values
-      (compat--should '() ht)
-      (puthash 1 'one ht)
-      (compat--should '(one) ht)
-      (puthash 1 'one ht)
-      (compat--should '(one) ht)
-      (remhash 1 ht)
-      (compat--should '() ht)
-      (puthash 2 'two ht)
-      (compat--should '(two) ht))))
-
-(ert-deftest compat-string-empty-p ()
-  "Check if `compat--string-empty-p' was implemented properly."
-  (compat-test string-empty-p
-    (compat--should t "")
-    (compat--should nil " ")
-    (compat--should t (make-string 0 ?x))
-    (compat--should nil (make-string 1 ?x))))
-
-(ert-deftest compat-string-join ()
-  "Check if `compat--string-join' was implemented properly."
-  (compat-test string-join
-    (compat--should "" '(""))
-    (compat--should "" '("") " ")
-    (compat--should "a" '("a"))
-    (compat--should "a" '("a") " ")
-    (compat--should "abc" '("a" "b" "c"))
-    (compat--should "a b c" '("a" "b" "c") " ")))
-
-(ert-deftest compat-string-blank-p ()
-  "Check if `compat--string-blank-p' was implemented properly."
-  (compat-test string-blank-p
-    (compat--should 0 "")
-    (compat--should 0 " ")
-    (compat--should 0 (make-string 0 ?x))
-    (compat--should nil (make-string 1 ?x))))
-
-(ert-deftest compat-string-remove-prefix ()
-  "Check if `compat--string-remove-prefix' was implemented properly."
-  (compat-test string-remove-prefix
-    (compat--should "" "" "")
-    (compat--should "a" "" "a")
-    (compat--should "" "a" "")
-    (compat--should "bc" "a" "abc")
-    (compat--should "abc" "c" "abc")
-    (compat--should "bbcc" "aa" "aabbcc")
-    (compat--should "aabbcc" "bb" "aabbcc")
-    (compat--should "aabbcc" "cc" "aabbcc")
-    (compat--should "aabbcc" "dd" "aabbcc")))
-
-(ert-deftest compat-string-remove-suffix ()
-  "Check if `compat--string-remove-suffix' was implemented properly."
-  (compat-test string-remove-suffix
-    (compat--should "" "" "")
-    (compat--should "a" "" "a")
-    (compat--should "" "a" "")
-    (compat--should "abc" "a" "abc")
-    (compat--should "ab" "c" "abc")
-    (compat--should "aabbcc" "aa" "aabbcc")
-    (compat--should "aabbcc" "bb" "aabbcc")
-    (compat--should "aabb" "cc" "aabbcc")
-    (compat--should "aabbcc" "dd" "aabbcc")))
-
-(ert-deftest compat-bool-vector-exclusive-or ()
-  "Check if `compat--bool-vector-exclusive-or' was implemented properly."
-  (let ((a (bool-vector t t nil nil))
-        (b (bool-vector t nil t nil))
-        (c (make-bool-vector 4 nil)))
-    (compat-test bool-vector-exclusive-or
-      (compat--should (bool-vector nil t t nil) a b)
-      (compat--should (bool-vector nil t t nil) b a)
-      (compat--bool-vector-exclusive-or a b c)
-      (should (equal (bool-vector nil t t nil) c))
-      (should (equal (bool-vector nil t t nil) c))
-      (compat--error wrong-length-argument a (bool-vector))
-      (compat--error wrong-length-argument a b (bool-vector))
-      (compat--error wrong-type-argument (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector))
-      (compat--error wrong-type-argument (vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (vector) (vector)))))
-
-(ert-deftest compat-bool-vector-union ()
-  "Check if `compat--bool-vector-union' was implemented properly."
-  (let ((a (bool-vector t t nil nil))
-        (b (bool-vector t nil t nil))
-        (c (make-bool-vector 4 nil)))
-    (compat-test bool-vector-union
-      (compat--should (bool-vector t t t nil) a b)
-      (compat--should (bool-vector t t t nil) b a)
-      (compat--bool-vector-union a b c)
-      (should (equal (bool-vector t t t nil) c))
-      (compat--error wrong-length-argument a (bool-vector))
-      (compat--error wrong-length-argument a b (bool-vector))
-      (compat--error wrong-type-argument (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector))
-      (compat--error wrong-type-argument (vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (vector) (vector)))))
-
-(ert-deftest compat-bool-vector-intersection ()
-  "Check if `compat--bool-vector-intersection' was implemented properly."
-  (let ((a (bool-vector t t nil nil))
-        (b (bool-vector t nil t nil))
-        (c (make-bool-vector 4 nil)))
-    (compat-test bool-vector-intersection
-      (compat--should (bool-vector t nil nil nil) a b)
-      (compat--should (bool-vector t nil nil nil) b a)
-      (compat--bool-vector-intersection a b c)
-      (should (equal (bool-vector t nil nil nil) c))
-      (compat--error wrong-length-argument a (bool-vector))
-      (compat--error wrong-length-argument a b (bool-vector))
-      (compat--error wrong-type-argument (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector))
-      (compat--error wrong-type-argument (vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (vector) (vector)))))
-
-(ert-deftest compat-bool-vector-set-difference ()
-  "Check if `compat--bool-vector-set-difference' was implemented properly."
-  (let ((a (bool-vector t t nil nil))
-        (b (bool-vector t nil t nil))
-        (c (make-bool-vector 4 nil)))
-    (compat-test bool-vector-set-difference
-      (compat--should (bool-vector nil t nil nil) a b)
-      (compat--should (bool-vector nil nil t nil) b a)
-      (compat--bool-vector-set-difference a b c)
-      (should (equal (bool-vector nil t nil nil) c))
-      (compat--bool-vector-set-difference b a c)
-      (should (equal (bool-vector nil nil t nil) c))
-      (compat--error wrong-length-argument a (bool-vector))
-      (compat--error wrong-length-argument a b (bool-vector))
-      (compat--error wrong-type-argument (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector))
-      (compat--error wrong-type-argument (vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (bool-vector) (vector) (vector))
-      (compat--error wrong-type-argument (vector) (bool-vector) (vector))
-      (compat--error wrong-type-argument (vector) (vector) (vector)))))
-
-(ert-deftest compat-bool-vector-not ()
-  "Check if `compat--bool-vector-not' was implemented properly."
-  (compat-test bool-vector-not
-    (compat--should (bool-vector) (bool-vector))
-    (compat--should (bool-vector t) (bool-vector nil))
-    (compat--should (bool-vector nil) (bool-vector t))
-    (compat--should (bool-vector t t) (bool-vector nil nil))
-    (compat--should (bool-vector t nil) (bool-vector nil t))
-    (compat--should (bool-vector nil t) (bool-vector t nil))
-    (compat--should (bool-vector nil nil) (bool-vector t t))
-    (compat--error wrong-type-argument (vector))
-    (compat--error wrong-type-argument (vector) (vector))))
-
-(ert-deftest compat-bool-vector-subsetp ()
-  "Check if `compat--bool-vector-subsetp' was implemented properly."
-  (compat-test bool-vector-subsetp
-    (compat--should t (bool-vector) (bool-vector))
-    (compat--should t (bool-vector t) (bool-vector t))
-    (compat--should t (bool-vector nil) (bool-vector t))
-    (compat--should nil (bool-vector t) (bool-vector nil))
-    (compat--should t (bool-vector nil) (bool-vector nil))
-    (compat--should t (bool-vector t t) (bool-vector t t))
-    (compat--should t (bool-vector nil nil) (bool-vector t t))
-    (compat--should t (bool-vector nil nil) (bool-vector t nil))
-    (compat--should t (bool-vector nil nil) (bool-vector nil t))
-    (compat--should nil (bool-vector t nil) (bool-vector nil nil))
-    (compat--should nil (bool-vector nil t) (bool-vector nil nil))
-    (compat--error wrong-length-argument (bool-vector nil) (bool-vector nil 
nil))
-    (compat--error wrong-type-argument (bool-vector) (vector))
-    (compat--error wrong-type-argument (vector) (bool-vector))
-    (compat--error wrong-type-argument (vector) (vector))))
-
-(ert-deftest compat-bool-vector-count-consecutive ()
-  "Check if `compat--bool-vector-count-consecutive' was implemented properly."
-  (compat-test bool-vector-count-consecutive
-    ;; (compat--should 0 (bool-vector nil) (bool-vector nil) 0)
-    (compat--should 0 (make-bool-vector 10 nil) t 0)
-    (compat--should 10 (make-bool-vector 10 nil) nil 0)
-    (compat--should 0 (make-bool-vector 10 nil) t 1)
-    (compat--should 9 (make-bool-vector 10 nil) nil 1)
-    (compat--should 0 (make-bool-vector 10 nil) t 1)
-    (compat--should 9 (make-bool-vector 10 t) t 1)
-    (compat--should 0 (make-bool-vector 10 nil) t 8)
-    (compat--should 2 (make-bool-vector 10 nil) nil 8)
-    (compat--should 2 (make-bool-vector 10 t) t 8)
-    (compat--should 10 (make-bool-vector 10 t) (make-bool-vector 10 t) 0)
-    (compat--should 4 (bool-vector t t t t nil t t t t t) t 0)
-    (compat--should 0 (bool-vector t t t t nil t t t t t) t 4)
-    (compat--should 5 (bool-vector t t t t nil t t t t t) t 5)
-    (compat--error wrong-type-argument (vector) nil 0)))
-
-(ert-deftest compat-bool-vector-count-population ()
-  "Check if `compat--bool-vector-count-population' was implemented properly."
-  (compat-test bool-vector-count-population
-    (compat--should  0 (bool-vector))
-    (compat--should  0 (make-bool-vector 10 nil))
-    (compat--should 10 (make-bool-vector 10 t))
-    (compat--should  1 (bool-vector nil nil t nil))
-    (compat--should  1 (bool-vector nil nil nil t))
-    (compat--should  1 (bool-vector t nil nil nil))
-    (compat--should  2 (bool-vector t nil nil t))
-    (compat--should  2 (bool-vector t nil t nil))
-    (compat--should  3 (bool-vector t nil t t))
-    (compat--error wrong-type-argument (vector))))
-
-(ert-deftest compat-assoc-delete-all ()
-  "Check if `compat--assoc-delete-all was implemented properly."
-  (compat-test assoc-delete-all
-    (compat--should (list) 0 (list))
-    ;; Test `eq'
-    (compat--should '((1 . one)) 0 (list (cons 1 'one)))
-    (compat--should '((1 . one) a) 0 (list (cons 1 'one) 'a))
-    (compat--should '((1 . one)) 0 (list (cons 0 'zero) (cons 1 'one)))
-    (compat--should '((1 . one)) 0 (list (cons 0 'zero) (cons 0 'zero) (cons 1 
'one)))
-    (compat--should '((1 . one)) 0 (list (cons 0 'zero) (cons 1 'one) (cons 0 
'zero)))
-    (compat--should '((1 . one) a) 0 (list (cons 0 'zero) (cons 1 'one) 'a  
(cons 0 'zero)))
-    (compat--should '(a (1 . one)) 0 (list 'a (cons 0 'zero) (cons 1 'one) 
(cons 0 'zero)))
-    ;; Test `equal'
-    (compat--should '(("one" . one)) "zero" (list (cons "one" 'one)))
-    (compat--should '(("one" . one) a) "zero" (list (cons "one" 'one) 'a))
-    (compat--should '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons 
"one" 'one)))
-    (compat--should '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons 
"zero" 'zero) (cons "one" 'one)))
-    (compat--should '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons 
"one" 'one) (cons "zero" 'zero)))
-    (compat--should '(("one" . one) a) "zero" (list (cons "zero" 'zero) (cons 
"one" 'one) 'a  (cons "zero" 'zero)))
-    (compat--should '(a ("one" . one)) "zero" (list 'a (cons "zero" 'zero) 
(cons "one" 'one) (cons "zero" 'zero)))
-    ;; Test custom predicate
-    (compat--should '() 0 (list (cons 1 'one)) #'/=)
-    (compat--should '(a) 0 (list (cons 1 'one) 'a) #'/=)
-    (compat--should '((0 . zero)) 0 (list (cons 0 'zero) (cons 1 'one)) #'/=)
-    (compat--should '((0 . zero) (0 . zero)) 0 (list (cons 0 'zero) (cons 0 
'zero) (cons 1 'one)) #'/=)
-    (compat--should '((0 . zero) (0 . zero)) 0 (list (cons 0 'zero) (cons 1 
'one) (cons 0 'zero)) #'/=)
-    (compat--should '((0 . zero) a (0 . zero)) 0 (list (cons 0 'zero) (cons 1 
'one) 'a  (cons 0 'zero)) #'/=)
-    (compat--should '(a (0 . zero) (0 . zero)) 0 (list 'a (cons 0 'zero) (cons 
1 'one) (cons 0 'zero)) #'/=)))
-
-(ert-deftest compat-color-values-from-color-spec ()
-  "Check if `compat--color-values-from-color-spec' was implemented properly."
-  (compat-test color-values-from-color-spec
-    ;; #RGB notation
-    (compat--should '(0 0 0) "#000")
-    (compat--should '(0 0 0) "#000000")
-    (compat--should '(0 0 0) "#000000000")
-    (compat--should '(0 0 0) "#000000000000")
-    (compat--should '(0 0 65535) "#00F")
-    (compat--should '(0 0 65535) "#0000FF")
-    (compat--should '(0 0 65535) "#000000FFF")
-    (compat--should '(0 0 65535) "#00000000FFFF")
-    (compat--should '(0 0 65535) "#00f")
-    (compat--should '(0 0 65535) "#0000ff")
-    (compat--should '(0 0 65535) "#000000fff")
-    (compat--should '(0 0 65535) "#00000000ffff")
-    (compat--should '(0 0 65535) "#00000000ffFF")
-    (compat--should nil "")
-    (compat--should nil "#")
-    (compat--should nil "#0")
-    (compat--should nil "#00")
-    (compat--should nil "#0000FG")
-    (compat--should nil "#0000FFF")
-    (compat--should nil "#0000FFFF")
-    (compat--should '(0 4080 65535) "#0000FFFFF")
-    (compat--should nil "#000FF")
-    (compat--should nil "#0000F")
-    (compat--should nil " #000000")
-    (compat--should nil "#000000 ")
-    (compat--should nil " #000000 ")
-    ;; rgb: notation
-    (compat--should '(0 0 0) "rgb:0/0/0")
-    (compat--should '(0 0 0) "rgb:0/0/00")
-    (compat--should '(0 0 0) "rgb:0/00/000")
-    (compat--should '(0 0 0) "rgb:0/000/0000")
-    (compat--should '(0 0 0) "rgb:000/0000/0")
-    (compat--should '(0 0 65535) "rgb:000/0000/F")
-    (compat--should '(65535 0 65535) "rgb:FFF/0000/F")
-    (compat--should '(65535 0 65535) "rgb:FFFF/0000/FFFF")
-    (compat--should '(0 255 65535) "rgb:0/00FF/FFFF")
-    (compat--should nil "rgb:/0000/FFFF")
-    (compat--should nil "rgb:0000/0000/FFFG")
-    (compat--should nil "rgb:0000/0000/FFFFF")
-    (compat--should nil "rgb:0000/0000")
-    (compat--should nil "rg:0000/0000/0000")
-    (compat--should nil "rgb: 0000/0000/0000")
-    (compat--should nil "rgbb:0000/0000/0000")
-    (compat--should nil "rgb:0000/0000/0000   ")
-    (compat--should nil " rgb:0000/0000/0000  ")
-    (compat--should nil "  rgb:0000/0000/0000")
-    (compat--should nil "rgb:0000/ 0000 /0000")
-    (compat--should nil "rgb: 0000 /0000 /0000")
-    ;; rgbi: notation
-    (compat--should '(0 0 0) "rgbi:0/0/0")
-    (compat--should '(0 0 0) "rgbi:0.0/0.0/0.0")
-    (compat--should '(0 0 0) "rgbi:0.0/0/0")
-    (compat--should '(0 0 0) "rgbi:0.0/0/0")
-    (compat--should '(0 0 0) "rgbi:0/0/0.")
-    (compat--should '(0 0 0) "rgbi:0/0/0.0000")
-    (compat--should '(0 0 0) "rgbi:0/0/.0")
-    (compat--should '(0 0 0) "rgbi:0/0/.0000")
-    (compat--should '(65535 0 0) "rgbi:1/0/0.0000")
-    (compat--should '(65535 0 0) "rgbi:1./0/0.0000")
-    (compat--should '(65535 0 0) "rgbi:1.0/0/0.0000")
-    (compat--should '(65535 32768 0) "rgbi:1.0/0.5/0.0000")
-    (compat--should '(6554 21843 65469) "rgbi:0.1/0.3333/0.999")
-    (compat--should nil "rgbi:1.0001/0/0")
-    (compat--should nil "rgbi:2/0/0")
-    (compat--should nil "rgbi:0.a/0/0")
-    (compat--should nil "rgbi:./0/0")
-    (compat--should nil "rgbi:./0/0")
-    (compat--should nil " rgbi:0/0/0")
-    (compat--should nil "rgbi:0/0/0 ")
-    (compat--should nil "      rgbi:0/0/0 ")
-    (compat--should nil "rgbi:0 /0/ 0")
-    (compat--should nil "rgbi:0/ 0 /0")
-    (compat--should nil "rgbii:0/0/0")
-    (compat--should nil "rgbi :0/0/0")
-    ;; strtod ignores leading whitespace, making these legal colour
-    ;; specifications:
-    ;;
-    ;; (compat--should nil "rgbi: 0/0/0")
-    ;; (compat--should nil "rgbi: 0/ 0/ 0")
-    (compat--should nil "rgbi : 0/0/0")))
-
-(ert-deftest compat-file-modes-number-to-symbolic ()
-  "Check if `compat--file-modes-number-to-symbolic' was implemented properly."
-  (compat-test file-modes-number-to-symbolic
-    (compat--should "-rwx------" #o700)
-    (compat--should "-rwxrwx---" #o770)
-    (compat--should "-rwx---rwx" #o707)
-    (compat--should "-rw-r-xr--" #o654)
-    (compat--should "--wx-w---x" #o321)
-    (compat--should "drwx------" #o700 ?d)
-    (compat--should "?rwx------" #o700 ??)
-    (compat--should "lrwx------" #o120700)
-    (compat--should "prwx------" #o10700)
-    (compat--should "-rwx------" #o30700)))
-
-(provide 'compat-tests)
+    (should (null (compat--hash-table-values ht)))
+    (puthash 1 'one ht)
+    (should (equal '(one) (compat--hash-table-values ht)))
+    (puthash 1 'one ht)
+    (should (equal '(one) (compat--hash-table-values ht)))
+    (puthash 2 'two ht)
+    (should (memq 'one (compat--hash-table-values ht)))
+    (should (memq 'two (compat--hash-table-values ht)))
+    (should (= 2 (length (compat--hash-table-values ht))))
+    (remhash 1 ht)
+    (should (equal '(two) (compat--hash-table-values ht)))))
+
+(compat-deftest string-empty-p
+  (ought t "")
+  (ought nil " ")
+  (ought t (make-string 0 ?x))
+  (ought nil (make-string 1 ?x)))
+
+(compat-deftest string-join
+  (ought "" '(""))
+  (ought "" '("") " ")
+  (ought "a" '("a"))
+  (ought "a" '("a") " ")
+  (ought "abc" '("a" "b" "c"))
+  (ought "a b c" '("a" "b" "c") " "))
+
+(compat-deftest string-blank-p
+  (ought 0 "")
+  (ought 0 " ")
+  (ought 0 (make-string 0 ?x))
+  (ought nil (make-string 1 ?x)))
+
+(compat-deftest string-remove-prefix
+  (ought "" "" "")
+  (ought "a" "" "a")
+  (ought "" "a" "")
+  (ought "bc" "a" "abc")
+  (ought "abc" "c" "abc")
+  (ought "bbcc" "aa" "aabbcc")
+  (ought "aabbcc" "bb" "aabbcc")
+  (ought "aabbcc" "cc" "aabbcc")
+  (ought "aabbcc" "dd" "aabbcc"))
+
+(compat-deftest string-remove-suffix
+  (ought "" "" "")
+  (ought "a" "" "a")
+  (ought "" "a" "")
+  (ought "abc" "a" "abc")
+  (ought "ab" "c" "abc")
+  (ought "aabbcc" "aa" "aabbcc")
+  (ought "aabbcc" "bb" "aabbcc")
+  (ought "aabb" "cc" "aabbcc")
+  (ought "aabbcc" "dd" "aabbcc"))
+
+(let ((a (bool-vector t t nil nil))
+      (b (bool-vector t nil t nil))
+      (c (make-bool-vector 4 nil)))
+  (compat-deftest bool-vector-exclusive-or
+    (ought (bool-vector nil t t nil) a b)
+    (ought (bool-vector nil t t nil) b a)
+    (compat--bool-vector-exclusive-or a b c)
+    (should (equal (bool-vector nil t t nil) c))
+    (should (equal (bool-vector nil t t nil) c))
+    (expect wrong-length-argument a (bool-vector))
+    (expect wrong-length-argument a b (bool-vector))
+    (expect wrong-type-argument (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector))
+    (expect wrong-type-argument (vector) (vector))
+    (expect wrong-type-argument (bool-vector) (bool-vector) (vector))
+    (expect wrong-type-argument (bool-vector) (vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (vector) (vector))))
+
+(let ((a (bool-vector t t nil nil))
+      (b (bool-vector t nil t nil))
+      (c (make-bool-vector 4 nil)))
+  (compat-deftest bool-vector-union
+    (ought (bool-vector t t t nil) a b)
+    (ought (bool-vector t t t nil) b a)
+    (compat--bool-vector-union a b c)
+    (should (equal (bool-vector t t t nil) c))
+    (expect wrong-length-argument a (bool-vector))
+    (expect wrong-length-argument a b (bool-vector))
+    (expect wrong-type-argument (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector))
+    (expect wrong-type-argument (vector) (vector))
+    (expect wrong-type-argument (bool-vector) (bool-vector) (vector))
+    (expect wrong-type-argument (bool-vector) (vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (vector) (vector))))
+
+(let ((a (bool-vector t t nil nil))
+      (b (bool-vector t nil t nil))
+      (c (make-bool-vector 4 nil)))
+  (compat-deftest bool-vector-intersection
+    (ought (bool-vector t nil nil nil) a b)
+    (ought (bool-vector t nil nil nil) b a)
+    (compat--bool-vector-intersection a b c)
+    (should (equal (bool-vector t nil nil nil) c))
+    (expect wrong-length-argument a (bool-vector))
+    (expect wrong-length-argument a b (bool-vector))
+    (expect wrong-type-argument (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector))
+    (expect wrong-type-argument (vector) (vector))
+    (expect wrong-type-argument (bool-vector) (bool-vector) (vector))
+    (expect wrong-type-argument (bool-vector) (vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (vector) (vector))))
+
+(let ((a (bool-vector t t nil nil))
+      (b (bool-vector t nil t nil))
+      (c (make-bool-vector 4 nil)))
+  (compat-deftest bool-vector-set-difference
+    (ought (bool-vector nil t nil nil) a b)
+    (ought (bool-vector nil nil t nil) b a)
+    (compat--bool-vector-set-difference a b c)
+    (should (equal (bool-vector nil t nil nil) c))
+    (compat--bool-vector-set-difference b a c)
+    (should (equal (bool-vector nil nil t nil) c))
+    (expect wrong-length-argument a (bool-vector))
+    (expect wrong-length-argument a b (bool-vector))
+    (expect wrong-type-argument (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector))
+    (expect wrong-type-argument (vector) (vector))
+    (expect wrong-type-argument (bool-vector) (bool-vector) (vector))
+    (expect wrong-type-argument (bool-vector) (vector) (vector))
+    (expect wrong-type-argument (vector) (bool-vector) (vector))
+    (expect wrong-type-argument (vector) (vector) (vector))))
+
+(compat-deftest bool-vector-not
+  (ought (bool-vector) (bool-vector))
+  (ought (bool-vector t) (bool-vector nil))
+  (ought (bool-vector nil) (bool-vector t))
+  (ought (bool-vector t t) (bool-vector nil nil))
+  (ought (bool-vector t nil) (bool-vector nil t))
+  (ought (bool-vector nil t) (bool-vector t nil))
+  (ought (bool-vector nil nil) (bool-vector t t))
+  (expect wrong-type-argument (vector))
+  (expect wrong-type-argument (vector) (vector)))
+
+(compat-deftest bool-vector-subsetp
+  (ought t (bool-vector) (bool-vector))
+  (ought t (bool-vector t) (bool-vector t))
+  (ought t (bool-vector nil) (bool-vector t))
+  (ought nil (bool-vector t) (bool-vector nil))
+  (ought t (bool-vector nil) (bool-vector nil))
+  (ought t (bool-vector t t) (bool-vector t t))
+  (ought t (bool-vector nil nil) (bool-vector t t))
+  (ought t (bool-vector nil nil) (bool-vector t nil))
+  (ought t (bool-vector nil nil) (bool-vector nil t))
+  (ought nil (bool-vector t nil) (bool-vector nil nil))
+  (ought nil (bool-vector nil t) (bool-vector nil nil))
+  (expect wrong-length-argument (bool-vector nil) (bool-vector nil nil))
+  (expect wrong-type-argument (bool-vector) (vector))
+  (expect wrong-type-argument (vector) (bool-vector))
+  (expect wrong-type-argument (vector) (vector)))
+
+(compat-deftest bool-vector-count-consecutive
+  (ought 0 (bool-vector nil) (bool-vector nil) 0)
+  (ought 0 (make-bool-vector 10 nil) t 0)
+  (ought 10 (make-bool-vector 10 nil) nil 0)
+  (ought 0 (make-bool-vector 10 nil) t 1)
+  (ought 9 (make-bool-vector 10 nil) nil 1)
+  (ought 0 (make-bool-vector 10 nil) t 1)
+  (ought 9 (make-bool-vector 10 t) t 1)
+  (ought 0 (make-bool-vector 10 nil) t 8)
+  (ought 2 (make-bool-vector 10 nil) nil 8)
+  (ought 2 (make-bool-vector 10 t) t 8)
+  (ought 10 (make-bool-vector 10 t) (make-bool-vector 10 t) 0)
+  (ought 4 (bool-vector t t t t nil t t t t t) t 0)
+  (ought 0 (bool-vector t t t t nil t t t t t) t 4)
+  (ought 5 (bool-vector t t t t nil t t t t t) t 5)
+  (expect wrong-type-argument (vector) nil 0))
+
+(compat-deftest bool-vector-count-population
+  (ought  0 (bool-vector))
+  (ought  0 (make-bool-vector 10 nil))
+  (ought 10 (make-bool-vector 10 t))
+  (ought  1 (bool-vector nil nil t nil))
+  (ought  1 (bool-vector nil nil nil t))
+  (ought  1 (bool-vector t nil nil nil))
+  (ought  2 (bool-vector t nil nil t))
+  (ought  2 (bool-vector t nil t nil))
+  (ought  3 (bool-vector t nil t t))
+  (expect wrong-type-argument (vector)))
+
+(compat-deftest assoc-delete-all
+  (ought (list) 0 (list))
+  ;; Test `eq'
+  (ought '((1 . one)) 0 (list (cons 1 'one)))
+  (ought '((1 . one) a) 0 (list (cons 1 'one) 'a))
+  (ought '((1 . one)) 0 (list (cons 0 'zero) (cons 1 'one)))
+  (ought '((1 . one)) 0 (list (cons 0 'zero) (cons 0 'zero) (cons 1 'one)))
+  (ought '((1 . one)) 0 (list (cons 0 'zero) (cons 1 'one) (cons 0 'zero)))
+  (ought '((1 . one) a) 0 (list (cons 0 'zero) (cons 1 'one) 'a  (cons 0 
'zero)))
+  (ought '(a (1 . one)) 0 (list 'a (cons 0 'zero) (cons 1 'one) (cons 0 
'zero)))
+  ;; Test `equal'
+  (ought '(("one" . one)) "zero" (list (cons "one" 'one)))
+  (ought '(("one" . one) a) "zero" (list (cons "one" 'one) 'a))
+  (ought '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons "one" 'one)))
+  (ought '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons "zero" 'zero) 
(cons "one" 'one)))
+  (ought '(("one" . one)) "zero" (list (cons "zero" 'zero) (cons "one" 'one) 
(cons "zero" 'zero)))
+  (ought '(("one" . one) a) "zero" (list (cons "zero" 'zero) (cons "one" 'one) 
'a  (cons "zero" 'zero)))
+  (ought '(a ("one" . one)) "zero" (list 'a (cons "zero" 'zero) (cons "one" 
'one) (cons "zero" 'zero)))
+  ;; Test custom predicate
+  (ought '() 0 (list (cons 1 'one)) #'/=)
+  (ought '(a) 0 (list (cons 1 'one) 'a) #'/=)
+  (ought '((0 . zero)) 0 (list (cons 0 'zero) (cons 1 'one)) #'/=)
+  (ought '((0 . zero) (0 . zero)) 0 (list (cons 0 'zero) (cons 0 'zero) (cons 
1 'one)) #'/=)
+  (ought '((0 . zero) (0 . zero)) 0 (list (cons 0 'zero) (cons 1 'one) (cons 0 
'zero)) #'/=)
+  (ought '((0 . zero) a (0 . zero)) 0 (list (cons 0 'zero) (cons 1 'one) 'a  
(cons 0 'zero)) #'/=)
+  (ought '(a (0 . zero) (0 . zero)) 0 (list 'a (cons 0 'zero) (cons 1 'one) 
(cons 0 'zero)) #'/=))
+
+(compat-deftest color-values-from-color-spec
+  ;; #RGB notation
+  (ought '(0 0 0) "#000")
+  (ought '(0 0 0) "#000000")
+  (ought '(0 0 0) "#000000000")
+  (ought '(0 0 0) "#000000000000")
+  (ought '(0 0 65535) "#00F")
+  (ought '(0 0 65535) "#0000FF")
+  (ought '(0 0 65535) "#000000FFF")
+  (ought '(0 0 65535) "#00000000FFFF")
+  (ought '(0 0 65535) "#00f")
+  (ought '(0 0 65535) "#0000ff")
+  (ought '(0 0 65535) "#000000fff")
+  (ought '(0 0 65535) "#00000000ffff")
+  (ought '(0 0 65535) "#00000000ffFF")
+  (ought nil "")
+  (ought nil "#")
+  (ought nil "#0")
+  (ought nil "#00")
+  (ought nil "#0000FG")
+  (ought nil "#0000FFF")
+  (ought nil "#0000FFFF")
+  (ought '(0 4080 65535) "#0000FFFFF")
+  (ought nil "#000FF")
+  (ought nil "#0000F")
+  (ought nil " #000000")
+  (ought nil "#000000 ")
+  (ought nil " #000000 ")
+  ;; rgb: notation
+  (ought '(0 0 0) "rgb:0/0/0")
+  (ought '(0 0 0) "rgb:0/0/00")
+  (ought '(0 0 0) "rgb:0/00/000")
+  (ought '(0 0 0) "rgb:0/000/0000")
+  (ought '(0 0 0) "rgb:000/0000/0")
+  (ought '(0 0 65535) "rgb:000/0000/F")
+  (ought '(65535 0 65535) "rgb:FFF/0000/F")
+  (ought '(65535 0 65535) "rgb:FFFF/0000/FFFF")
+  (ought '(0 255 65535) "rgb:0/00FF/FFFF")
+  (ought nil "rgb:/0000/FFFF")
+  (ought nil "rgb:0000/0000/FFFG")
+  (ought nil "rgb:0000/0000/FFFFF")
+  (ought nil "rgb:0000/0000")
+  (ought nil "rg:0000/0000/0000")
+  (ought nil "rgb: 0000/0000/0000")
+  (ought nil "rgbb:0000/0000/0000")
+  (ought nil "rgb:0000/0000/0000   ")
+  (ought nil " rgb:0000/0000/0000  ")
+  (ought nil "  rgb:0000/0000/0000")
+  (ought nil "rgb:0000/ 0000 /0000")
+  (ought nil "rgb: 0000 /0000 /0000")
+  ;; rgbi: notation
+  (ought '(0 0 0) "rgbi:0/0/0")
+  (ought '(0 0 0) "rgbi:0.0/0.0/0.0")
+  (ought '(0 0 0) "rgbi:0.0/0/0")
+  (ought '(0 0 0) "rgbi:0.0/0/0")
+  (ought '(0 0 0) "rgbi:0/0/0.")
+  (ought '(0 0 0) "rgbi:0/0/0.0000")
+  (ought '(0 0 0) "rgbi:0/0/.0")
+  (ought '(0 0 0) "rgbi:0/0/.0000")
+  (ought '(65535 0 0) "rgbi:1/0/0.0000")
+  (ought '(65535 0 0) "rgbi:1./0/0.0000")
+  (ought '(65535 0 0) "rgbi:1.0/0/0.0000")
+  (ought '(65535 32768 0) "rgbi:1.0/0.5/0.0000")
+  (ought '(6554 21843 65469) "rgbi:0.1/0.3333/0.999")
+  (ought nil "rgbi:1.0001/0/0")
+  (ought nil "rgbi:2/0/0")
+  (ought nil "rgbi:0.a/0/0")
+  (ought nil "rgbi:./0/0")
+  (ought nil "rgbi:./0/0")
+  (ought nil " rgbi:0/0/0")
+  (ought nil "rgbi:0/0/0 ")
+  (ought nil " rgbi:0/0/0 ")
+  (ought nil "rgbi:0 /0/ 0")
+  (ought nil "rgbi:0/ 0 /0")
+  (ought nil "rgbii:0/0/0")
+  (ought nil "rgbi :0/0/0")
+  ;; strtod ignores leading whitespace, making these legal colour
+  ;; specifications:
+  ;;
+  ;; (ought nil "rgbi: 0/0/0")
+  ;; (ought nil "rgbi: 0/ 0/ 0")
+  (ought nil "rgbi : 0/0/0"))
+
+(compat-deftest file-modes-number-to-symbolic
+  (ought "-rwx------" #o700)
+  (ought "-rwxrwx---" #o770)
+  (ought "-rwx---rwx" #o707)
+  (ought "-rw-r-xr--" #o654)
+  (ought "--wx-w---x" #o321)
+  (ought "drwx------" #o700 ?d)
+  (ought "?rwx------" #o700 ??)
+  (ought "lrwx------" #o120700)
+  (ought "prwx------" #o10700)
+  (ought "-rwx------" #o30700))
+
+(provide 'compat-deftests)
 ;;; compat-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]