diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2018-07-09 16:03:49 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2018-07-09 16:03:49 +0200 |
commit | 917158f8c91121572f38d641096e171540d0bac2 (patch) | |
tree | 43710ad9b429f9a425db9d2d161aff2606b47124 /test/lisp/files-x-tests.el | |
parent | 848f0f73e98dfa8f32ffbcf7c2e0ea37ce123959 (diff) | |
download | emacs-917158f8c91121572f38d641096e171540d0bac2.tar.gz emacs-917158f8c91121572f38d641096e171540d0bac2.tar.bz2 emacs-917158f8c91121572f38d641096e171540d0bac2.zip |
Fix Bug#32090
* lisp/files-x.el (connection-local-normalize-criteria): Do not
use PROPERTIES anymore.
(connection-local-get-profiles): Rewrite, in order to accept any
property as optional. (Bug#32090)
(connection-local-set-profiles):
Adapt ´connection-local-normalize-criteria' call.
* test/lisp/files-x-tests.el
(files-x-test-connection-local-set-profiles)
(files-x-test-hack-connection-local-variables-apply): Extend tests.
Diffstat (limited to 'test/lisp/files-x-tests.el')
-rw-r--r-- | test/lisp/files-x-tests.el | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el index 7bd69bda016..a77c6815fcd 100644 --- a/test/lisp/files-x-tests.el +++ b/test/lisp/files-x-tests.el @@ -101,15 +101,19 @@ (setq files-x-test--criteria (append files-x-test--application files-x-test--protocol files-x-test--user files-x-test--machine)) + ;; An empty variable list is accepted (but makes no sense). (connection-local-set-profiles files-x-test--criteria) (should-not (connection-local-get-profiles files-x-test--criteria)) + + ;; First test, all declared properties. (connection-local-set-profiles files-x-test--criteria 'remote-bash 'remote-ksh) (should (equal (connection-local-get-profiles files-x-test--criteria) '(remote-bash remote-ksh))) + ;; Changing the order of properties doesn't matter. (setq files-x-test--criteria (append files-x-test--protocol files-x-test--application @@ -118,12 +122,14 @@ (equal (connection-local-get-profiles files-x-test--criteria) '(remote-bash remote-ksh))) - ;; A further call adds profiles. + + ;; A further call adds profiles. (connection-local-set-profiles files-x-test--criteria 'remote-nullfile) (should (equal (connection-local-get-profiles files-x-test--criteria) '(remote-bash remote-ksh remote-nullfile))) + ;; Adding existing profiles doesn't matter. (connection-local-set-profiles files-x-test--criteria 'remote-bash 'remote-nullfile) @@ -132,31 +138,38 @@ (connection-local-get-profiles files-x-test--criteria) '(remote-bash remote-ksh remote-nullfile))) - ;; Use a criteria without application. - (setq files-x-test--criteria - (append files-x-test--protocol - files-x-test--user files-x-test--machine)) - (connection-local-set-profiles files-x-test--criteria 'remote-ksh) - (should - (equal - (connection-local-get-profiles files-x-test--criteria) - '(remote-ksh))) - ;; An application not used in any registered criteria matches also this. - (setq files-x-test--criteria - (append files-x-test--another-application files-x-test--protocol - files-x-test--user files-x-test--machine)) - (should - (equal - (connection-local-get-profiles files-x-test--criteria) - '(remote-ksh))) + ;; Use different properties. + (dolist (criteria + `(;; All properties. + ,(append files-x-test--application files-x-test--protocol + files-x-test--user files-x-test--machine) + ;; Without :application. + ,(append files-x-test--protocol + files-x-test--user files-x-test--machine) + ;; Without :protocol. + ,(append files-x-test--application + files-x-test--user files-x-test--machine) + ;; Without :user. + ,(append files-x-test--application files-x-test--protocol + files-x-test--machine) + ;; Without :machine. + ,(append files-x-test--application files-x-test--protocol + files-x-test--user) + ;; No property at all. + nil)) + (should + (equal + (connection-local-get-profiles criteria) + '(remote-bash remote-ksh remote-nullfile)))) ;; Using a nil criteria also works. Duplicate profiles are trashed. (connection-local-set-profiles nil 'remote-bash 'remote-ksh 'remote-ksh 'remote-bash) + ;; This matches also the existing profiles from other criteria. (should (equal (connection-local-get-profiles nil) - '(remote-bash remote-ksh))) + '(remote-bash remote-ksh remote-nullfile))) ;; A criteria other than plist is wrong. (should-error (connection-local-set-profiles 'dummy)))) @@ -235,7 +248,9 @@ ;; declare same variables as in `remote-bash'. (should (equal connection-local-variables-alist - (nreverse (copy-tree files-x-test--variables1)))) + (append + (nreverse (copy-tree files-x-test--variables3)) + (nreverse (copy-tree files-x-test--variables1))))) ;; The variables exist also as local variables. (should (local-variable-p 'remote-shell-file-name)) ;; The proper variable value is set. |