aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_python2.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-03-24 12:55:41 +0100
committerGitHub <noreply@github.com>2019-03-24 12:55:41 +0100
commitf705ed22fd9ae8a0477779f822bd99dfb010ea4b (patch)
treed29d3bd48a02fc62f4516a2d0b65484c54efc28f /src/nvim/testdir/test_python2.vim
parent0920c6ca812d673628cf6d04d68af50cddccbd3e (diff)
parenta73e0e8e773003eff41795cd6dac2c1213e2eaf8 (diff)
downloadrneovim-f705ed22fd9ae8a0477779f822bd99dfb010ea4b.tar.gz
rneovim-f705ed22fd9ae8a0477779f822bd99dfb010ea4b.tar.bz2
rneovim-f705ed22fd9ae8a0477779f822bd99dfb010ea4b.zip
Merge #9776 from janlazo/vim-8.1.0177
Diffstat (limited to 'src/nvim/testdir/test_python2.vim')
-rw-r--r--src/nvim/testdir/test_python2.vim84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_python2.vim b/src/nvim/testdir/test_python2.vim
index 5ba9fd68cf..448785db6d 100644
--- a/src/nvim/testdir/test_python2.vim
+++ b/src/nvim/testdir/test_python2.vim
@@ -52,3 +52,87 @@ func Test_vim_function()
py del f
delfunc s:foo
endfunc
+
+func _SetUpHiddenBuffer()
+ py import vim
+ new
+ edit hidden
+ setlocal bufhidden=hide
+
+ enew
+ let lnum = 0
+ while lnum < 10
+ call append( 1, string( lnum ) )
+ let lnum = lnum + 1
+ endwhile
+ normal G
+
+ call assert_equal( line( '.' ), 11 )
+endfunc
+
+func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Clear()
+ call _SetUpHiddenBuffer()
+ py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = None
+ call assert_equal( line( '.' ), 11 )
+ bwipe!
+endfunc
+
+func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_List()
+ call _SetUpHiddenBuffer()
+ py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][:] = [ 'test' ]
+ call assert_equal( line( '.' ), 11 )
+ bwipe!
+endfunc
+
+func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_Str()
+ call _SetUpHiddenBuffer()
+ py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = 'test'
+ call assert_equal( line( '.' ), 11 )
+ bwipe!
+endfunc
+
+func Test_Write_To_HiddenBuffer_Does_Not_Fix_Cursor_ClearLine()
+ call _SetUpHiddenBuffer()
+ py vim.buffers[ int( vim.eval( 'bufnr("hidden")' ) ) ][0] = None
+ call assert_equal( line( '.' ), 11 )
+ bwipe!
+endfunc
+
+func _SetUpVisibleBuffer()
+ py import vim
+ new
+ let lnum = 0
+ while lnum < 10
+ call append( 1, string( lnum ) )
+ let lnum = lnum + 1
+ endwhile
+ normal G
+ call assert_equal( line( '.' ), 11 )
+endfunc
+
+func Test_Write_To_Current_Buffer_Fixes_Cursor_Clear()
+ call _SetUpVisibleBuffer()
+
+ py vim.current.buffer[:] = None
+ call assert_equal( line( '.' ), 1 )
+
+ bwipe!
+endfunc
+
+func Test_Write_To_Current_Buffer_Fixes_Cursor_List()
+ call _SetUpVisibleBuffer()
+
+ py vim.current.buffer[:] = [ 'test' ]
+ call assert_equal( line( '.' ), 1 )
+
+ bwipe!
+endfunction
+
+func Test_Write_To_Current_Buffer_Fixes_Cursor_Str()
+ call _SetUpVisibleBuffer()
+
+ py vim.current.buffer[-1] = None
+ call assert_equal( line( '.' ), 10 )
+
+ bwipe!
+endfunction