aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-11 22:37:38 -0500
committerGitHub <noreply@github.com>2021-02-11 22:37:38 -0500
commit52397aaa0d1e2d4ce1320c73761cf316fc608ffb (patch)
tree647d32b73f0c9568acade1ed6e4d4e023c9c871b /src/nvim/testdir
parent393095c1c69de922530871f74869433327b247b6 (diff)
parent4bc82a59b6fc3927ce20c7cadb080ed1c9d6fce8 (diff)
downloadrneovim-52397aaa0d1e2d4ce1320c73761cf316fc608ffb.tar.gz
rneovim-52397aaa0d1e2d4ce1320c73761cf316fc608ffb.tar.bz2
rneovim-52397aaa0d1e2d4ce1320c73761cf316fc608ffb.zip
Merge pull request #13491 from seandewar/vim-8.2.1967
vim-patch:8.2.{1967,2058,2467}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_buffer.vim10
-rw-r--r--src/nvim/testdir/test_mksession.vim89
2 files changed, 99 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_buffer.vim b/src/nvim/testdir/test_buffer.vim
new file mode 100644
index 0000000000..f455b6911f
--- /dev/null
+++ b/src/nvim/testdir/test_buffer.vim
@@ -0,0 +1,10 @@
+" Tests for Vim buffer
+
+func Test_balt()
+ new SomeNewBuffer
+ balt +3 OtherBuffer
+ e #
+ call assert_equal('OtherBuffer', bufname())
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index 88320e0c22..7c7804212b 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -317,6 +317,20 @@ func Test_mkview_open_folds()
%bwipe
endfunc
+func Test_mkview_no_balt()
+ edit Xtestfile1
+ edit Xtestfile2
+
+ mkview! Xtestview
+ bdelete Xtestfile1
+
+ source Xtestview
+ call assert_equal(0, buflisted('Xtestfile1'))
+
+ call delete('Xtestview')
+ %bwipe
+endfunc
+
" Test :mkview with a file argument.
func Test_mkview_file()
" Create a view with line number and a fold.
@@ -399,6 +413,58 @@ func Test_mkview_no_file_name()
%bwipe
endfunc
+func Test_mkview_loadview_jumplist()
+ set viewdir=Xviewdir
+ au BufWinLeave * silent mkview
+ " au BufWinEnter * silent loadview
+
+ edit Xfile1
+ call setline(1, ['a', 'bbbbbbb', 'c'])
+ normal j3l
+ call assert_equal([2, 4], getcurpos()[1:2])
+ write
+
+ edit Xfile2
+ call setline(1, ['d', 'eeeeeee', 'f'])
+ normal j5l
+ call assert_equal([2, 6], getcurpos()[1:2])
+ write
+
+ edit Xfile3
+ call setline(1, ['g', 'h', 'iiiii'])
+ normal jj3l
+ call assert_equal([3, 4], getcurpos()[1:2])
+ write
+
+ " The commented :au above was moved here so that :mkview (on BufWinLeave) can
+ " run before :loadview. This is needed because Nvim's :loadview raises E484 if
+ " the view can't be opened, while Vim's silently fails instead.
+ au BufWinEnter * silent loadview
+
+ edit Xfile1
+ call assert_equal([2, 4], getcurpos()[1:2])
+ edit Xfile2
+ call assert_equal([2, 6], getcurpos()[1:2])
+ edit Xfile3
+ call assert_equal([3, 4], getcurpos()[1:2])
+
+ exe "normal \<C-O>"
+ call assert_equal('Xfile2', expand('%'))
+ call assert_equal([2, 6], getcurpos()[1:2])
+ exe "normal \<C-O>"
+ call assert_equal('Xfile1', expand('%'))
+ call assert_equal([2, 4], getcurpos()[1:2])
+
+ au! BufWinLeave
+ au! BufWinEnter
+ bwipe!
+ call delete('Xviewdir', 'rf')
+ call delete('Xfile1')
+ call delete('Xfile2')
+ call delete('Xfile3')
+ set viewdir&
+endfunc
+
" A clean session (one empty buffer, one window, and one tab) should not
" set any error messages when sourced because no commands should fail.
func Test_mksession_no_errmsg()
@@ -689,4 +755,27 @@ func Test_scrolloff()
set sessionoptions&
endfunc
+func Test_altfile()
+ edit Xone
+ split Xtwo
+ edit Xtwoalt
+ edit #
+ wincmd w
+ edit Xonealt
+ edit #
+ mksession! Xtest_altfile
+ only
+ bwipe Xonealt
+ bwipe Xtwoalt
+ bwipe!
+ source Xtest_altfile
+ call assert_equal('Xone', bufname())
+ call assert_equal('Xonealt', bufname('#'))
+ wincmd w
+ call assert_equal('Xtwo', bufname())
+ call assert_equal('Xtwoalt', bufname('#'))
+ only
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab