diff options
| author | Michael Albinus | 2019-09-04 14:13:13 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-09-04 14:13:13 +0200 |
| commit | ed80d6d88cd8c14fd585390a1fa622ba4f7a67d0 (patch) | |
| tree | 5859f6b73527e65f8eb7fcf19d48e3a9811aafaa | |
| parent | 6c2e107a54fe39bbd6ce31d9f29464da33bbf4af (diff) | |
| download | emacs-ed80d6d88cd8c14fd585390a1fa622ba4f7a67d0.tar.gz emacs-ed80d6d88cd8c14fd585390a1fa622ba4f7a67d0.zip | |
Further work on Bug#37202
* test/lisp/shadowfile-tests.el (shadow-debug): Set to t.
(shadow--tests-cleanup): Simplify.
(shadow-test*): Call `shadow-initialize'.
(shadow-test08-shadow-todo, shadow-test09-shadow-copy-files):
In cleanup, kill buffers used for test.
(top): Do not initialize.
| -rw-r--r-- | test/lisp/shadowfile-tests.el | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index 5ab663c69b3..a523a340a40 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | "Temporary directory for Tramp tests.") | 64 | "Temporary directory for Tramp tests.") |
| 65 | 65 | ||
| 66 | (setq password-cache-expiry nil | 66 | (setq password-cache-expiry nil |
| 67 | shadow-debug nil | 67 | shadow-debug t |
| 68 | tramp-verbose 0 | 68 | tramp-verbose 0 |
| 69 | tramp-message-show-message nil) | 69 | tramp-message-show-message nil) |
| 70 | 70 | ||
| @@ -92,11 +92,11 @@ | |||
| 92 | (set-buffer-modified-p nil) | 92 | (set-buffer-modified-p nil) |
| 93 | (kill-buffer)) | 93 | (kill-buffer)) |
| 94 | ;; Delete buffers. | 94 | ;; Delete buffers. |
| 95 | (when (buffer-live-p shadow-info-buffer) | 95 | (ignore-errors |
| 96 | (with-current-buffer shadow-info-buffer | 96 | (with-current-buffer shadow-info-buffer |
| 97 | (set-buffer-modified-p nil) | 97 | (set-buffer-modified-p nil) |
| 98 | (kill-buffer))) | 98 | (kill-buffer))) |
| 99 | (when (buffer-live-p shadow-todo-buffer) | 99 | (ignore-errors |
| 100 | (with-current-buffer shadow-todo-buffer | 100 | (with-current-buffer shadow-todo-buffer |
| 101 | (set-buffer-modified-p nil) | 101 | (set-buffer-modified-p nil) |
| 102 | (kill-buffer))) | 102 | (kill-buffer))) |
| @@ -131,8 +131,9 @@ guaranteed by the originator of a cluster definition." | |||
| 131 | ((symbol-function 'read-string) | 131 | ((symbol-function 'read-string) |
| 132 | (lambda (&rest args) (pop mocked-input)))) | 132 | (lambda (&rest args) (pop mocked-input)))) |
| 133 | 133 | ||
| 134 | ;; Cleanup. | 134 | ;; Cleanup & initialize. |
| 135 | (shadow--tests-cleanup) | 135 | (shadow--tests-cleanup) |
| 136 | (shadow-initialize) | ||
| 136 | 137 | ||
| 137 | ;; Define a cluster. | 138 | ;; Define a cluster. |
| 138 | (setq cluster "cluster" | 139 | (setq cluster "cluster" |
| @@ -247,8 +248,9 @@ guaranteed by the originator of a cluster definition." | |||
| 247 | ((symbol-function 'read-string) | 248 | ((symbol-function 'read-string) |
| 248 | (lambda (&rest args) (pop mocked-input)))) | 249 | (lambda (&rest args) (pop mocked-input)))) |
| 249 | 250 | ||
| 250 | ;; Cleanup. | 251 | ;; Cleanup & initialize. |
| 251 | (shadow--tests-cleanup) | 252 | (shadow--tests-cleanup) |
| 253 | (shadow-initialize) | ||
| 252 | 254 | ||
| 253 | ;; Define a cluster. | 255 | ;; Define a cluster. |
| 254 | (setq cluster1 "cluster1" | 256 | (setq cluster1 "cluster1" |
| @@ -342,8 +344,10 @@ guaranteed by the originator of a cluster definition." | |||
| 342 | cluster primary regexp file hup) | 344 | cluster primary regexp file hup) |
| 343 | (unwind-protect | 345 | (unwind-protect |
| 344 | (progn | 346 | (progn |
| 345 | ;; Cleanup. | 347 | |
| 348 | ;; Cleanup & initialize. | ||
| 346 | (shadow--tests-cleanup) | 349 | (shadow--tests-cleanup) |
| 350 | (shadow-initialize) | ||
| 347 | 351 | ||
| 348 | ;; Define a cluster. | 352 | ;; Define a cluster. |
| 349 | (setq cluster "cluster" | 353 | (setq cluster "cluster" |
| @@ -412,8 +416,10 @@ guaranteed by the originator of a cluster definition." | |||
| 412 | cluster primary regexp file1 file2) | 416 | cluster primary regexp file1 file2) |
| 413 | (unwind-protect | 417 | (unwind-protect |
| 414 | (progn | 418 | (progn |
| 415 | ;; Cleanup. | 419 | |
| 420 | ;; Cleanup & initialize. | ||
| 416 | (shadow--tests-cleanup) | 421 | (shadow--tests-cleanup) |
| 422 | (shadow-initialize) | ||
| 417 | 423 | ||
| 418 | ;; Define a cluster. | 424 | ;; Define a cluster. |
| 419 | (setq cluster "cluster" | 425 | (setq cluster "cluster" |
| @@ -477,8 +483,10 @@ guaranteed by the originator of a cluster definition." | |||
| 477 | cluster primary regexp file) | 483 | cluster primary regexp file) |
| 478 | (unwind-protect | 484 | (unwind-protect |
| 479 | (progn | 485 | (progn |
| 480 | ;; Cleanup. | 486 | |
| 487 | ;; Cleanup & initialize. | ||
| 481 | (shadow--tests-cleanup) | 488 | (shadow--tests-cleanup) |
| 489 | (shadow-initialize) | ||
| 482 | 490 | ||
| 483 | ;; Define a cluster. | 491 | ;; Define a cluster. |
| 484 | (setq cluster "cluster" | 492 | (setq cluster "cluster" |
| @@ -532,8 +540,10 @@ guaranteed by the originator of a cluster definition." | |||
| 532 | cluster primary regexp file) | 540 | cluster primary regexp file) |
| 533 | (unwind-protect | 541 | (unwind-protect |
| 534 | (progn | 542 | (progn |
| 535 | ;; Cleanup. | 543 | |
| 544 | ;; Cleanup & initialize. | ||
| 536 | (shadow--tests-cleanup) | 545 | (shadow--tests-cleanup) |
| 546 | (shadow-initialize) | ||
| 537 | 547 | ||
| 538 | ;; Define a cluster. | 548 | ;; Define a cluster. |
| 539 | (setq cluster "cluster" | 549 | (setq cluster "cluster" |
| @@ -591,8 +601,9 @@ guaranteed by the originator of a cluster definition." | |||
| 591 | ((symbol-function 'read-string) | 601 | ((symbol-function 'read-string) |
| 592 | (lambda (&rest args) (pop mocked-input)))) | 602 | (lambda (&rest args) (pop mocked-input)))) |
| 593 | 603 | ||
| 594 | ;; Cleanup. | 604 | ;; Cleanup & initialize. |
| 595 | (shadow--tests-cleanup) | 605 | (shadow--tests-cleanup) |
| 606 | (shadow-initialize) | ||
| 596 | 607 | ||
| 597 | ;; Define clusters. | 608 | ;; Define clusters. |
| 598 | (setq cluster1 "cluster1" | 609 | (setq cluster1 "cluster1" |
| @@ -651,8 +662,9 @@ guaranteed by the originator of a cluster definition." | |||
| 651 | ((symbol-function 'read-string) | 662 | ((symbol-function 'read-string) |
| 652 | (lambda (&rest args) (pop mocked-input)))) | 663 | (lambda (&rest args) (pop mocked-input)))) |
| 653 | 664 | ||
| 654 | ;; Cleanup. | 665 | ;; Cleanup & initialize. |
| 655 | (shadow--tests-cleanup) | 666 | (shadow--tests-cleanup) |
| 667 | (shadow-initialize) | ||
| 656 | 668 | ||
| 657 | ;; Define clusters. | 669 | ;; Define clusters. |
| 658 | (setq cluster1 "cluster1" | 670 | (setq cluster1 "cluster1" |
| @@ -710,8 +722,10 @@ guaranteed by the originator of a cluster definition." | |||
| 710 | cluster1 cluster2 primary regexp file) | 722 | cluster1 cluster2 primary regexp file) |
| 711 | (unwind-protect | 723 | (unwind-protect |
| 712 | (progn | 724 | (progn |
| 713 | ;; Cleanup. | 725 | |
| 726 | ;; Cleanup & initialize. | ||
| 714 | (shadow--tests-cleanup) | 727 | (shadow--tests-cleanup) |
| 728 | (shadow-initialize) | ||
| 715 | 729 | ||
| 716 | ;; Define clusters. | 730 | ;; Define clusters. |
| 717 | (setq cluster1 "cluster1" | 731 | (setq cluster1 "cluster1" |
| @@ -817,8 +831,12 @@ guaranteed by the originator of a cluster definition." | |||
| 817 | shadow-files-to-copy))) | 831 | shadow-files-to-copy))) |
| 818 | 832 | ||
| 819 | ;; Cleanup. | 833 | ;; Cleanup. |
| 820 | (ignore-errors (delete-file file)) | 834 | (dolist (elt `(,file ,(concat (shadow-site-primary cluster2) file))) |
| 821 | (ignore-errors (delete-file (concat (shadow-site-primary cluster2) file))) | 835 | (ignore-errors |
| 836 | (with-current-buffer (get-file-buffer elt) | ||
| 837 | (set-buffer-modified-p nil) | ||
| 838 | (kill-buffer))) | ||
| 839 | (ignore-errors (delete-file elt))) | ||
| 822 | (shadow--tests-cleanup)))) | 840 | (shadow--tests-cleanup)))) |
| 823 | 841 | ||
| 824 | (ert-deftest shadow-test09-shadow-copy-files () | 842 | (ert-deftest shadow-test09-shadow-copy-files () |
| @@ -836,8 +854,10 @@ guaranteed by the originator of a cluster definition." | |||
| 836 | cluster1 cluster2 primary regexp file mocked-input) | 854 | cluster1 cluster2 primary regexp file mocked-input) |
| 837 | (unwind-protect | 855 | (unwind-protect |
| 838 | (progn | 856 | (progn |
| 839 | ;; Cleanup. | 857 | |
| 858 | ;; Cleanup & initialize. | ||
| 840 | (shadow--tests-cleanup) | 859 | (shadow--tests-cleanup) |
| 860 | (shadow-initialize) | ||
| 841 | 861 | ||
| 842 | ;; Define clusters. | 862 | ;; Define clusters. |
| 843 | (setq cluster1 "cluster1" | 863 | (setq cluster1 "cluster1" |
| @@ -894,8 +914,12 @@ guaranteed by the originator of a cluster definition." | |||
| 894 | 914 | ||
| 895 | ;; Cleanup. | 915 | ;; Cleanup. |
| 896 | (remove-function (symbol-function 'write-region) "write-region-mock") | 916 | (remove-function (symbol-function 'write-region) "write-region-mock") |
| 897 | (ignore-errors (delete-file file)) | 917 | (dolist (elt `(,file ,(concat (shadow-site-primary cluster2) file))) |
| 898 | (ignore-errors (delete-file (concat (shadow-site-primary cluster2) file))) | 918 | (ignore-errors |
| 919 | (with-current-buffer (get-file-buffer elt) | ||
| 920 | (set-buffer-modified-p nil) | ||
| 921 | (kill-buffer))) | ||
| 922 | (ignore-errors (delete-file elt))) | ||
| 899 | (shadow--tests-cleanup)))) | 923 | (shadow--tests-cleanup)))) |
| 900 | 924 | ||
| 901 | (defun shadowfile-test-all (&optional interactive) | 925 | (defun shadowfile-test-all (&optional interactive) |
| @@ -905,10 +929,5 @@ guaranteed by the originator of a cluster definition." | |||
| 905 | (ert-run-tests-interactively "^shadowfile-") | 929 | (ert-run-tests-interactively "^shadowfile-") |
| 906 | (ert-run-tests-batch "^shadowfile-"))) | 930 | (ert-run-tests-batch "^shadowfile-"))) |
| 907 | 931 | ||
| 908 | (let ((shadow-info-file shadow-test-info-file) | ||
| 909 | (shadow-todo-file shadow-test-todo-file)) | ||
| 910 | (shadow--tests-cleanup) | ||
| 911 | (shadow-initialize)) | ||
| 912 | |||
| 913 | (provide 'shadowfile-tests) | 932 | (provide 'shadowfile-tests) |
| 914 | ;;; shadowfile-tests.el ends here | 933 | ;;; shadowfile-tests.el ends here |