diff options
author | James McCoy <jamessan@jamessan.com> | 2017-02-27 20:50:52 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-02-27 20:52:42 -0500 |
commit | ad202b8401562df9c1aec75f1ad14bddea5b06d6 (patch) | |
tree | dd6fd34917c63e9eabb5ad60ea8042c4ef6df8db | |
parent | 1371e19e2bcaa128f9f709dcf234460bc92a70a6 (diff) | |
download | rneovim-ad202b8401562df9c1aec75f1ad14bddea5b06d6.tar.gz rneovim-ad202b8401562df9c1aec75f1ad14bddea5b06d6.tar.bz2 rneovim-ad202b8401562df9c1aec75f1ad14bddea5b06d6.zip |
vim-patch:7.4.2098
Problem: Text object tests are old style.
Solution: Turn them into new style tests. (James McCoy, closes vim/vim#941)
https://github.com/vim/vim/commit/00b24be454800f544676aa8850fb4378a568901e
-rw-r--r-- | src/nvim/testdir/Makefile | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_textobjects.vim | 43 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 46 insertions, 2 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 6f4e0fe49f..7a2360f340 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -41,13 +41,14 @@ NEW_TESTS ?= \ test_history.res \ test_increment.res \ test_increment_dbcs.res \ - test_lambda.res \ + test_lambda.res \ test_langmap.res \ test_match.res \ test_matchadd_conceal.res \ test_quickfix.res \ test_signs.res \ test_syntax.res \ + test_textobjects.res \ test_timers.res \ test_usercommands.res \ test_viml.res \ 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 diff --git a/src/nvim/version.c b/src/nvim/version.c index d6b17dc061..87acb3f361 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -342,7 +342,7 @@ static int included_patches[] = { // 2101, 2100, 2099, - // 2098, + 2098, // 2097, 2096, // 2095, |