aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib-src')
-rw-r--r--test/lib-src/emacsclient-tests.el35
1 files changed, 19 insertions, 16 deletions
diff --git a/test/lib-src/emacsclient-tests.el b/test/lib-src/emacsclient-tests.el
index 3a2396f7817..4b7fa47989d 100644
--- a/test/lib-src/emacsclient-tests.el
+++ b/test/lib-src/emacsclient-tests.el
@@ -31,26 +31,29 @@
31 "emacsclient") 31 "emacsclient")
32 "The emacsclient binary to test.") 32 "The emacsclient binary to test.")
33 33
34(defun emacsclient-test-call-emacsclient () 34(defmacro emacsclient-test-call-emacsclient (editor)
35 "Run emacsclient." 35 "Run emacsclient with ALTERNATE_EDITOR set to EDITOR."
36 (call-process emacsclient-test-emacs nil nil nil 36 `(let* ((process-environment
37 "--server-file" (expand-file-name "non-existent-file" invocation-directory) 37 (cons (concat "ALTERNATE_EDITOR=" ,editor) process-environment))
38 "foo")) 38 (stat (call-process emacsclient-test-emacs nil nil nil
39 "--server-file"
40 (expand-file-name "non-existent-file"
41 invocation-directory)
42 "foo")))
43 ;; Skip if emacsclient was compiled with -pg (bug#28319).
44 ;; Use ert--skip-unless rather than skip-unless to silence compiler.
45 (ert--skip-unless (not (and (stringp stat)
46 (string-match-p "rofiling" stat))))
47 (should (eq 0 stat))))
39 48
40(ert-deftest emacsclient-test-alternate-editor-allows-arguments () 49(ert-deftest emacsclient-test-alternate-editor-allows-arguments ()
41 (let ((process-environment process-environment)) 50 (emacsclient-test-call-emacsclient
42 (setenv "ALTERNATE_EDITOR" (concat 51 (concat (expand-file-name invocation-name invocation-directory) " --batch")))
43 (expand-file-name invocation-name invocation-directory)
44 " --batch"))
45 (should (eq 0 (emacsclient-test-call-emacsclient)))))
46 52
47(ert-deftest emacsclient-test-alternate-editor-allows-quotes () 53(ert-deftest emacsclient-test-alternate-editor-allows-quotes ()
48 (let ((process-environment process-environment)) 54 (emacsclient-test-call-emacsclient
49 (setenv "ALTERNATE_EDITOR" (concat 55 (concat "\"" (expand-file-name invocation-name invocation-directory)
50 "\"" 56 "\"" " --batch")))
51 (expand-file-name invocation-name invocation-directory)
52 "\"" " --batch"))
53 (should (eq 0 (emacsclient-test-call-emacsclient)))))
54 57
55(provide 'emacsclient-tests) 58(provide 'emacsclient-tests)
56;;; emacsclient-tests.el ends here 59;;; emacsclient-tests.el ends here