[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5d245e9d0d8: Fix image-dired-util-tests on MS-Windows
From: |
Eli Zaretskii |
Subject: |
master 5d245e9d0d8: Fix image-dired-util-tests on MS-Windows |
Date: |
Thu, 27 Jul 2023 03:28:47 -0400 (EDT) |
branch: master
commit 5d245e9d0d85bc85bacd701d6fe82620816b2e1f
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix image-dired-util-tests on MS-Windows
* test/lisp/image/image-dired-util-tests.el
(image-dired-thumb-name/image-dired)
(image-dired-thumb-name/per-directory): Make these tests work on
MS-Windows, where a file name such as "/foo/bar" gets added the
drive letter when passed through 'expand-file-name'.
---
test/lisp/image/image-dired-util-tests.el | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/test/lisp/image/image-dired-util-tests.el
b/test/lisp/image/image-dired-util-tests.el
index bd3d65bdd3a..1f3747a82b1 100644
--- a/test/lisp/image/image-dired-util-tests.el
+++ b/test/lisp/image/image-dired-util-tests.el
@@ -47,10 +47,11 @@
(should (equal
(file-name-directory (image-dired-thumb-name "foo.jpg"))
(file-name-directory (image-dired-thumb-name "/tmp/foo.jpg"))))
- (should (equal (file-name-nondirectory
- ;; The checksum is based on the file name.
- (image-dired-thumb-name "/some/path/foo.jpg"))
- "dc4e6f7068157023e7f2e8362d15bdd2e3ca89e4.jpg"))
+ (should
+ (let* ((test-fn "/some/path/foo.jpg")
+ (thumb-fn (image-dired-thumb-name test-fn)))
+ (equal (file-name-nondirectory thumb-fn)
+ (concat (sha1 (expand-file-name test-fn)) ".jpg"))))
(should (equal (file-name-extension
(image-dired-thumb-name "foo.gif"))
"jpg")))))
@@ -62,8 +63,12 @@
(should (equal
(file-name-nondirectory (image-dired-thumb-name "foo.jpg"))
(file-name-nondirectory (image-dired-thumb-name "/tmp/foo.jpg"))))
- (should (equal (file-name-split (image-dired-thumb-name "/tmp/foo.jpg"))
- '("" "tmp" ".image-dired" "foo.jpg.thumb.jpg")))
+ ;; The cdr below avoids the system dependency in the car of the
+ ;; list returned by 'file-name-split': it's "" on Posix systems,
+ ;; but the drive letter on MS-Windows.
+ (should (equal (cdr (file-name-split
+ (image-dired-thumb-name "/tmp/foo.jpg")))
+ '("tmp" ".image-dired" "foo.jpg.thumb.jpg")))
(should (equal (file-name-nondirectory
(image-dired-thumb-name "foo.jpg"))
"foo.jpg.thumb.jpg"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 5d245e9d0d8: Fix image-dired-util-tests on MS-Windows,
Eli Zaretskii <=