diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-09-22 11:17:41 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-09-22 12:40:26 +0800 |
| commit | 88099c11223398b2e7eb96eaa9385d24046db994 (patch) | |
| tree | c678c51f11158ed47d24817f1b1b6dbfabcf2aa1 /src/nvim/testdir/test_modeline.vim | |
| parent | dd2b7586f36ab10232d9024ddf2dfb436518269e (diff) | |
| download | rneovim-88099c11223398b2e7eb96eaa9385d24046db994.tar.gz rneovim-88099c11223398b2e7eb96eaa9385d24046db994.tar.bz2 rneovim-88099c11223398b2e7eb96eaa9385d24046db994.zip | |
vim-patch:8.2.2994: various code is not fully tested
Problem: Various code is not fully tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#8378)
https://github.com/vim/vim/commit/2d6d718dde7163c971d37b8f4f1ed8f2d25de130
Nvim does not support encoding=latin1 or compatible mode.
The two paste tests are applicable.
Diffstat (limited to 'src/nvim/testdir/test_modeline.vim')
| -rw-r--r-- | src/nvim/testdir/test_modeline.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_modeline.vim b/src/nvim/testdir/test_modeline.vim index f69c90cb0b..613722fdbd 100644 --- a/src/nvim/testdir/test_modeline.vim +++ b/src/nvim/testdir/test_modeline.vim @@ -1,5 +1,7 @@ " Tests for parsing the modeline. +source check.vim + func Test_modeline_invalid() " This was reading allocated memory in the past. call writefile(['vi:0', 'nothing'], 'Xmodeline') @@ -337,6 +339,32 @@ func Test_modeline_setoption_verbose() call delete('Xmodeline') endfunc +" Test for the 'modeline' default value in compatible and non-compatible modes +" for root and non-root accounts +func Test_modeline_default() + " set compatible + " call assert_false(&modeline) + set nocompatible + call assert_equal(IsRoot() ? 0 : 1, &modeline) + " set compatible&vi + " call assert_false(&modeline) + set compatible&vim + call assert_equal(IsRoot() ? 0 : 1, &modeline) + set compatible& modeline& +endfunc + +" Some options cannot be set from the modeline when 'diff' option is set +func Test_modeline_diff_buffer() + call writefile(['vim: diff foldmethod=marker wrap'], 'Xfile') + set foldmethod& nowrap + new Xfile + call assert_equal('manual', &foldmethod) + call assert_false(&wrap) + set wrap& + call delete('Xfile') + bw +endfunc + func Test_modeline_disable() set modeline call writefile(['vim: sw=2', 'vim: nomodeline', 'vim: sw=3'], 'Xmodeline_disable') |