summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2019-04-17 11:42:06 +0200
committerMichael Albinus <michael.albinus@gmx.de>2019-04-17 11:42:06 +0200
commit7e07bb2d2911f1a1dd3696227187501d7b7278a9 (patch)
treef7d4c0574b38a6c8aa597335e330792c0df10b37 /test
parentacec59c9f9c6d552c54ad448f4be898d8ee36f31 (diff)
downloademacs-7e07bb2d2911f1a1dd3696227187501d7b7278a9.tar.gz
Test `shell-command-width' in Tramp
* test/lisp/net/tramp-tests.el (tramp--test-shell-command-to-string-asynchronously): Move up. (tramp-test32-shell-command): Test `shell-command-width'.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/tramp-tests.el42
1 files changed, 32 insertions, 10 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index cc3200be948..64eb1ddefd8 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4079,6 +4079,16 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-process proc)))))
+(defun tramp--test-shell-command-to-string-asynchronously (command)
+ "Like `shell-command-to-string', but for asynchronous processes."
+ (with-temp-buffer
+ (async-shell-command command (current-buffer))
+ (with-timeout
+ ((if (getenv "EMACS_EMBA_CI") 30 10) (tramp--test-timeout-handler))
+ (while (accept-process-output
+ (get-buffer-process (current-buffer)) nil nil t)))
+ (buffer-substring-no-properties (point-min) (point-max))))
+
(ert-deftest tramp-test32-shell-command ()
"Check `shell-command'."
:tags '(:expensive-test)
@@ -4094,6 +4104,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Suppress nasty messages.
(inhibit-message t)
kill-buffer-query-functions)
+
+ ;; Test ordinary `shell-command'.
(unwind-protect
(with-temp-buffer
(write-region "foo" nil tmp-name)
@@ -4114,6 +4126,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-file tmp-name)))
+ ;; Test ordinary `async-shell-command'.
(unwind-protect
(with-temp-buffer
(write-region "foo" nil tmp-name)
@@ -4142,6 +4155,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-file tmp-name)))
+ ;; Test sending string to `async-shell-command'.
(unwind-protect
(with-temp-buffer
(write-region "foo" nil tmp-name)
@@ -4169,17 +4183,25 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(buffer-string))))
;; Cleanup.
- (ignore-errors (delete-file tmp-name))))))
+ (ignore-errors (delete-file tmp-name)))
-(defun tramp--test-shell-command-to-string-asynchronously (command)
- "Like `shell-command-to-string', but for asynchronous processes."
- (with-temp-buffer
- (async-shell-command command (current-buffer))
- (with-timeout
- ((if (getenv "EMACS_EMBA_CI") 30 10) (tramp--test-timeout-handler))
- (while (accept-process-output
- (get-buffer-process (current-buffer)) nil nil t)))
- (buffer-substring-no-properties (point-min) (point-max))))
+ ;; Test `shell-command-width' of `async-shell-command'.
+ (when (tramp--test-sh-p)
+ (let (shell-command-width)
+ (should
+ (string-equal
+ ;; `frame-width' does not return a proper value.
+ ;; `process-lines' uses `call-process', it doesn't care
+ ;; about `shell-command-width'.
+ (format "%s\n" (car (process-lines "tput" "cols")))
+ (tramp--test-shell-command-to-string-asynchronously
+ "tput cols")))
+ (setq shell-command-width 1024)
+ (should
+ (string-equal
+ "1024\n"
+ (tramp--test-shell-command-to-string-asynchronously
+ "tput cols"))))))))
;; This test is inspired by Bug#23952.
(ert-deftest tramp-test33-environment-variables ()