diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-15 08:10:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 08:10:21 +0800 |
commit | 8051fa1aff24952b9d077ba44bc2b84fd1626345 (patch) | |
tree | 1471237a96e2ef38db915b67b7f1f6257bf9ced5 /test/functional/legacy/filechanged_spec.lua | |
parent | 758d7726df1cabd3ed93403e087dab93fc3ceba7 (diff) | |
parent | 5220891571a799fd630cbcbe836d1f9e3d2dc1fa (diff) | |
download | rneovim-8051fa1aff24952b9d077ba44bc2b84fd1626345.tar.gz rneovim-8051fa1aff24952b9d077ba44bc2b84fd1626345.tar.bz2 rneovim-8051fa1aff24952b9d077ba44bc2b84fd1626345.zip |
Merge pull request #17394 from zeertzjq/vim-8.2.4343
vim-patch:8.2.4343: when reloading not all properties are detected
Diffstat (limited to 'test/functional/legacy/filechanged_spec.lua')
-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) |