diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-02-13 21:58:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-13 21:58:36 +0800 |
| commit | 5d6bef0f6e5e6fc2daa12a0d7e1f5d63df59926e (patch) | |
| tree | cdecd745052beb1c7fec6840ba52cd51875b1187 /src/nvim/testdir | |
| parent | e4819017480c801c07619bfe740cc934e2f4c85b (diff) | |
| parent | b2606673cc367c018527203fbc7c3e85cc9a4e8e (diff) | |
| download | rneovim-5d6bef0f6e5e6fc2daa12a0d7e1f5d63df59926e.tar.gz rneovim-5d6bef0f6e5e6fc2daa12a0d7e1f5d63df59926e.tar.bz2 rneovim-5d6bef0f6e5e6fc2daa12a0d7e1f5d63df59926e.zip | |
Merge pull request #17374 from zeertzjq/vim-8.2.3510
vim-patch:8.2.{3510,3512,3514,3515,3534}: nanosecond timestamp change detection
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_stat.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_stat.vim b/src/nvim/testdir/test_stat.vim index 170358e023..b44f3e9b94 100644 --- a/src/nvim/testdir/test_stat.vim +++ b/src/nvim/testdir/test_stat.vim @@ -1,5 +1,7 @@ " Tests for stat functions and checktime +source check.vim + func CheckFileTime(doSleep) let fnames = ['Xtest1.tmp', 'Xtest2.tmp', 'Xtest3.tmp'] let times = [] @@ -74,6 +76,44 @@ 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' + sleep 10m " make test less flaky in Nvim + call writefile(fl, fname) + checktime + call assert_equal(fl[0], getline(1)) + + call delete(fname) +endfunc + +func Test_autoread_fast() + CheckFeature nanotime + + " this is timing sensitive + let g:test_is_flaky = 1 + + new Xautoread + setlocal autoread + call setline(1, 'foo') + w! + sleep 10m + call writefile(['bar'], 'Xautoread') + sleep 10m + checktime + call assert_equal('bar', trim(getline(1))) + + call delete('Xautoread') +endfunc + func Test_autoread_file_deleted() new Xautoread set autoread |