view src/testdir/test_textobjects.vim @ 9913:bb00c661b3a4 v7.4.2230

commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 20 16:57:02 2016 +0200 patch 7.4.2230 Problem: There is no equivalent of 'smartcase' for a tag search. Solution: Add value "followscs" and "smart" to 'tagcase'. (Christian Brabandt, closes https://github.com/vim/vim/issues/712) Turn tagcase test into new style.
author Christian Brabandt <cb@256bit.org>
date Sat, 20 Aug 2016 17:00:07 +0200
parents 8cc4dfadfd48
children ae45d497868f
line wrap: on
line source

" Test for textobjects

if !has('textobjects')
  finish
endif

function! 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!
endfunction

function! Test_inner_block_without_cpo_M()
  call CpoM('(red \(blue) green)', 0, ['red \(blue', 'red \(blue', ''])
endfunction

function! Test_inner_block_with_cpo_M_left_backslash()
  call CpoM('(red \(blue) green)', 1, ['red \(blue) green', 'blue', 'red \(blue) green'])
endfunction

function! Test_inner_block_with_cpo_M_right_backslash()
  call CpoM('(red (blue\) green)', 1, ['red (blue\) green', 'blue\', 'red (blue\) green'])
endfunction