diff options
| author | Michael Albinus | 2024-12-29 12:26:05 +0100 |
|---|---|---|
| committer | Michael Albinus | 2024-12-29 12:26:05 +0100 |
| commit | 680906c136adfefda3a5d8be2b3ab7527521a449 (patch) | |
| tree | 568838038bfdc45650cd83fe1cb7f25c2e0db7ea /test | |
| parent | 72eb5f8bedbe441f6a3952557b9aa3ef6fd6235d (diff) | |
| download | emacs-680906c136adfefda3a5d8be2b3ab7527521a449.tar.gz emacs-680906c136adfefda3a5d8be2b3ab7527521a449.zip | |
Some minor Tramp changes
* lisp/net/tramp-sh.el (tramp-sh-handle-process-file): Do proper quoting.
* lisp/net/tramp.el (tramp-string-empty-or-nil-p):
Declare `tramp-suppress-trace' property.
(tramp-skeleton-make-symbolic-link): Drop volume letter when flushing.
* test/lisp/net/tramp-tests.el (tramp-test39-make-lock-file-name):
Adapt test.
(tramp-test42-utf8): Do not run expensive tests on MS Windows.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 105 |
1 files changed, 59 insertions, 46 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 91d0fd82788..5bd8b13bd13 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -6878,34 +6878,40 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 6878 | (should-not (file-locked-p tmp-name1)) | 6878 | (should-not (file-locked-p tmp-name1)) |
| 6879 | 6879 | ||
| 6880 | ;; `kill-buffer' removes the lock. | 6880 | ;; `kill-buffer' removes the lock. |
| 6881 | (lock-file tmp-name1) | 6881 | ;; `kill-buffer--possibly-save' exists since Emacs 29.1. |
| 6882 | (should (eq (file-locked-p tmp-name1) t)) | 6882 | (when (fboundp 'kill-buffer--possibly-save) |
| 6883 | (with-temp-buffer | 6883 | (lock-file tmp-name1) |
| 6884 | (set-visited-file-name tmp-name1) | 6884 | (should (eq (file-locked-p tmp-name1) t)) |
| 6885 | (insert "foo") | 6885 | (with-temp-buffer |
| 6886 | (should (buffer-modified-p)) | 6886 | (set-visited-file-name tmp-name1) |
| 6887 | (cl-letf (((symbol-function #'read-from-minibuffer) | 6887 | (insert "foo") |
| 6888 | (lambda (&rest _args) "yes"))) | 6888 | (should (buffer-modified-p)) |
| 6889 | (kill-buffer))) | 6889 | ;; Modifying `read-from-minibuffer' doesn't work on MS Windows. |
| 6890 | (should-not (file-locked-p tmp-name1)) | 6890 | (cl-letf (((symbol-function #'kill-buffer--possibly-save) |
| 6891 | #'always)) | ||
| 6892 | (kill-buffer))) | ||
| 6893 | (should-not (file-locked-p tmp-name1))) | ||
| 6891 | 6894 | ||
| 6892 | ;; `kill-buffer' should not remove the lock when the | 6895 | ;; `kill-buffer' should not remove the lock when the |
| 6893 | ;; connection is broken. See Bug#61663. | 6896 | ;; connection is broken. See Bug#61663. |
| 6894 | (lock-file tmp-name1) | 6897 | ;; `kill-buffer--possibly-save' exists since Emacs 29.1. |
| 6895 | (should (eq (file-locked-p tmp-name1) t)) | 6898 | (when (fboundp 'kill-buffer--possibly-save) |
| 6896 | (with-temp-buffer | 6899 | (lock-file tmp-name1) |
| 6897 | (set-visited-file-name tmp-name1) | 6900 | (should (eq (file-locked-p tmp-name1) t)) |
| 6898 | (insert "foo") | 6901 | (with-temp-buffer |
| 6899 | (should (buffer-modified-p)) | 6902 | (set-visited-file-name tmp-name1) |
| 6900 | (tramp-cleanup-connection | 6903 | (insert "foo") |
| 6901 | tramp-test-vec 'keep-debug 'keep-password) | 6904 | (should (buffer-modified-p)) |
| 6902 | (cl-letf (((symbol-function #'read-from-minibuffer) | 6905 | (tramp-cleanup-connection |
| 6903 | (lambda (&rest _args) "yes"))) | 6906 | tramp-test-vec 'keep-debug 'keep-password) |
| 6904 | (kill-buffer))) | 6907 | ;; Modifying `read-from-minibuffer' doesn't work on MS Windows. |
| 6905 | ;; A new connection changes process id, and also the | 6908 | (cl-letf (((symbol-function #'kill-buffer--possibly-save) |
| 6906 | ;; lock file contents. But it still exists. | 6909 | #'always)) |
| 6907 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6910 | (kill-buffer))) |
| 6908 | (should (stringp (file-locked-p tmp-name1))) | 6911 | ;; A new connection changes process id, and also the |
| 6912 | ;; lock file contents. But it still exists. | ||
| 6913 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | ||
| 6914 | (should (stringp (file-locked-p tmp-name1)))) | ||
| 6909 | 6915 | ||
| 6910 | ;; When `remote-file-name-inhibit-locks' is set, nothing happens. | 6916 | ;; When `remote-file-name-inhibit-locks' is set, nothing happens. |
| 6911 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6917 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| @@ -6928,34 +6934,41 @@ INPUT, if non-nil, is a string sent to the process." | |||
| 6928 | 6934 | ||
| 6929 | ;; Steal the file lock. | 6935 | ;; Steal the file lock. |
| 6930 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6936 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| 6931 | (cl-letf (((symbol-function #'read-char) (lambda (&rest _args) ?s))) | 6937 | ;; Modifying `read-char' doesn't work on MS Windows. |
| 6938 | (cl-letf (((symbol-function #'ask-user-about-lock) #'always)) | ||
| 6932 | (lock-file tmp-name1)) | 6939 | (lock-file tmp-name1)) |
| 6933 | (should (eq (file-locked-p tmp-name1) t)) | 6940 | (should (eq (file-locked-p tmp-name1) t)) |
| 6934 | 6941 | ||
| 6935 | ;; Ignore the file lock. | 6942 | ;; Ignore the file lock. |
| 6936 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6943 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| 6937 | (cl-letf (((symbol-function #'read-char) (lambda (&rest _args) ?p))) | 6944 | ;; Modifying `read-char' doesn't work on MS Windows. |
| 6945 | (cl-letf (((symbol-function #'ask-user-about-lock) #'ignore)) | ||
| 6938 | (lock-file tmp-name1)) | 6946 | (lock-file tmp-name1)) |
| 6939 | (should (stringp (file-locked-p tmp-name1))) | 6947 | (should (stringp (file-locked-p tmp-name1))) |
| 6940 | 6948 | ||
| 6941 | ;; Quit the file lock machinery. | 6949 | ;; Quit the file lock machinery. There are problems with |
| 6942 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) | 6950 | ;; "sftp" and "podman", so we test on Emacs 29.1 only. |
| 6943 | (cl-letf (((symbol-function #'read-char) (lambda (&rest _args) ?q))) | 6951 | (when (tramp--test-emacs29-p ) |
| 6944 | (should-error | 6952 | (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) |
| 6945 | (lock-file tmp-name1) | 6953 | ;; Modifying `read-char' doesn't work on MS Windows. |
| 6946 | :type 'file-locked) | 6954 | (cl-letf (((symbol-function #'ask-user-about-lock) |
| 6947 | ;; The same for `write-region'. | 6955 | (lambda (&rest args) |
| 6948 | (should-error | 6956 | (signal 'file-locked args)))) |
| 6949 | (write-region "foo" nil tmp-name1) | 6957 | (should-error |
| 6950 | :type 'file-locked) | 6958 | (lock-file tmp-name1) |
| 6951 | (should-error | 6959 | :type 'file-locked) |
| 6952 | (write-region "foo" nil tmp-name1 nil nil tmp-name1) | 6960 | ;; The same for `write-region'. |
| 6953 | :type 'file-locked) | 6961 | (should-error |
| 6954 | ;; The same for `set-visited-file-name'. | 6962 | (write-region "foo" nil tmp-name1) |
| 6955 | (with-temp-buffer | 6963 | :type 'file-locked) |
| 6956 | (should-error | 6964 | (should-error |
| 6957 | (set-visited-file-name tmp-name1) | 6965 | (write-region "foo" nil tmp-name1 nil nil tmp-name1) |
| 6958 | :type 'file-locked))) | 6966 | :type 'file-locked) |
| 6967 | ;; The same for `set-visited-file-name'. | ||
| 6968 | (with-temp-buffer | ||
| 6969 | (should-error | ||
| 6970 | (set-visited-file-name tmp-name1) | ||
| 6971 | :type 'file-locked)))) | ||
| 6959 | (should (stringp (file-locked-p tmp-name1)))) | 6972 | (should (stringp (file-locked-p tmp-name1)))) |
| 6960 | 6973 | ||
| 6961 | ;; Cleanup. | 6974 | ;; Cleanup. |
| @@ -7647,7 +7660,7 @@ This requires restrictions of file name syntax." | |||
| 7647 | ;; to U+1FFFF). | 7660 | ;; to U+1FFFF). |
| 7648 | "🌈🍒👋") | 7661 | "🌈🍒👋") |
| 7649 | 7662 | ||
| 7650 | (when (tramp--test-expensive-test-p) | 7663 | (when (and (tramp--test-expensive-test-p) (not (tramp--test-windows-nt-p))) |
| 7651 | (delete-dups | 7664 | (delete-dups |
| 7652 | (mapcar | 7665 | (mapcar |
| 7653 | ;; Use all available language specific snippets. | 7666 | ;; Use all available language specific snippets. |