aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorEli Zaretskii2025-05-11 15:47:17 +0300
committerEli Zaretskii2025-05-11 15:47:17 +0300
commit7d84ffc2ded59a1d32b902cf7487a6486e0d9869 (patch)
treead6aec902f4ba2ec12b96238888b4c73b771dabe /test/src
parent3975094f1d96680fe73232ca4216733904ebecd0 (diff)
downloademacs-7d84ffc2ded59a1d32b902cf7487a6486e0d9869.tar.gz
emacs-7d84ffc2ded59a1d32b902cf7487a6486e0d9869.zip
Add test for file time-stamp granularity on MS-Windows
* test/src/fileio-tests.el (fileio-tests-w32-time-stamp-granularity): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fileio-tests.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index c2938c4900e..13cc5de29e8 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -217,4 +217,23 @@ Also check that an encoding error can appear in a symlink."
217 (should-not (file-exists-p "//")) 217 (should-not (file-exists-p "//"))
218 (should (file-attributes "//"))) 218 (should (file-attributes "//")))
219 219
220(ert-deftest fileio-tests-w32-time-stamp-granularity ()
221 "Test 100-nsec granularity of file time stamps on MS-Windows."
222 (skip-unless (eq system-type 'windows-nt))
223 ;; FIXME: This only works on NTFS volumes, so should skip the test if
224 ;; not NTFS. But we don't expose the filesystem type to Lisp.
225 (let ((tfile (make-temp-file "tstamp")))
226 (unwind-protect
227 (progn
228 (set-file-times tfile (encode-time '(59.123456789 15 23 01 02 2025)))
229 (should
230 (equal (format-time-string "%Y/%m/%d %H:%M:%S.%N"
231 (file-attribute-modification-time
232 (file-attributes tfile)))
233 ;; Last 2 digits of seconds must be zero due to
234 ;; 100-nsec resolution of Windows file time stamps.
235 "2025/02/01 23:15:59.123456700")))
236 (delete-file tfile))))
237
238
220;;; fileio-tests.el ends here 239;;; fileio-tests.el ends here