[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached 200da6a619 08/22: Fix broken tests
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached 200da6a619 08/22: Fix broken tests |
Date: |
Mon, 30 May 2022 10:57:30 -0400 (EDT) |
branch: externals/detached
commit 200da6a61999199f52102c63754d0c96d95c6a84
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Fix broken tests
---
detached.el | 10 ++++----
test/detached-test.el | 64 ++++++++++++++++++++++-----------------------------
2 files changed, 32 insertions(+), 42 deletions(-)
diff --git a/detached.el b/detached.el
index 045ee462f0..d6741a72c9 100644
--- a/detached.el
+++ b/detached.el
@@ -1162,12 +1162,12 @@ If SESSION is non-attachable fallback to a command that
doesn't rely on tee."
(format "&> %s" log)))
(env (format "%s -c" detached-shell-program))
(command
- (if (eq 'terminal-data (detached--session-env-mode session))
- (shell-quote-argument
- (format "if %s; then true; else echo \"[detached-exit-code:
$?]\"; fi"
+ (shell-quote-argument
+ (format "if %s; then true; else echo \"[detached-exit-code: $?]\";
fi"
+ (if (eq 'terminal-data (detached--session-env-mode session))
(format "TERM=eterm-color script --quiet --flush
--return --command \"%s\" /dev/null"
- (detached--session-command session))))
- (shell-quote-argument (detached--session-command session)))))
+ (detached--session-command session))
+ (detached--session-command session))))))
(format "%s %s %s; %s %s" begin-shell-group env command end-shell-group
redirect)))
(defun detached--env-mode (command)
diff --git a/test/detached-test.el b/test/detached-test.el
index c177056a0a..9e3dbb1a54 100644
--- a/test/detached-test.el
+++ b/test/detached-test.el
@@ -34,8 +34,7 @@
(detached-db-directory (expand-file-name "detached.db"
temp-directory))
(detached-session-directory (expand-file-name "sessions"
temp-directory))
(detached--sessions)
- (detached--sessions-initialized)
- (detached--remote-session-timer))
+ (detached--sessions-initialized))
(unwind-protect
(progn
(detached-initialize-sessions)
@@ -68,28 +67,27 @@
(ert-deftest detached-test-dtach-command ()
(detached-test--with-temp-database
(cl-letf* ((detached-dtach-program "dtach")
- (detached-env "detached-env")
(detached-shell-program "bash")
(session (detached-create-session "ls -la"))
(detached-show-output-on-attach t)
(detached-show-output-command "/bin/cat")
((symbol-function #'detached-create-session)
(lambda (_)
- session)))
+ session))
+ ((symbol-function #'detached--detached-command)
+ (lambda (_)
+ (format "{ detached-command }"))))
(let* ((detached-session-mode 'create-and-attach)
(expected `(,detached-dtach-program
"-c" ,(detached--session-file session 'socket t)
"-z" ,detached-shell-program
"-c"
- ,(format "{ detached-env terminal-data ls\\ -la; }
2>&1 | tee %s"
- (detached--session-file session 'log t))))
+ "{ detached-command }"))
(expected-concat (format "%s -c %s -z %s -c %s"
detached-dtach-program
(detached--session-file session 'socket t)
detached-shell-program
- (shell-quote-argument
- (format "{ detached-env terminal-data
ls\\ -la; } 2>&1 | tee %s"
- (detached--session-file session
'log t))))))
+ "\\{\\ detached-command\\ \\}")))
(should (equal expected (detached-dtach-command session)))
(should (equal expected-concat (detached-dtach-command session t))))
(let* ((detached-session-mode 'attach)
@@ -189,8 +187,7 @@
(ert-deftest detached-test-db-remove-session ()
(detached-test--with-temp-database
- (let* ((host '(:type local :name "host"))
- (session1 (detached-test--create-session :command "foo" :host
'("host" . local)))
+ (let* ((session1 (detached-test--create-session :command "foo" :host
'("host" . local)))
(session2 (detached-test--create-session :command "bar" :host
'("host" . local))))
(should (seq-set-equal-p `(,session1 ,session2)
(detached--db-get-sessions)))
(detached--db-remove-entry session1)
@@ -208,32 +205,25 @@
(should (equal copy (car (detached--db-get-sessions)))))))
(ert-deftest detached-test-detached-command ()
- (let ((attachable-session (detached--session-create :directory
"/tmp/detached/"
- :working-directory
"/home/user/"
- :command "ls -la"
- :attachable t
- :env-mode 'terminal-data
- :id 'foo123))
- (nonattachable-session (detached--session-create :directory
"/tmp/detached/"
- :working-directory
"/home/user/"
- :command "ls -la"
- :attachable nil
- :env-mode 'plain-text
- :id 'foo123)))
- ;; With detached-env
- (let ((detached-env "detached-env"))
- (should (string= "{ detached-env terminal-data ls\\ -la; } 2>&1 | tee
/tmp/detached/foo123.log"
- (detached--detached-command attachable-session)))
- (should (string= "{ detached-env plain-text ls\\ -la; } &>
/tmp/detached/foo123.log"
- (detached--detached-command nonattachable-session))))
-
- ;; Without detached-env
- (let ((detached-env nil)
- (detached-shell-program "bash"))
- (should (string= "{ bash -c ls\\ -la; } 2>&1 | tee
/tmp/detached/foo123.log"
- (detached--detached-command attachable-session)))
- (should (string= "{ bash -c ls\\ -la; } &> /tmp/detached/foo123.log"
- (detached--detached-command nonattachable-session))))))
+ (let ((detached-shell-program "bash")
+ (attachable-terminal-data-session
+ (detached--session-create :directory "/tmp/detached/"
+ :working-directory "/home/user/"
+ :command "ls -la"
+ :attachable t
+ :env-mode 'terminal-data
+ :id 'foo123))
+ (nonattachable-plain-text-session
+ (detached--session-create :directory "/tmp/detached/"
+ :working-directory "/home/user/"
+ :command "ls -la"
+ :attachable nil
+ :env-mode 'plain-text
+ :id 'foo123)))
+ (should (string= "{ bash -c if\\ TERM\\=eterm-color\\ script\\ --quiet\\
--flush\\ --return\\ --command\\ \\\"ls\\ -la\\\"\\ /dev/null\\;\\ then\\
true\\;\\ else\\ echo\\ \\\"\\[detached-exit-code\\:\\ \\$\\?\\]\\\"\\;\\ fi; }
2>&1 | tee /tmp/detached/foo123.log"
+ (detached--detached-command
attachable-terminal-data-session)))
+ (should (string= "{ bash -c if\\ ls\\ -la\\;\\ then\\ true\\;\\ else\\
echo\\ \\\"\\[detached-exit-code\\:\\ \\$\\?\\]\\\"\\;\\ fi; } &>
/tmp/detached/foo123.log"
+ (detached--detached-command
nonattachable-plain-text-session)))))
(ert-deftest detached-test-attachable-command-p ()
(let ((detached-nonattachable-commands '("ls")))
- [elpa] externals/detached updated (f08110df57 -> bae90a13dd), ELPA Syncer, 2022/05/30
- [elpa] externals/detached 640ad8a8dd 07/22: Remove the need for detached-shell-history-file, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 98b80a487c 06/22: Update detached failure message, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 6f825c56e7 10/22: Fix read-only error, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 1b99b04fd2 02/22: Remove comment in detached-env, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 0e40156cf5 03/22: Move eterm-color into detached.el, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 10220f8663 01/22: Move detached-env mode into detached.el, ELPA Syncer, 2022/05/30
- [elpa] externals/detached e55cf27103 14/22: Remove detached-env file, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 200da6a619 08/22: Fix broken tests,
ELPA Syncer <=
- [elpa] externals/detached f3ee65f6c9 15/22: Rename env-mode to env, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 532f2030c2 16/22: Update broken test, ELPA Syncer, 2022/05/30
- [elpa] externals/detached bae90a13dd 22/22: Remove unnecessary with-connection-local-variables, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 10cf120383 19/22: Bug fix: Address bugs in detached--db-directory-event, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 3feae45d28 04/22: Add success check in detached.el, ELPA Syncer, 2022/05/30
- [elpa] externals/detached cfe69e4978 09/22: Add detached-terminal-data-command, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 636c273039 11/22: Update README, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 0224d2961a 13/22: Update message-filter function, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 33d31b1619 17/22: Add command to open session log file in dired, ELPA Syncer, 2022/05/30
- [elpa] externals/detached 6ea2bb38c6 18/22: Update CHANGELOG, ELPA Syncer, 2022/05/30