]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt Tramp tests
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 24 Jul 2024 13:27:58 +0000 (15:27 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 24 Jul 2024 16:58:46 +0000 (18:58 +0200)
* test/lisp/net/tramp-archive-tests.el (ert-resource-directory-format)
(ert-resource-directory-trim-left-regexp)
(ert-resource-directory-trim-right-regexp, ert-resource-directory)
(ert-resource-file): Don't define.
(tramp-archive--test-emacs28-p): Remove.
(top): Remove unneeded skips.  Use original objects instead of
their `tramp-compat-' counterparts when possible.

* test/lisp/net/tramp-tests.el (seq): Don't require.
(lock-file-name-transforms, process-file-return-signal-string)
(remote-file-name-inhibit-locks, dired-copy-dereference): Don't declare.
(ert-resource-directory-format)
(ert-resource-directory-trim-left-regexp)
(ert-resource-directory-trim-right-regexp, ert-resource-directory)
(ert-resource-file): Don't define.
(tramp--test-emacs28-p): Remove.
(top): Remove unneeded skips.  Use original objects instead of
their `tramp-compat-' counterparts when possible.

(cherry picked from commit d458664e893cd74f46bf9d00559ff5386c3dbf44)

test/lisp/net/tramp-archive-tests.el

index b11292dc774dbea25d83a6d98d760cb0355b20f1..72a1de6fa1fde109898d7c0d0049257150db9184 100644 (file)
 (require 'tramp-archive)
 (defvar tramp-persistency-file-name)
 
-;; `ert-resource-file' was introduced in Emacs 28.1.
-(unless (macrop 'ert-resource-file)
-  (eval-and-compile
-    (defvar ert-resource-directory-format "%s-resources/"
-      "Format for `ert-resource-directory'.")
-    (defvar ert-resource-directory-trim-left-regexp ""
-      "Regexp for `string-trim' (left) used by `ert-resource-directory'.")
-    (defvar ert-resource-directory-trim-right-regexp
-      (rx (? "-test" (? "s")) ".el")
-      "Regexp for `string-trim' (right) used by `ert-resource-directory'.")
-
-    (defmacro ert-resource-directory ()
-      "Return absolute file name of the resource directory for this file.
-
-The path to the resource directory is the \"resources\" directory
-in the same directory as the test file.
-
-If that directory doesn't exist, use the directory named like the
-test file but formatted by `ert-resource-directory-format' and trimmed
-using `string-trim' with arguments
-`ert-resource-directory-trim-left-regexp' and
-`ert-resource-directory-trim-right-regexp'.  The default values mean
-that if called from a test file named \"foo-tests.el\", return
-the absolute file name for \"foo-resources\"."
-      `(let* ((testfile ,(or (bound-and-true-p byte-compile-current-file)
-                             (and load-in-progress load-file-name)
-                             buffer-file-name))
-              (default-directory (file-name-directory testfile)))
-        (file-truename
-         (if (file-accessible-directory-p "resources/")
-              (expand-file-name "resources/")
-            (expand-file-name
-             (format
-             ert-resource-directory-format
-              (string-trim testfile
-                          ert-resource-directory-trim-left-regexp
-                          ert-resource-directory-trim-right-regexp)))))))
-
-    (defmacro ert-resource-file (file)
-      "Return file name of resource file named FILE.
-A resource file is in the resource directory as per
-`ert-resource-directory'."
-      `(expand-file-name ,file (ert-resource-directory)))))
-
 (defvar tramp-archive-test-file-archive (ert-resource-file "foo.tar.gz")
   "The test file archive.")
 
@@ -121,12 +77,6 @@ the origin of the temporary TMPFILE, have no write permissions."
      (directory-files tmpfile 'full directory-files-no-dot-files-regexp))
     (delete-directory tmpfile)))
 
-(defun tramp-archive--test-emacs28-p ()
-  "Check for Emacs version >= 28.1.
-Some semantics has been changed for there, without new functions or
-variables, so we check the Emacs version directly."
-  (>= emacs-major-version 28))
-
 (ert-deftest tramp-archive-test00-availability ()
   "Test availability of archive file name functions."
   :expected-result (if tramp-archive-enabled :passed :failed)
@@ -842,7 +792,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
   (let ((fsi (file-system-info tramp-archive-test-archive)))
     (skip-unless fsi)
     (should (and (consp fsi)
-                (tramp-compat-length= fsi 3)
+                (length= fsi 3)
                 (numberp (nth 0 fsi))
                 ;; FREE and AVAIL are always 0.
                 (zerop (nth 1 fsi))
@@ -886,13 +836,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
       (dolist (default-directory
                (append
                 `(,temporary-file-directory)
-                ;;  Starting Emacs in a directory which has
-                ;; `tramp-archive-file-name-regexp' syntax is
-                ;; supported only with Emacs > 27.2 (sigh!).
-                ;; (Bug#48476)
-                 (and (tramp-archive--test-emacs28-p)
-                     `(,(file-name-as-directory
-                         tramp-archive-test-directory)))))
+                `(,(file-name-as-directory tramp-archive-test-directory))))
        (dolist (file `("/mock::foo" ,(concat tramp-archive-test-archive "foo")))
           (should
            (string-match