]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problems in tramp-test33-environment-variables
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 13 Sep 2019 10:08:34 +0000 (12:08 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 13 Sep 2019 10:08:34 +0000 (12:08 +0200)
* test/lisp/net/tramp-tests.el (tramp-test33-environment-variables):
Use ${parameter:-word} construct.  Remove PS1 entry from
"printenv" output.
(tramp--test-check-files): Use "printenv".

test/lisp/net/tramp-tests.el

index dd6b9edd00058cf6ee9e84bf5ee343a72d5055c3..1554d3b70b18acaadcc61cbcd0480bfbd2ec254b 100644 (file)
@@ -4407,7 +4407,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
              "foo"
              (funcall
               this-shell-command-to-string
-              (format "echo -n ${%s:?bla}" envvar))))))
+              (format "echo -n ${%s:-bla}" envvar))))))
 
       (unwind-protect
          ;; Set the empty value.
@@ -4419,7 +4419,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
              "bla"
              (funcall
               this-shell-command-to-string
-              (format "echo -n ${%s:?bla}" envvar))))
+              (format "echo -n ${%s:-bla}" envvar))))
            ;; Variable is set.
            (should
             (string-match
@@ -4441,7 +4441,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
              "foo"
              (funcall
               this-shell-command-to-string
-              (format "echo -n ${%s:?bla}" envvar))))
+              (format "echo -n ${%s:-bla}" envvar))))
            (let ((process-environment
                   (cons envvar process-environment)))
              ;; Variable is unset.
@@ -4450,12 +4450,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
                "bla"
                (funcall
                 this-shell-command-to-string
-                (format "echo -n ${%s:?bla}" envvar))))
+                (format "echo -n ${%s:-bla}" envvar))))
              ;; Variable is unset.
              (should-not
               (string-match
                (regexp-quote envvar)
-               (funcall this-shell-command-to-string "env")))))))))
+               ;; 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 ()
@@ -5303,7 +5305,7 @@ This requires restrictions of file name syntax."
                  ;; of process output.  So we unset it temporarily.
                  (setenv "PS1")
                  (with-temp-buffer
-                   (should (zerop (process-file "env" nil t nil)))
+                   (should (zerop (process-file "printenv" nil t nil)))
                    (goto-char (point-min))
                    (should
                     (re-search-forward