diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2021-08-26 13:14:19 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2021-08-26 13:14:19 +0200 |
commit | e5f82c130599c977adb65c40daab15c7c9a3dc26 (patch) | |
tree | 4a391b4bd8c7711bdaf9964418e77be3fb6c2d55 /test/lisp/shadowfile-tests.el | |
parent | fbf2933e6907c1344c0b543c3f05cb3cfcc0ebc3 (diff) | |
download | emacs-e5f82c130599c977adb65c40daab15c7c9a3dc26.tar.gz emacs-e5f82c130599c977adb65c40daab15c7c9a3dc26.tar.bz2 emacs-e5f82c130599c977adb65c40daab15c7c9a3dc26.zip |
Improve robustness of shadowfile.el
* lisp/shadowfile.el (shadow-site-help): New defconst.
(shadow-read-site): Use it.
(shadow-make-fullname, shadow-contract-file-name)
(shadow-define-literal-group): Handle errors more robust. (Bug#49596)
* test/lisp/shadowfile-tests.el (shadow-test06-literal-groups):
Extend test.
Diffstat (limited to 'test/lisp/shadowfile-tests.el')
-rw-r--r-- | test/lisp/shadowfile-tests.el | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el index c571dc3e14b..1ab539f3e42 100644 --- a/test/lisp/shadowfile-tests.el +++ b/test/lisp/shadowfile-tests.el @@ -664,7 +664,29 @@ guaranteed by the originator of a cluster definition." (should (member (format "/%s:%s" cluster2 (file-local-name file2)) (car shadow-literal-groups))) ;; Bug#49596. - (should (member (concat primary file1) (car shadow-literal-groups)))) + (should (member (concat primary file1) (car shadow-literal-groups))) + + ;; Error handling. + (setq shadow-literal-groups nil) + ;; There's no `buffer-file-name'. + (with-temp-buffer + (call-interactively #'shadow-define-literal-group) + (set-buffer-modified-p nil)) + (should-not shadow-literal-groups) + ;; Define an empty literal group. + (setq mocked-input `(,(kbd "RET"))) + (with-temp-buffer + (set-visited-file-name file1) + (call-interactively #'shadow-define-literal-group) + (set-buffer-modified-p nil)) + (should-not shadow-literal-groups) + ;; Use a non-existing site name. + (setq mocked-input `("foo" ,(kbd "RET"))) + (with-temp-buffer + (set-visited-file-name file1) + (call-interactively #'shadow-define-literal-group) + (set-buffer-modified-p nil)) + (should-not shadow-literal-groups)) ;; Cleanup. (shadow--tests-cleanup)))) |