From: "Daniel Martín" <mardani29@yahoo.es>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Fix some failing tests in BSD systems
Date: Sun, 03 Jan 2021 22:08:56 +0100 [thread overview]
Message-ID: <m1h7nx20ev.fsf@yahoo.es> (raw)
In-Reply-To: <83a6tpdiuf.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 Jan 2021 19:35:20 +0200")
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Daniel Martín <mardani29@yahoo.es>
>> Date: Sun, 03 Jan 2021 18:16:46 +0100
>>
>> (ert-deftest xref--xref-file-name-display-is-abs ()
>> - (let ((xref-file-name-display 'abs))
>> - (should (equal (delete-dups
>> - (mapcar 'xref-location-group
>> - (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
>> - (list
>> - (concat xref-tests--data-dir "file1.txt")
>> - (concat xref-tests--data-dir "file2.txt"))))))
>> + (let ((xref-file-name-display 'abs)
>> + ;; BSD find may add an extra '/' to the path.
>> + (expected (list
>> + (concat xref-tests--data-dir "/?file1.txt")
>> + (concat xref-tests--data-dir "/?file2.txt")))
>
> Why are we producing file names by concatenation, instead of calling
> expand-file-name? Wouldn't using the latter solve the problem? Or
> what did I miss?
Yes. I've attached another solution in terms of expand-file-name and
file-relative-name.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-some-xref-tests-for-systems-with-BSD-find.patch --]
[-- Type: text/x-patch, Size: 2608 bytes --]
From 4a6eabf615d6b82d4dc570afe801833dd03295ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Sun, 3 Jan 2021 21:49:22 +0100
Subject: [PATCH] Fix some xref-tests for systems with BSD find
Some versions of BSD find, like those present on macOS systems, may
return a file path with two intermediate
slashes (eg. "path/to//resource"). As this is valid POSIX, just make
the tests build their paths in a more portable way.
---
test/lisp/progmodes/xref-tests.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el
index eaafc5888c..32cb2960a1 100644
--- a/test/lisp/progmodes/xref-tests.el
+++ b/test/lisp/progmodes/xref-tests.el
@@ -101,11 +101,13 @@ xref--buf-pairs-iterator-cleans-up-markers
(ert-deftest xref--xref-file-name-display-is-abs ()
(let ((xref-file-name-display 'abs))
(should (equal (delete-dups
- (mapcar 'xref-location-group
- (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
+ (mapcar
+ (lambda (e)
+ (expand-file-name (xref-location-group e)))
+ (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
- (concat xref-tests--data-dir "file1.txt")
- (concat xref-tests--data-dir "file2.txt"))))))
+ (expand-file-name "file1.txt" xref-tests--data-dir)
+ (expand-file-name "file2.txt" xref-tests--data-dir))))))
(ert-deftest xref--xref-file-name-display-is-nondirectory ()
(let ((xref-file-name-display 'nondirectory))
@@ -121,10 +123,12 @@ xref--xref-file-name-display-is-relative-to-project-root
(file-name-directory (directory-file-name xref-tests--data-dir)))
(project-find-functions
#'(lambda (_) (cons 'transient data-parent-dir)))
- (xref-file-name-display 'project-relative))
+ (xref-file-name-display 'project-relative))
(should (equal (delete-dups
- (mapcar 'xref-location-group
- (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
+ (mapcar
+ (lambda (e)
+ (file-relative-name (xref-location-group e)))
+ (xref-tests--locations-in-data-dir "\\(bar\\|foo\\)")))
(list
"xref-resources/file1.txt"
"xref-resources/file2.txt")))))
--
2.28.0
next prev parent reply other threads:[~2021-01-03 21:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m1sg7i7xfl.fsf.ref@yahoo.es>
2021-01-03 17:16 ` [PATCH] Fix some failing tests in BSD systems Daniel Martín
2021-01-03 17:35 ` Eli Zaretskii
2021-01-03 21:08 ` Daniel Martín [this message]
2021-01-04 1:41 ` Dmitry Gutov
2021-01-04 3:30 ` Eli Zaretskii
2021-01-04 13:10 ` Dmitry Gutov
2021-01-04 15:52 ` Eli Zaretskii
2021-01-04 17:10 ` Dmitry Gutov
2021-01-04 22:25 ` Daniel Martín
2021-01-06 1:38 ` Dmitry Gutov
2021-01-06 9:41 ` Daniel Martín
2021-01-06 17:17 ` Dmitry Gutov
2021-01-06 18:48 ` Stefan Monnier
2021-01-06 21:17 ` Dmitry Gutov
2021-01-04 1:43 ` Dmitry Gutov
2021-01-04 3:48 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1h7nx20ev.fsf@yahoo.es \
--to=mardani29@yahoo.es \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.