diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-02-28 09:57:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-28 09:57:46 +0100 |
| commit | 2872e57af26685cd485c7419ffaccee779927a1b (patch) | |
| tree | 3288f0c6b69552e19d8de4014194a1b60c97bcfc /src/nvim/testdir/test_textobjects.vim | |
| parent | 5ed753044d650e7c2c0b65f0b04831097078d48a (diff) | |
| parent | adc6e636fea64a432656d747f3979d682c94d6e2 (diff) | |
| download | rneovim-2872e57af26685cd485c7419ffaccee779927a1b.tar.gz rneovim-2872e57af26685cd485c7419ffaccee779927a1b.tar.bz2 rneovim-2872e57af26685cd485c7419ffaccee779927a1b.zip | |
Merge #6191 from jamessan/vim-42ebd06
vim-patch:42ebd06,7.4.2098,6f1d9a0,7.4.2095
Diffstat (limited to 'src/nvim/testdir/test_textobjects.vim')
| -rw-r--r-- | src/nvim/testdir/test_textobjects.vim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_textobjects.vim b/src/nvim/testdir/test_textobjects.vim new file mode 100644 index 0000000000..630ae5d3a4 --- /dev/null +++ b/src/nvim/testdir/test_textobjects.vim @@ -0,0 +1,43 @@ +" 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 |