Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
29225:80258dfb5657 | 29226:699fbccbeab8 |
---|---|
581 func Test_mkview_open_folds() | 581 func Test_mkview_open_folds() |
582 enew! | 582 enew! |
583 | 583 |
584 call append(0, ['a', 'b', 'c']) | 584 call append(0, ['a', 'b', 'c']) |
585 1,3fold | 585 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 | |
586 " zR affects 'foldlevel', make sure the option is applied after the folds | 595 " zR affects 'foldlevel', make sure the option is applied after the folds |
587 " have been recreated. | 596 " have been recreated. |
597 " Open folds to ensure they get closed when restoring the view | |
588 normal zR | 598 normal zR |
589 write! Xtestfile | |
590 | 599 |
591 call assert_equal(-1, foldclosed(1)) | 600 call assert_equal(-1, foldclosed(1)) |
592 call assert_equal(-1, foldclosed(2)) | 601 call assert_equal(-1, foldclosed(2)) |
593 call assert_equal(-1, foldclosed(3)) | 602 call assert_equal(-1, foldclosed(3)) |
594 | 603 |
595 mkview! Xtestview | |
596 source Xtestview | 604 source Xtestview |
597 | 605 |
598 call assert_equal(-1, foldclosed(1)) | 606 call assert_notequal(-1, foldclosed(1)) |
599 call assert_equal(-1, foldclosed(2)) | 607 call assert_notequal(-1, foldclosed(2)) |
600 call assert_equal(-1, foldclosed(3)) | 608 call assert_notequal(-1, foldclosed(3)) |
601 | 609 |
602 call delete('Xtestview') | 610 call delete('Xtestview') |
603 call delete('Xtestfile') | 611 call delete('Xtestfile') |
604 %bwipe | 612 %bwipe |
605 endfunc | 613 endfunc |