summaryrefslogtreecommitdiff
path: root/src/testdir/test_fold.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-16 17:19:22 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-16 17:19:22 +0200
commit495b7dd213e096361e6f15e7aed313c1d63d9d3e (patch)
tree175e666c7745acbf7c347d59fb44c82771cf957e /src/testdir/test_fold.vim
parent4cf56bbc85f77846aeb378cfb071677336dfad6d (diff)
downloadvim-git-495b7dd213e096361e6f15e7aed313c1d63d9d3e.tar.gz
patch 8.0.1115: crash when using foldtextresult() recursivelyv8.0.1115
Problem: Crash when using foldtextresult() recursively. Solution: Avoid recursive calls. (Yasuhiro Matsumoto, closes #2098)
Diffstat (limited to 'src/testdir/test_fold.vim')
-rw-r--r--src/testdir/test_fold.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index 213c0fa45..b6ba99c56 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -278,6 +278,7 @@ func Test_move_folds_around_manual()
call assert_equal(0, foldlevel(6))
call assert_equal(9, foldclosedend(7))
call assert_equal([-1, 2, 2, 2, 2, -1, 7, 7, 7, -1], map(range(1, line('$')), 'foldclosed(v:val)'))
+
%d
" Ensure moving around the edges still works.
call setline(1, PrepIndent("a") + repeat(["a"], 3) + ["\ta"])
@@ -446,3 +447,16 @@ func Test_fold_error()
set foldmethod&
bw!
endfunc
+
+func Test_foldtext_recursive()
+ new
+ call setline(1, ['{{{', 'some text', '}}}'])
+ setlocal foldenable foldmethod=marker foldtext=foldtextresult(v\:foldstart)
+ " This was crashing because of endless recursion.
+ 2foldclose
+ redraw
+ call assert_equal(1, foldlevel(2))
+ call assert_equal(1, foldclosed(2))
+ call assert_equal(3, foldclosedend(2))
+ bwipe!
+endfunc