emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2db70ed: Adapt Tramp tests


From: Michael Albinus
Subject: master 2db70ed: Adapt Tramp tests
Date: Mon, 4 May 2020 07:09:40 -0400 (EDT)

branch: master
commit 2db70edd9cc8b52cb32c97fe2ff0ae008f02a31c
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Adapt Tramp tests
    
    * test/lisp/net/tramp-tests.el (tramp-test33-environment-variables):
    Adapt test.
---
 test/lisp/net/tramp-tests.el | 118 +++++++++++++++++++++++--------------------
 1 file changed, 62 insertions(+), 56 deletions(-)

diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 75a0167..28d20e3 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4869,65 +4869,71 @@ INPUT, if non-nil, is a string sent to the process."
          (envvar (concat "VAR_" (upcase (md5 (current-time-string)))))
          kill-buffer-query-functions)
 
-      (unwind-protect
-         ;; Set a value.
-         (let ((process-environment
-                (cons (concat envvar "=foo") process-environment)))
-           ;; Default value.
-           (should
-            (string-match
-             "foo"
-             (funcall
-              this-shell-command-to-string
-              (format "echo -n ${%s:-bla}" envvar))))))
-
-      (unwind-protect
-         ;; Set the empty value.
-         (let ((process-environment
-                (cons (concat envvar "=") process-environment)))
-           ;; Value is null.
-           (should
-            (string-match
-             "bla"
-             (funcall
-              this-shell-command-to-string
-              (format "echo -n ${%s:-bla}" envvar))))
-           ;; Variable is set.
-           (should
-            (string-match
-             (regexp-quote envvar)
-             (funcall this-shell-command-to-string "set")))))
+      ;; Check INSIDE_EMACS.
+      (should
+       (string-equal
+       (format "%s,tramp:%s" emacs-version tramp-version)
+       (funcall this-shell-command-to-string "echo -n ${INSIDE_EMACS:-bla}")))
+      (let ((process-environment
+            (cons (format "INSIDE_EMACS=%s,foo" emacs-version)
+                  process-environment)))
+       (should
+        (string-equal
+         (format "%s,foo,tramp:%s" emacs-version tramp-version)
+         (funcall
+          this-shell-command-to-string "echo -n ${INSIDE_EMACS:-bla}"))))
+
+      ;; Set a value.
+      (let ((process-environment
+            (cons (concat envvar "=foo") process-environment)))
+       ;; Default value.
+       (should
+        (string-match
+         "foo"
+         (funcall
+          this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar)))))
+
+      ;; Set the empty value.
+      (let ((process-environment
+            (cons (concat envvar "=") process-environment)))
+       ;; Value is null.
+       (should
+        (string-match
+         "bla"
+         (funcall
+          this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar))))
+       ;; Variable is set.
+       (should
+        (string-match
+         (regexp-quote envvar)
+         (funcall this-shell-command-to-string "set"))))
 
       ;; We force a reconnect, in order to have a clean environment.
       (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
-      (unwind-protect
-         ;; Unset the variable.
-         (let ((tramp-remote-process-environment
-                (cons (concat envvar "=foo")
-                      tramp-remote-process-environment)))
-           ;; Set the initial value, we want to unset below.
-           (should
-            (string-match
-             "foo"
-             (funcall
-              this-shell-command-to-string
-              (format "echo -n ${%s:-bla}" envvar))))
-           (let ((process-environment
-                  (cons envvar process-environment)))
-             ;; Variable is unset.
-             (should
-              (string-match
-               "bla"
-               (funcall
-                this-shell-command-to-string
-                (format "echo -n ${%s:-bla}" envvar))))
-             ;; Variable is unset.
-             (should-not
-              (string-match
-               (regexp-quote envvar)
-               ;; We must remove PS1, the output is truncated otherwise.
-               (funcall
-                this-shell-command-to-string "printenv | grep -v PS1")))))))))
+      ;; Unset the variable.
+      (let ((tramp-remote-process-environment
+            (cons (concat envvar "=foo") tramp-remote-process-environment)))
+       ;; Set the initial value, we want to unset below.
+       (should
+        (string-match
+         "foo"
+         (funcall
+          this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar))))
+       (let ((process-environment (cons envvar process-environment)))
+         ;; Variable is unset.
+         (should
+          (string-match
+           "bla"
+           (funcall
+            this-shell-command-to-string
+            (format "echo -n ${%s:-bla}" envvar))))
+         ;; Variable is unset.
+         (should-not
+          (string-match
+           (regexp-quote envvar)
+           ;; We must remove PS1, the output is truncated otherwise.
+           (funcall
+            this-shell-command-to-string "printenv | grep -v PS1"))))))))
 
 ;; This test is inspired by Bug#27009.
 (ert-deftest tramp-test33-environment-variables-and-port-numbers ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]