diff options
| author | Michael Albinus | 2023-04-09 18:51:21 +0200 |
|---|---|---|
| committer | Michael Albinus | 2023-04-09 18:51:21 +0200 |
| commit | 2347b102af29a35c95d2f63badd95a15fdeb7cf1 (patch) | |
| tree | d20793e7665bd10e5d0500ee172a0c75d7a35e5a /test | |
| parent | 6157e3e4bc7e4e097e02c572379d1b1542e1d716 (diff) | |
| download | emacs-2347b102af29a35c95d2f63badd95a15fdeb7cf1.tar.gz emacs-2347b102af29a35c95d2f63badd95a15fdeb7cf1.zip | |
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.el | 37 |
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', | |||
| 2412 | (with-temp-buffer | 2412 | (with-temp-buffer |
| 2413 | (write-region "foo" nil tmp-name) | 2413 | (write-region "foo" nil tmp-name) |
| 2414 | (let ((point (point))) | 2414 | (let ((point (point))) |
| 2415 | (insert-file-contents tmp-name) | 2415 | (should |
| 2416 | (equal | ||
| 2417 | (insert-file-contents tmp-name) | ||
| 2418 | `(,(expand-file-name tmp-name) 3))) | ||
| 2416 | (should (string-equal (buffer-string) "foo")) | 2419 | (should (string-equal (buffer-string) "foo")) |
| 2417 | (should (= point (point)))) | 2420 | (should (= point (point)))) |
| 2418 | (goto-char (1+ (point))) | 2421 | (goto-char (1+ (point))) |
| 2419 | (let ((point (point))) | 2422 | (let ((point (point))) |
| 2420 | (insert-file-contents tmp-name) | 2423 | (should |
| 2424 | (equal | ||
| 2425 | (insert-file-contents tmp-name) | ||
| 2426 | `(,(expand-file-name tmp-name) 3))) | ||
| 2421 | (should (string-equal (buffer-string) "ffoooo")) | 2427 | (should (string-equal (buffer-string) "ffoooo")) |
| 2422 | (should (= point (point)))) | 2428 | (should (= point (point)))) |
| 2423 | ;; Insert partly. | 2429 | ;; Insert partly. |
| 2424 | (let ((point (point))) | 2430 | (let ((point (point))) |
| 2425 | (insert-file-contents tmp-name nil 1 3) | 2431 | (should |
| 2432 | (equal | ||
| 2433 | (insert-file-contents tmp-name nil 1 3) | ||
| 2434 | `(,(expand-file-name tmp-name) 2))) | ||
| 2426 | (should (string-equal (buffer-string) "foofoooo")) | 2435 | (should (string-equal (buffer-string) "foofoooo")) |
| 2427 | (should (= point (point)))) | 2436 | (should (= point (point)))) |
| 2437 | (let ((point (point))) | ||
| 2438 | (should | ||
| 2439 | (equal | ||
| 2440 | (insert-file-contents tmp-name nil 2 5) | ||
| 2441 | `(,(expand-file-name tmp-name) 1))) | ||
| 2442 | (should (string-equal (buffer-string) "fooofoooo")) | ||
| 2443 | (should (= point (point)))) | ||
| 2428 | ;; Replace. | 2444 | ;; Replace. |
| 2429 | (let ((point (point))) | 2445 | (let ((point (point))) |
| 2430 | (insert-file-contents tmp-name nil nil nil 'replace) | 2446 | ;; 0 characters replaced, because "foo" is already there. |
| 2447 | (should | ||
| 2448 | (equal | ||
| 2449 | (insert-file-contents tmp-name nil nil nil 'replace) | ||
| 2450 | `(,(expand-file-name tmp-name) 0))) | ||
| 2451 | (should (string-equal (buffer-string) "foo")) | ||
| 2452 | (should (= point (point)))) | ||
| 2453 | (let ((point (point))) | ||
| 2454 | (replace-string-in-region "foo" "bar" (point-min) (point-max)) | ||
| 2455 | (goto-char point) | ||
| 2456 | (should | ||
| 2457 | (equal | ||
| 2458 | (insert-file-contents tmp-name nil nil nil 'replace) | ||
| 2459 | `(,(expand-file-name tmp-name) 3))) | ||
| 2431 | (should (string-equal (buffer-string) "foo")) | 2460 | (should (string-equal (buffer-string) "foo")) |
| 2432 | (should (= point (point)))) | 2461 | (should (= point (point)))) |
| 2433 | ;; Error case. | 2462 | ;; Error case. |