vim-patch:9.1.0268: Two tests in test_filechanged.vim are slow

Problem:  Two tests in test_filechanged.vim are slow.
Solution: Sleep for shorter if the +nanotime feature is available.
          (zeertzjq)

closes: vim/vim#14418

83cd2c7bf0
This commit is contained in:
zeertzjq
2024-04-06 05:58:28 +08:00
parent dcf4c5744a
commit f4a0c853db

View File

@@ -11,8 +11,12 @@ func Test_FileChangedShell_reload()
new Xchanged_r new Xchanged_r
call setline(1, 'reload this') call setline(1, 'reload this')
write write
" Need to wait until the timestamp would change by at least a second. " Need to wait until the timestamp would change.
sleep 2 if has('nanotime')
sleep 10m
else
sleep 2
endif
silent !echo 'extra line' >>Xchanged_r silent !echo 'extra line' >>Xchanged_r
checktime checktime
call assert_equal('changed', g:reason) call assert_equal('changed', g:reason)
@@ -50,7 +54,11 @@ func Test_FileChangedShell_reload()
call assert_equal('new line', getline(1)) call assert_equal('new line', getline(1))
" Only time changed " Only time changed
sleep 2 if has('nanotime')
sleep 10m
else
sleep 2
endif
silent !touch Xchanged_r silent !touch Xchanged_r
let g:reason = '' let g:reason = ''
checktime checktime
@@ -65,7 +73,11 @@ func Test_FileChangedShell_reload()
call setline(2, 'before write') call setline(2, 'before write')
write write
call setline(2, 'after write') call setline(2, 'after write')
sleep 2 if has('nanotime')
sleep 10m
else
sleep 2
endif
silent !echo 'different line' >>Xchanged_r silent !echo 'different line' >>Xchanged_r
let g:reason = '' let g:reason = ''
checktime checktime
@@ -198,8 +210,12 @@ func Test_file_changed_dialog()
new Xchanged_d new Xchanged_d
call setline(1, 'reload this') call setline(1, 'reload this')
write write
" Need to wait until the timestamp would change by at least a second. " Need to wait until the timestamp would change.
sleep 2 if has('nanotime')
sleep 10m
else
sleep 2
endif
silent !echo 'extra line' >>Xchanged_d silent !echo 'extra line' >>Xchanged_d
call feedkeys('L', 'L') call feedkeys('L', 'L')
checktime checktime
@@ -234,7 +250,11 @@ func Test_file_changed_dialog()
call assert_equal('new line', getline(1)) call assert_equal('new line', getline(1))
" Only time changed, no prompt " Only time changed, no prompt
sleep 2 if has('nanotime')
sleep 10m
else
sleep 2
endif
silent !touch Xchanged_d silent !touch Xchanged_d
let v:warningmsg = '' let v:warningmsg = ''
checktime Xchanged_d checktime Xchanged_d