view src/testdir/test_textobjects.vim @ 12150:709b898e2119 v8.0.0955

patch 8.0.0955: Test_existent_file() fails on some file systems commit https://github.com/vim/vim/commit/82de3c2c036bc89c2d9bdea236e0a7f1208a5571 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 17 17:35:36 2017 +0200 patch 8.0.0955: Test_existent_file() fails on some file systems Problem: Test_existent_file() fails on some file systems. Solution: Run the test again with a sleep when the test fails without a sleep. (James McCoy, closes #1984)
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Aug 2017 17:45:05 +0200
parents 29a781fd3f27
children 44aa2997239d
line wrap: on
line source

" Test for textobjects

if !has('textobjects')
  finish
endif

set belloff=all
func CpoM(line, useM, expected)
  new

  if a:useM
    set cpoptions+=M
  else
    set cpoptions-=M
  endif

  call setline(1, a:line)

  call setreg('"', '')
  normal! ggfrmavi)y
  call assert_equal(getreg('"'), a:expected[0])

  call setreg('"', '')
  normal! `afbmavi)y
  call assert_equal(getreg('"'), a:expected[1])

  call setreg('"', '')
  normal! `afgmavi)y
  call assert_equal(getreg('"'), a:expected[2])

  q!
endfunc

func Test_inner_block_without_cpo_M()
  call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
endfunc

func Test_inner_block_with_cpo_M_left_backslash()
  call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
endfunc

func Test_inner_block_with_cpo_M_right_backslash()
  call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
endfunc

func Test_quote_selection_selection_exclusive()
  new
  call setline(1, "a 'bcde' f")
  set selection=exclusive
  exe "norm! fdvhi'y"
  call assert_equal('bcde', @")
  set selection&vim
  bw!
endfunc