1 ;;; emacsclient-tests.el --- Test emacsclient
3 ;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
28 (defconst emacsclient-test-emacs
29 (if installation-directory
30 (expand-file-name "lib-src/emacsclient" installation-directory
)
32 "The emacsclient binary to test.")
34 (defmacro emacsclient-test-call-emacsclient
(editor)
35 "Run emacsclient with ALTERNATE_EDITOR set to EDITOR."
36 `(let* ((process-environment
37 (cons (concat "ALTERNATE_EDITOR=" ,editor
) process-environment
))
38 (stat (call-process emacsclient-test-emacs nil nil nil
40 (expand-file-name "non-existent-file"
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 "Profiling" stat
))))
47 (should (eq 0 stat
))))
49 (ert-deftest emacsclient-test-alternate-editor-allows-arguments
()
50 (emacsclient-test-call-emacsclient
51 (concat (expand-file-name invocation-name invocation-directory
) " --batch")))
53 (ert-deftest emacsclient-test-alternate-editor-allows-quotes
()
54 (emacsclient-test-call-emacsclient
55 (concat "\"" (expand-file-name invocation-name invocation-directory
)
58 (provide 'emacsclient-tests
)
59 ;;; emacsclient-tests.el ends here