diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2024-05-19 09:06:50 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-05-19 09:06:50 +0200 |
commit | 4776e64e72de2976ff90b17d236e50e2b02c5540 (patch) | |
tree | 2e0a5c5ccbbebcec04e69e37a39a65b75cd69492 /src/testdir/test_fold.vim | |
parent | 5f757147303dbf4c5c3122bbabf77839c3725043 (diff) |
patch 9.1.0419: eval.c not sufficiently testedv9.1.0419
Problem: eval.c not sufficiently tested
Solution: Add a few more additional tests for eval.c,
(Yegappan Lakshmanan)
closes: #14799
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_fold.vim')
-rw-r--r-- | src/testdir/test_fold.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index 7184142a44..871d427bf2 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -1629,6 +1629,35 @@ func Test_foldtext_in_modeline() delfunc ModelineFoldText endfunc +" Test for setting 'foldexpr' from the modeline and executing the expression +" in a sandbox +func Test_foldexpr_in_modeline() + func ModelineFoldExpr() + call feedkeys('aFoo', 'xt') + return strlen(matchstr(getline(v:lnum),'^\s*')) + endfunc + let lines =<< trim END + aaa + bbb + ccc + ccc + bbb + aaa + " vim: foldenable foldmethod=expr foldexpr=ModelineFoldExpr() + END + call writefile(lines, 'Xmodelinefoldexpr', 'D') + + set modeline modelineexpr + split Xmodelinefoldexpr + + call assert_equal(2, foldlevel(3)) + call assert_equal(lines, getbufline('', 1, '$')) + + bw! + set modeline& modelineexpr& + delfunc ModelineFoldExpr +endfunc + " Make sure a fold containing a nested fold is split correctly when using " foldmethod=indent func Test_fold_split() |