To: vim_dev@googlegroups.com Subject: Patch 7.4.2098 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2098 Problem: Text object tests are old style. Solution: Turn them into new style tests. (James McCoy, closes #941) Files: src/testdir/Make_all.mak, src/testdir/test_textobjects.in, src/testdir/test_textobjects.ok, src/testdir/test_textobjects.vim, src/Makefile *** ../vim-7.4.2097/src/testdir/Make_all.mak 2016-07-21 10:10:59.250942515 +0200 --- src/testdir/Make_all.mak 2016-07-23 21:55:05.437709514 +0200 *************** *** 108,114 **** test_search_mbyte.out \ test_signs.out \ test_tagcase.out \ - test_textobjects.out \ test_utf8.out \ test_wordcount.out \ test_writefile.out --- 108,113 ---- *************** *** 187,192 **** --- 186,192 ---- test_ruby.res \ test_stat.res \ test_syntax.res \ + test_textobjects.res \ test_usercommands.res \ test_viminfo.res \ test_viml.res \ *** ../vim-7.4.2097/src/testdir/test_textobjects.in 2015-04-13 12:57:49.638724360 +0200 --- src/testdir/test_textobjects.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,40 **** - 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 --- 0 ---- *** ../vim-7.4.2097/src/testdir/test_textobjects.ok 2015-03-13 15:02:46.258059206 +0100 --- src/testdir/test_textobjects.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,16 **** - 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 --- 0 ---- *** ../vim-7.4.2097/src/testdir/test_textobjects.vim 2016-07-23 22:03:40.781139996 +0200 --- src/testdir/test_textobjects.vim 2016-07-23 21:55:05.437709514 +0200 *************** *** 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 *** ../vim-7.4.2097/src/Makefile 2016-07-20 22:00:55.859928795 +0200 --- src/Makefile 2016-07-23 21:57:08.348621291 +0200 *************** *** 368,373 **** --- 368,376 ---- # 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,2037 **** test_search_mbyte \ test_signs \ test_tagcase \ - test_textobjects \ test_utf8 \ test_wordcount \ test_writefile \ --- 2034,2039 ---- *************** *** 2112,2117 **** --- 2114,2120 ---- test_syntax \ test_tabline \ test_tagjump \ + test_textobjects \ test_timers \ test_true_false \ test_undolevels \ *** ../vim-7.4.2097/src/version.c 2016-07-23 17:28:17.125964715 +0200 --- src/version.c 2016-07-23 21:56:37.388895500 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2098, /**/ -- Vi beats Emacs to death, and then again! http://linuxtoday.com/stories/5764.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///