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 #8378)
diff --git a/src/testdir/test_modeline.vim b/src/testdir/test_modeline.vim
index 2618d30..19c99b5 100644
--- a/src/testdir/test_modeline.vim
+++ b/src/testdir/test_modeline.vim
@@ -334,4 +334,30 @@
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
+
" vim: shiftwidth=2 sts=2 expandtab