summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-04-09 18:51:21 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-04-09 18:51:21 +0200
commit2347b102af29a35c95d2f63badd95a15fdeb7cf1 (patch)
treed20793e7665bd10e5d0500ee172a0c75d7a35e5a /test
parent6157e3e4bc7e4e097e02c572379d1b1542e1d716 (diff)
downloademacs-2347b102af29a35c95d2f63badd95a15fdeb7cf1.tar.gz
Adapt Tramp test
* test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents): Adapt test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el37
1 files changed, 33 insertions, 4 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 3a9f5e03000..9bca6a03754 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2412,22 +2412,51 @@ This checks also `file-name-as-directory', `file-name-directory',
(with-temp-buffer
(write-region "foo" nil tmp-name)
(let ((point (point)))
- (insert-file-contents tmp-name)
+ (should
+ (equal
+ (insert-file-contents tmp-name)
+ `(,(expand-file-name tmp-name) 3)))
(should (string-equal (buffer-string) "foo"))
(should (= point (point))))
(goto-char (1+ (point)))
(let ((point (point)))
- (insert-file-contents tmp-name)
+ (should
+ (equal
+ (insert-file-contents tmp-name)
+ `(,(expand-file-name tmp-name) 3)))
(should (string-equal (buffer-string) "ffoooo"))
(should (= point (point))))
;; Insert partly.
(let ((point (point)))
- (insert-file-contents tmp-name nil 1 3)
+ (should
+ (equal
+ (insert-file-contents tmp-name nil 1 3)
+ `(,(expand-file-name tmp-name) 2)))
(should (string-equal (buffer-string) "foofoooo"))
(should (= point (point))))
+ (let ((point (point)))
+ (should
+ (equal
+ (insert-file-contents tmp-name nil 2 5)
+ `(,(expand-file-name tmp-name) 1)))
+ (should (string-equal (buffer-string) "fooofoooo"))
+ (should (= point (point))))
;; Replace.
(let ((point (point)))
- (insert-file-contents tmp-name nil nil nil 'replace)
+ ;; 0 characters replaced, because "foo" is already there.
+ (should
+ (equal
+ (insert-file-contents tmp-name nil nil nil 'replace)
+ `(,(expand-file-name tmp-name) 0)))
+ (should (string-equal (buffer-string) "foo"))
+ (should (= point (point))))
+ (let ((point (point)))
+ (replace-string-in-region "foo" "bar" (point-min) (point-max))
+ (goto-char point)
+ (should
+ (equal
+ (insert-file-contents tmp-name nil nil nil 'replace)
+ `(,(expand-file-name tmp-name) 3)))
(should (string-equal (buffer-string) "foo"))
(should (= point (point))))
;; Error case.