diff options
author | Basil L. Contovounesios <contovob@tcd.ie> | 2023-04-10 10:23:06 +0100 |
---|---|---|
committer | Basil L. Contovounesios <contovob@tcd.ie> | 2023-04-10 10:23:06 +0100 |
commit | 44cc54e409943275f4a600136bf5136e9c655626 (patch) | |
tree | 73d7a6800c21de3f9816808f0b90a3a64cd6a1cb /test | |
parent | b5c5e923dba5c5a7b064ce3371d13e165b5caa9e (diff) | |
download | emacs-44cc54e409943275f4a600136bf5136e9c655626.tar.gz |
Tweak file/dir creation in eglot-tests
* test/lisp/progmodes/eglot-tests.el (eglot--make-file-or-dir):
Expand file name only once, under default-directory, avoiding
duplicate dir separators. Ensure default-directory ends with a dir
separator. Use with-temp-file. (Bug#61637)
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/progmodes/eglot-tests.el | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 86e7b21def0..0486c938558 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -70,17 +70,16 @@ directory hierarchy." `(eglot--call-with-fixture ,fixture (lambda () ,@body))) (defun eglot--make-file-or-dir (ass) - (let ((file-or-dir-name (car ass)) + (let ((file-or-dir-name (expand-file-name (car ass))) (content (cdr ass))) (cond ((listp content) (make-directory file-or-dir-name 'parents) - (let ((default-directory (concat default-directory "/" file-or-dir-name))) + (let ((default-directory (file-name-as-directory file-or-dir-name))) (mapcan #'eglot--make-file-or-dir content))) ((stringp content) - (with-temp-buffer - (insert content) - (write-region nil nil file-or-dir-name nil 'nomessage)) - (list (expand-file-name file-or-dir-name))) + (with-temp-file file-or-dir-name + (insert content)) + (list file-or-dir-name)) (t (eglot--error "Expected a string or a directory spec"))))) |