view src/testdir/test_textobjects.vim @ 10581:dffda1f9b501 v8.0.0180

patch 8.0.0180: error E937 is used twice commit https://github.com/vim/vim/commit/83381f7129aca00bc2dd24527f160bc6a60d70af Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 14 14:36:08 2017 +0100 patch 8.0.0180: error E937 is used twice Problem: Error E937 is used both for duplicate key in JSON and for trying to delete a buffer that is in use. Solution: Rename the JSON error to E938. (Norio Takagi, closes #1376)
author Christian Brabandt <cb@256bit.org>
date Sat, 14 Jan 2017 14:45:04 +0100
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