diff src/testdir/test_stat.vim @ 25953:d7e1cf30728c v8.2.3510

patch 8.2.3510: changes are only detected with one second accuracy Commit: https://github.com/vim/vim/commit/0a7984af5601323fae7b3398f05a48087db7b767 Author: Leah Neukirchen <leah@vuxu.org> Date: Thu Oct 14 21:27:55 2021 +0100 patch 8.2.3510: changes are only detected with one second accuracy Problem: Changes are only detected with one second accuracy. Solution: Use the nanosecond time if possible. (Leah Neukirchen, closes #8873, closes #8875)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Oct 2021 22:30:04 +0200
parents 08940efa6b4e
children 08f63df32e8e
line wrap: on
line diff
--- a/src/testdir/test_stat.vim
+++ b/src/testdir/test_stat.vim
@@ -76,6 +76,39 @@ func Test_checktime()
   call delete(fname)
 endfunc
 
+func Test_checktime_fast()
+  CheckFeature nanotime
+
+  let fname = 'Xtest.tmp'
+
+  let fl = ['Hello World!']
+  call writefile(fl, fname)
+  set autoread
+  exec 'e' fname
+  let fl = readfile(fname)
+  let fl[0] .= ' - checktime'
+  call writefile(fl, fname)
+  checktime
+  call assert_equal(fl[0], getline(1))
+
+  call delete(fname)
+endfunc
+
+func Test_autoread_fast()
+  CheckFeature nanotime
+
+  new Xautoread
+  set autoread
+  call setline(1, 'foo')
+
+  w!
+  silent !echo bar > Xautoread
+  checktime
+
+  call assert_equal('bar', trim(getline(1)))
+  call delete('Xautoread')
+endfunc
+
 func Test_autoread_file_deleted()
   new Xautoread
   set autoread