diff options
| author | Michael Albinus | 2018-01-04 12:48:07 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-01-04 12:48:07 +0100 |
| commit | 13d384820d820d76702ca4a5152011006d1a57a0 (patch) | |
| tree | 1554866b194005d23937573ac5b0890b9b6e347c /test | |
| parent | ce48658191befb7734a7af484e368af5ed8b9447 (diff) | |
| download | emacs-13d384820d820d76702ca4a5152011006d1a57a0.tar.gz emacs-13d384820d820d76702ca4a5152011006d1a57a0.zip | |
Write proper `write-region' message in Tramp backends
* lisp/net/tramp-adb.el (tramp-adb-handle-write-region):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* lisp/net/tramp-smb.el (tramp-smb-handle-write-region):
Write proper message.
* lisp/net/tramp.el (tramp-message-show-message): Change default.
* test/lisp/net/tramp-tests.el (ert-x): Require it.
(tramp-test10-write-region): Extend test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index d4aceb31b58..1688a166ca6 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | (require 'dired) | 44 | (require 'dired) |
| 45 | (require 'ert) | 45 | (require 'ert) |
| 46 | (require 'ert-x) | ||
| 46 | (require 'tramp) | 47 | (require 'tramp) |
| 47 | (require 'vc) | 48 | (require 'vc) |
| 48 | (require 'vc-bzr) | 49 | (require 'vc-bzr) |
| @@ -1866,6 +1867,23 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 1866 | (insert-file-contents tmp-name) | 1867 | (insert-file-contents tmp-name) |
| 1867 | (should (string-equal (buffer-string) "34"))) | 1868 | (should (string-equal (buffer-string) "34"))) |
| 1868 | 1869 | ||
| 1870 | ;; Check message. | ||
| 1871 | ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1. | ||
| 1872 | (with-no-warnings (when (symbol-plist 'ert-with-message-capture) | ||
| 1873 | (let ((tramp-message-show-message t)) | ||
| 1874 | (dolist (noninteractive '(nil t)) | ||
| 1875 | (dolist (visit '(nil t "string" no-message)) | ||
| 1876 | (ert-with-message-capture tramp--test-messages | ||
| 1877 | (write-region "foo" nil tmp-name nil visit) | ||
| 1878 | ;; We must check the last line. There could be | ||
| 1879 | ;; other messages from the progress reporter. | ||
| 1880 | (should | ||
| 1881 | (string-match | ||
| 1882 | (if (and (null noninteractive) | ||
| 1883 | (or (eq visit t) (null visit) (stringp visit))) | ||
| 1884 | (format "^Wrote %s\n\\'" tmp-name) "^\\'") | ||
| 1885 | tramp--test-messages)))))))) | ||
| 1886 | |||
| 1869 | ;; Do not overwrite if excluded. | 1887 | ;; Do not overwrite if excluded. |
| 1870 | (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t))) | 1888 | (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t))) |
| 1871 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) | 1889 | (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) |