]> git.eshelyaron.com Git - emacs.git/commitdiff
Use ert-deftest instead of ert--test consistently
authorEshel Yaron <me@eshelyaron.com>
Thu, 16 Jan 2025 08:45:22 +0000 (09:45 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 Jan 2025 08:46:08 +0000 (09:46 +0100)
lisp/emacs-lisp/ert.el
test/lisp/emacs-lisp/ert-tests.el
test/lisp/erc/resources/erc-scenarios-common.el
test/lisp/net/tramp-tests.el

index bbefa7c788c1bb6a30ddb4d132b09200614feb78..f892e12fa86bbc0bb8b0c692a52a7e99bb568172 100644 (file)
@@ -131,12 +131,11 @@ mode.")
 
 (defun ert-test-boundp (symbol)
   "Return non-nil if SYMBOL names a test."
-  (and (get symbol 'ert--test) t))
+  (get symbol 'ert-deftest))
 
 (defun ert-get-test (symbol)
   "If SYMBOL names a test, return that.  Signal an error otherwise."
-  (unless (ert-test-boundp symbol) (error "No test named `%S'" symbol))
-  (get symbol 'ert--test))
+  (or (ert-test-boundp symbol) (error "No test named `%S'" symbol)))
 
 (defun ert-set-test (symbol definition)
   "Make SYMBOL name the test DEFINITION, and return DEFINITION."
@@ -149,16 +148,16 @@ mode.")
     ;; Note that nil is still a valid value for the `name' slot in
     ;; ert-test objects.  It designates an anonymous test.
     (error "Attempt to define a test named nil"))
-  (when (and noninteractive (get symbol 'ert--test))
+  (when (and noninteractive (ert-test-boundp symbol))
     ;; Make sure duplicated tests are discovered since the older test would
     ;; be ignored silently otherwise.
     (error "Test `%s' redefined (or loaded twice)" symbol))
-  (define-symbol-prop symbol 'ert--test definition)
+  (define-symbol-prop symbol 'ert-deftest definition)
   definition)
 
 (defun ert-make-test-unbound (symbol)
   "Make SYMBOL name no test.  Return SYMBOL."
-  (cl-remprop symbol 'ert--test)
+  (cl-remprop symbol 'ert-deftest)
   symbol)
 
 (defun ert--parse-keys-and-body (keys-and-body)
@@ -1543,7 +1542,7 @@ test packages depend on each other, it might be helpful.")
   ;; https://www.ibm.com/docs/en/developer-for-zos/14.1.0?topic=formats-junit-xml-format
   ;; https://llg.cubic.org/docs/junit/
   (when-let ((symbol (car (apropos-internal "" #'ert-test-boundp)))
-             (test-file (symbol-file symbol 'ert--test))
+             (test-file (symbol-file symbol 'ert-deftest))
              (test-report
               (file-name-with-extension
                (or ert-load-file-name test-file) "xml")))
@@ -2803,7 +2802,7 @@ To be used in the ERT results buffer."
           (insert (if test-name (format "%S" test-name) "<anonymous test>"))
           (insert " is a test")
           (let ((file-name (and test-name
-                                (symbol-file test-name 'ert--test))))
+                                (symbol-file test-name 'ert-deftest))))
             (when file-name
               (insert (format-message " defined in `%s'"
                                       (file-name-nondirectory file-name)))
index cd89536f6a024d2cf1da658373a1cdc5f6fdc2c6..d60d9479c2b5bd1a64b1ce0b81a61a6a95f86520 100644 (file)
@@ -352,7 +352,7 @@ This macro is used to test if macroexpansion in `should' works."
   (let ((abc (ert-get-test 'ert-test-abc)))
     (should (equal (ert-test-tags abc) '(bar)))
     (should (equal (ert-test-documentation abc) "foo")))
-  (should (equal (symbol-file 'ert-test-deftest 'ert--test)
+  (should (equal (symbol-file 'ert-test-deftest 'ert-deftest)
                  (symbol-file 'ert-test--which-file 'defun)))
 
   (ert-deftest ert-test-def () :expected-result ':passed)
index 8e50225e0a07dbc66431096116d24873392ce401..259b2b46930cb72f95f3e9f6ffde374362d892f1 100644 (file)
@@ -250,7 +250,7 @@ Dialog resource directories are located by expanding the variable
                          (insert buf)))
                      (kill-emacs (ert-stats-completed-unexpected stats))))))
          ;; The `ert-test' object in Emacs 29 has a `file-name' field.
-         (file-name (symbol-file name 'ert--test))
+         (file-name (symbol-file name 'ert-deftest))
          (default-directory (expand-file-name (file-name-directory file-name)))
          (package (if-let* ((found (getenv "ERC_PACKAGE_NAME"))
                             ((string-prefix-p "erc-" found)))
index dd1779b5e81c321fa3779a667a29d3de605f7e8c..0bb81c188e7a8c373178de17ab5a4509794be761 100644 (file)
@@ -3861,12 +3861,12 @@ This tests also `access-file', `file-readable-p',
   "Set the documentation string for a derived test.
 The test is derived from TEST and COMMAND."
   (let ((test-doc
-        (split-string (ert-test-documentation (get test 'ert--test)) "\n")))
+        (split-string (ert-test-documentation (get test 'ert-deftest)) "\n")))
     ;; The first line must be extended.
     (setcar
      test-doc (format "%s  Use the \"%s\" command." (car test-doc) command))
     (setf (ert-test-documentation
-          (get (intern (format "%s-with-%s" test command)) 'ert--test))
+          (get (intern (format "%s-with-%s" test command)) 'ert-deftest))
          (string-join test-doc "\n"))))
 
 (defmacro tramp--test-deftest-with-stat (test)
@@ -3945,7 +3945,7 @@ The test is derived from TEST and COMMAND."
      :tags '(:expensive-test)
      (let ((test-doc
            (split-string
-            (ert-test-documentation (get ',test 'ert--test)) "\n")))
+            (ert-test-documentation (get ',test 'ert-deftest)) "\n")))
        ;; The first line must be extended.
        (setcar
        test-doc
@@ -3953,7 +3953,7 @@ The test is derived from TEST and COMMAND."
        (setf (ert-test-documentation
              (get
               (intern (format "%s-without-file-attributes" ',test))
-              'ert--test))
+              'ert-deftest))
             (string-join test-doc "\n")))
      (skip-unless (tramp--test-enabled))
      (skip-unless
@@ -5122,7 +5122,7 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'."
   `(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
      ;; This is the docstring.  However, it must be expanded to a
      ;; string inside the macro.  No idea.
-     ;; (concat (ert-test-documentation (get ',test 'ert--test))
+     ;; (concat (ert-test-documentation (get ',test 'ert-deftest))
      ;;         "\nUse direct async process.")
      :tags (append '(:expensive-test :tramp-asynchronous-processes)
                   (and ,unstable '(:unstable)))