Skip to content

Commit c829faa

Browse files
jamessanbrammool
authored andcommitted
patch 8.2.5132: :mkview test doesn't test much
Problem: :mkview test doesn't test much. Solution: Save the view with the folds closed. (James McCoy, closes #10596)
1 parent e530395 commit c829faa

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

src/testdir/test_mksession.vim

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,21 +583,29 @@ func Test_mkview_open_folds()
583583

584584
call append(0, ['a', 'b', 'c'])
585585
1,3fold
586+
write! Xtestfile
587+
588+
call assert_notequal(-1, foldclosed(1))
589+
call assert_notequal(-1, foldclosed(2))
590+
call assert_notequal(-1, foldclosed(3))
591+
592+
" Save the view with folds closed
593+
mkview! Xtestview
594+
586595
" zR affects 'foldlevel', make sure the option is applied after the folds
587596
" have been recreated.
597+
" Open folds to ensure they get closed when restoring the view
588598
normal zR
589-
write! Xtestfile
590599

591600
call assert_equal(-1, foldclosed(1))
592601
call assert_equal(-1, foldclosed(2))
593602
call assert_equal(-1, foldclosed(3))
594603

595-
mkview! Xtestview
596604
source Xtestview
597605

598-
call assert_equal(-1, foldclosed(1))
599-
call assert_equal(-1, foldclosed(2))
600-
call assert_equal(-1, foldclosed(3))
606+
call assert_notequal(-1, foldclosed(1))
607+
call assert_notequal(-1, foldclosed(2))
608+
call assert_notequal(-1, foldclosed(3))
601609

602610
call delete('Xtestview')
603611
call delete('Xtestfile')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
5132,
737739
/**/
738740
5131,
739741
/**/

0 commit comments

Comments
 (0)