diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-14 11:35:25 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-02-14 11:35:25 +0800 |
commit | 5220891571a799fd630cbcbe836d1f9e3d2dc1fa (patch) | |
tree | be2ab5557a3b1aa02f0ad7b5c52d3441ed225a02 /test | |
parent | 5d6bef0f6e5e6fc2daa12a0d7e1f5d63df59926e (diff) | |
download | rneovim-5220891571a799fd630cbcbe836d1f9e3d2dc1fa.tar.gz rneovim-5220891571a799fd630cbcbe836d1f9e3d2dc1fa.tar.bz2 rneovim-5220891571a799fd630cbcbe836d1f9e3d2dc1fa.zip |
vim-patch:8.2.4343: when reloading not all properties are detected
Problem: When reloading not all properties are detected.
Solution: Add the "edit" value to v:fcs_choice. (Rob Pilling, closes vim/vim#9579)
https://github.com/vim/vim/commit/8196e94a8b72ed8618605cb66615571313097d78
Cherry-pick some test changes from patch 8.1.1826.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/filechanged_spec.lua | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/test/functional/legacy/filechanged_spec.lua b/test/functional/legacy/filechanged_spec.lua index fed7b27b0c..6eb853d630 100644 --- a/test/functional/legacy/filechanged_spec.lua +++ b/test/functional/legacy/filechanged_spec.lua @@ -11,6 +11,11 @@ describe('file changed dialog', function() clear() meths.ui_attach(80, 24, {}) meths.set_option('autoread', false) + meths.set_option('fsync', true) + end) + + it('works', function() + if helpers.pending_win32(pending) then return end source([[ func Test_file_changed_dialog() au! FileChangedShell @@ -66,11 +71,61 @@ describe('file changed dialog', function() call delete('Xchanged_d') endfunc ]]) + call('Test_file_changed_dialog') + expected_empty() end) - it('works', function() - if helpers.pending_win32(pending) then return end - call('Test_file_changed_dialog') + it('works with FileChangedShell', function() + source([[ + func Test_FileChangedShell_edit_dialog() + new Xchanged_r + call setline(1, 'reload this') + set fileformat=unix + silent write " Use :silent to prevent a hit-enter prompt + + " File format changed, reload (content only) via prompt + augroup testreload + au! + au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask' + augroup END + call assert_equal(&fileformat, 'unix') + sleep 10m " make the test less flaky in Nvim + call writefile(["line1\r", "line2\r"], 'Xchanged_r') + let g:reason = '' + call nvim_input('L') " load file content only + checktime + call assert_equal('changed', g:reason) + call assert_equal(&fileformat, 'unix') + call assert_equal("line1\r", getline(1)) + call assert_equal("line2\r", getline(2)) + %s/\r + silent write " Use :silent to prevent a hit-enter prompt + + " File format changed, reload (file and options) via prompt + augroup testreload + au! + au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask' + augroup END + call assert_equal(&fileformat, 'unix') + sleep 10m " make the test less flaky in Nvim + call writefile(["line1\r", "line2\r"], 'Xchanged_r') + let g:reason = '' + call nvim_input('a') " load file content and options + checktime + call assert_equal('changed', g:reason) + call assert_equal(&fileformat, 'dos') + call assert_equal("line1", getline(1)) + call assert_equal("line2", getline(2)) + set fileformat=unix + silent write " Use :silent to prevent a hit-enter prompt + + au! testreload + bwipe! + call delete(undofile('Xchanged_r')) + call delete('Xchanged_r') + endfunc + ]]) + call('Test_FileChangedShell_edit_dialog') expected_empty() end) end) |