summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-10-14 21:27:55 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-14 21:27:55 +0100
commit0a7984af5601323fae7b3398f05a48087db7b767 (patch)
tree22efd296a4db294d3e9288c5d2085c1a5679ae82 /src/testdir
parent340dd0fbe462a15a9678cfba02085b4adcc45f02 (diff)
downloadvim-git-0a7984af5601323fae7b3398f05a48087db7b767.tar.gz
patch 8.2.3510: changes are only detected with one second accuracyv8.2.3510
Problem: Changes are only detected with one second accuracy. Solution: Use the nanosecond time if possible. (Leah Neukirchen, closes #8873, closes #8875)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_stat.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/testdir/test_stat.vim b/src/testdir/test_stat.vim
index 5cd82b8e2..b56528192 100644
--- 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