view src/testdir/test_python2.vim @ 10751:27b42717662b v8.0.0265

patch 8.0.0265: may get ml_get error when :pydo deletes lines commit https://github.com/vim/vim/commit/a58883b4ea0bbb813fd4dd7eb49dd6f03e3e5387 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 29 21:31:09 2017 +0100 patch 8.0.0265: may get ml_get error when :pydo deletes lines Problem: May get ml_get error when :pydo deletes lines or switches to another buffer. (Nikolai Pavlov, issue https://github.com/vim/vim/issues/1421) Solution: Check the buffer and line every time.
author Christian Brabandt <cb@256bit.org>
date Sun, 29 Jan 2017 21:45:04 +0100
parents
children c15bef307de6
line wrap: on
line source

" Test for python 2 commands.
" TODO: move tests from test87.in here.

if !has('python')
  finish
endif

func Test_pydo()
  " Check deleting lines does not trigger ml_get error.
  py import vim
  new
  call setline(1, ['one', 'two', 'three'])
  pydo vim.command("%d_")
  bwipe!

  " Check switching to another buffer does not trigger ml_get error.
  new
  let wincount = winnr('$')
  call setline(1, ['one', 'two', 'three'])
  pydo vim.command("new")
  call assert_equal(wincount + 1, winnr('$'))
  bwipe!
  bwipe!
endfunc