diff src/testdir/test_mksession.vim @ 29226:699fbccbeab8 v8.2.5132

patch 8.2.5132: :mkview test doesn't test much Commit: https://github.com/vim/vim/commit/c829faa8211df52997c0b9ee49cdea0c8786b177 Author: James McCoy <jamessan@jamessan.com> Date: Sun Jun 19 17:16:18 2022 +0100 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 https://github.com/vim/vim/issues/10596)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 18:30:03 +0200
parents 6c67aeb82b65
children 13b02c1ea0f7
line wrap: on
line diff
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -583,21 +583,29 @@ func Test_mkview_open_folds()
 
   call append(0, ['a', 'b', 'c'])
   1,3fold
+  write! Xtestfile
+
+  call assert_notequal(-1, foldclosed(1))
+  call assert_notequal(-1, foldclosed(2))
+  call assert_notequal(-1, foldclosed(3))
+
+  " Save the view with folds closed
+  mkview! Xtestview
+
   " zR affects 'foldlevel', make sure the option is applied after the folds
   " have been recreated.
+  " Open folds to ensure they get closed when restoring the view
   normal zR
-  write! Xtestfile
 
   call assert_equal(-1, foldclosed(1))
   call assert_equal(-1, foldclosed(2))
   call assert_equal(-1, foldclosed(3))
 
-  mkview! Xtestview
   source Xtestview
 
-  call assert_equal(-1, foldclosed(1))
-  call assert_equal(-1, foldclosed(2))
-  call assert_equal(-1, foldclosed(3))
+  call assert_notequal(-1, foldclosed(1))
+  call assert_notequal(-1, foldclosed(2))
+  call assert_notequal(-1, foldclosed(3))
 
   call delete('Xtestview')
   call delete('Xtestfile')