aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2023-12-09 10:13:14 +0100
committerMichael Albinus2023-12-09 10:13:14 +0100
commit1908d2aefb2175875b837bafa1a4f1299a4bdb52 (patch)
tree4f49cdd24b40a119a3515054c589655d1f5de398 /test
parent945aa0e42bc08879a9c979cbffb9b3f50e4945f3 (diff)
downloademacs-1908d2aefb2175875b837bafa1a4f1299a4bdb52.tar.gz
emacs-1908d2aefb2175875b837bafa1a4f1299a4bdb52.zip
New macro connection-local-value
* doc/lispref/variables.texi (Applying Connection Local Variables): Add macro 'connection-local-value'. * etc/NEWS: Add macro 'connection-local-value'. * lisp/files-x.el (connection-local-value): New macro. (path-separator, null-device): Use it. * test/lisp/files-x-tests.el (files-x-test-connection-local-value): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/files-x-tests.el61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el
index 4e14ae68fb8..795d03a071d 100644
--- a/test/lisp/files-x-tests.el
+++ b/test/lisp/files-x-tests.el
@@ -482,5 +482,66 @@ If it's not initialized yet, initialize it."
482 `(connection-local-profile-alist ',clpa now) 482 `(connection-local-profile-alist ',clpa now)
483 `(connection-local-criteria-alist ',clca now)))) 483 `(connection-local-criteria-alist ',clca now))))
484 484
485(ert-deftest files-x-test-connection-local-value ()
486 "Test getting connection-local values."
487
488 (let ((clpa connection-local-profile-alist)
489 (clca connection-local-criteria-alist))
490 (connection-local-set-profile-variables
491 'remote-bash files-x-test--variables1)
492 (connection-local-set-profile-variables
493 'remote-ksh files-x-test--variables2)
494 (connection-local-set-profile-variables
495 'remote-nullfile files-x-test--variables3)
496
497 (connection-local-set-profiles
498 nil 'remote-ksh 'remote-nullfile)
499
500 (connection-local-set-profiles
501 files-x-test--application 'remote-bash)
502
503 (with-temp-buffer
504 ;; We need a remote `default-directory'.
505 (let ((enable-connection-local-variables t)
506 (default-directory "/method:host:")
507 (remote-null-device "null"))
508 (should-not connection-local-variables-alist)
509 (should-not (local-variable-p 'remote-shell-file-name))
510 (should-not (local-variable-p 'remote-null-device))
511 (should-not (boundp 'remote-shell-file-name))
512 (should (string-equal (symbol-value 'remote-null-device) "null"))
513
514 ;; The proper variable values are set.
515 (should
516 (string-equal
517 (connection-local-value remote-shell-file-name) "/bin/ksh"))
518 (should
519 (string-equal
520 (connection-local-value remote-null-device) "/dev/null"))
521
522 ;; Run with a different application.
523 (should
524 (string-equal
525 (connection-local-value
526 remote-shell-file-name (cadr files-x-test--application))
527 "/bin/bash"))
528 (should
529 (string-equal
530 (connection-local-value
531 remote-null-device (cadr files-x-test--application))
532 "/dev/null"))
533
534 ;; The previous bindings haven't changed.
535 (should-not connection-local-variables-alist)
536 (should-not (local-variable-p 'remote-shell-file-name))
537 (should-not (local-variable-p 'remote-null-device))
538 (should-not (boundp 'remote-shell-file-name))
539 (should (string-equal (symbol-value 'remote-null-device) "null"))))
540
541 ;; Cleanup.
542 (custom-set-variables
543 `(connection-local-profile-alist ',clpa now)
544 `(connection-local-criteria-alist ',clca now))))
545
485(provide 'files-x-tests) 546(provide 'files-x-tests)
486;;; files-x-tests.el ends here 547;;; files-x-tests.el ends here