diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-23 22:04:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-23 22:04:47 +0200 |
commit | 00b24be454800f544676aa8850fb4378a568901e (patch) | |
tree | b1b3a7c937e85625a7a9c9bc7ea4b01ef8f503fb | |
parent | d4f31dc45482e8db527ca044b9c3436b1e750006 (diff) | |
download | vim-git-00b24be454800f544676aa8850fb4378a568901e.tar.gz |
patch 7.4.2098v7.4.2098
Problem: Text object tests are old style.
Solution: Turn them into new style tests. (James McCoy, closes #941)
-rw-r--r-- | src/Makefile | 5 | ||||
-rw-r--r-- | src/testdir/Make_all.mak | 2 | ||||
-rw-r--r-- | src/testdir/test_textobjects.in | 40 | ||||
-rw-r--r-- | src/testdir/test_textobjects.ok | 16 | ||||
-rw-r--r-- | src/testdir/test_textobjects.vim | 43 | ||||
-rw-r--r-- | src/version.c | 2 |
6 files changed, 50 insertions, 58 deletions
diff --git a/src/Makefile b/src/Makefile index 316c0e62a..9ca5b1d50 100644 --- a/src/Makefile +++ b/src/Makefile @@ -368,6 +368,9 @@ CClink = $(CC) # Carbon GUI for Mac OS X #CONF_OPT_GUI = --enable-gui=carbon +# Uncomment this line to run an indivisual test with gvim. +#GUI_TESTARG = GUI_FLAG=-g + # DARWIN - detecting Mac OS X # Uncomment this line when you want to compile a Unix version of Vim on # Darwin. None of the Mac specific options or files will be used. @@ -2031,7 +2034,6 @@ test1 \ test_search_mbyte \ test_signs \ test_tagcase \ - test_textobjects \ test_utf8 \ test_wordcount \ test_writefile \ @@ -2112,6 +2114,7 @@ test_arglist \ test_syntax \ test_tabline \ test_tagjump \ + test_textobjects \ test_timers \ test_true_false \ test_undolevels \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 11cc93429..4e4f43b02 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -108,7 +108,6 @@ SCRIPTS_ALL = \ test_search_mbyte.out \ test_signs.out \ test_tagcase.out \ - test_textobjects.out \ test_utf8.out \ test_wordcount.out \ test_writefile.out @@ -187,6 +186,7 @@ NEW_TESTS = test_arglist.res \ test_ruby.res \ test_stat.res \ test_syntax.res \ + test_textobjects.res \ test_usercommands.res \ test_viminfo.res \ test_viml.res \ diff --git a/src/testdir/test_textobjects.in b/src/testdir/test_textobjects.in deleted file mode 100644 index dc48efc67..000000000 --- a/src/testdir/test_textobjects.in +++ /dev/null @@ -1,40 +0,0 @@ -Tests for text-objects vim: set ft=vim : - -STARTTEST -:so small.vim -:if !has('textobjects') | e! test.ok | wq! test.out | endif -:set nocp viminfo+=nviminfo -:" -:function SelectionOut(data) -: new -: call setline(1, a:data) -: call setreg('"', '') -: normal! ggfrmavi)y -: $put =getreg('\"') -: call setreg('"', '') -: normal! `afbmavi)y -: $put =getreg('\"') -: call setreg('"', '') -: normal! `afgmavi)y -: $put =getreg('\"') -: %yank a -: q! -: $put =getreg('a') -:endfunction -:" -:$put ='# Test for vi) without cpo-M' -:set cpo-=M -:call SelectionOut('(red \(blue) green)') -:" -:$put ='# Test for vi) with cpo-M #1' -:set cpo+=M -:call SelectionOut('(red \(blue) green)') -:" -:$put ='# Test for vi) with cpo-M #2' -:set cpo+=M -:call SelectionOut('(red (blue\) green)') -:/^Results/,$w test.out -:qa! -ENDTEST - -Results of text-objects diff --git a/src/testdir/test_textobjects.ok b/src/testdir/test_textobjects.ok deleted file mode 100644 index b670c7d81..000000000 --- a/src/testdir/test_textobjects.ok +++ /dev/null @@ -1,16 +0,0 @@ -Results of text-objects -# Test for vi) without cpo-M -(red \(blue) green) -red \(blue -red \(blue - -# Test for vi) with cpo-M #1 -(red \(blue) green) -red \(blue) green -blue -red \(blue) green -# Test for vi) with cpo-M #2 -(red (blue\) green) -red (blue\) green -blue\ -red (blue\) green diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim new file mode 100644 index 000000000..630ae5d3a --- /dev/null +++ b/src/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/version.c b/src/version.c index d511c5236..20dd14037 100644 --- a/src/version.c +++ b/src/version.c @@ -759,6 +759,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2098, +/**/ 2097, /**/ 2096, |