diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-02-06 11:44:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-06 11:44:53 +0800 |
| commit | f6042d5c300c008fb4b3e3ec4e81537feffbaa0b (patch) | |
| tree | 30f0e104ad529caef3dd2b40b1d3b1da96671ee5 /test/functional/editor | |
| parent | b3bda2f0438da44a0a74fd5d64d6eecdac98d691 (diff) | |
| download | rneovim-f6042d5c300c008fb4b3e3ec4e81537feffbaa0b.tar.gz rneovim-f6042d5c300c008fb4b3e3ec4e81537feffbaa0b.tar.bz2 rneovim-f6042d5c300c008fb4b3e3ec4e81537feffbaa0b.zip | |
test: add test for 'foldcolumn' with cmdwin (#27355)
Diffstat (limited to 'test/functional/editor')
| -rw-r--r-- | test/functional/editor/fold_spec.lua | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/test/functional/editor/fold_spec.lua b/test/functional/editor/fold_spec.lua index 35632bb2f8..7950f6aea4 100644 --- a/test/functional/editor/fold_spec.lua +++ b/test/functional/editor/fold_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local insert = helpers.insert +local exec = helpers.exec local feed = helpers.feed local expect = helpers.expect local command = helpers.command @@ -9,7 +10,7 @@ local fn = helpers.fn local eq = helpers.eq local neq = helpers.neq -describe('Folds', function() +describe('Folding', function() local tempfname = 'Xtest-fold.txt' setup(clear) @@ -423,6 +424,42 @@ a]], eq(14, fn.foldclosedend(11)) end) + it('fdm=expr works correctly with :move #18668', function() + exec([[ + set foldmethod=expr foldexpr=indent(v:lnum) + let content = ['', '', 'Line1', ' Line2', ' Line3', + \ 'Line4', ' Line5', ' Line6', + \ 'Line7', ' Line8', ' Line9'] + call append(0, content) + normal! zM + call cursor(4, 1) + move 2 + move 1 + ]]) + expect([[ + + Line2 + Line3 + + Line1 + Line4 + Line5 + Line6 + Line7 + Line8 + Line9 + ]]) + eq(0, fn.foldlevel(1)) + eq(3, fn.foldclosedend(2)) + eq(0, fn.foldlevel(4)) + eq(0, fn.foldlevel(5)) + eq(0, fn.foldlevel(6)) + eq(8, fn.foldclosedend(7)) + eq(0, fn.foldlevel(9)) + eq(11, fn.foldclosedend(10)) + eq(0, fn.foldlevel(12)) + end) + it('no folds remain if :delete makes buffer empty #19671', function() command('setlocal foldmethod=manual') fn.setline(1, { 'foo', 'bar', 'baz' }) @@ -445,7 +482,7 @@ a]], eq(1, fn.foldlevel(1)) end) - it('updates correctly with indent method and visual blockwise insertion #22898', function() + it('fdm=indent updates correctly with visual blockwise insertion #22898', function() insert([[ a b @@ -456,7 +493,7 @@ a]], eq(1, fn.foldlevel(2)) end) - it("doesn't open folds with indent method when inserting lower foldlevel line", function() + it("fdm=indent doesn't open folds when inserting lower foldlevel line", function() insert([[ insert an unindented line under this line keep the lines under this line folded |