]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt Tramp test
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 9 Apr 2023 16:51:21 +0000 (18:51 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 9 Apr 2023 16:51:21 +0000 (18:51 +0200)
* test/lisp/net/tramp-tests.el (tramp-test09-insert-file-contents):
Adapt test.

test/lisp/net/tramp-tests.el

index 3a9f5e03000239d36e236d8bc068569249e3f9cc..9bca6a03754a80081741c04c72994d303833ccb9 100644 (file)
@@ -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.