To: vim_dev@googlegroups.com Subject: Patch 7.4.2305 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2305 Problem: Marks, writefile and nested function tests are old style. Solution: Turn them into new style tests. (Yegappan Lakshmanan) Files: src/testdir/Make_all.mak, src/testdir/test_marks.in, src/testdir/test_marks.ok, src/testdir/test_marks.vim, src/testdir/test_nested_function.in, src/testdir/test_nested_function.ok, src/testdir/test_nested_function.vim, src/testdir/test_writefile.in, src/testdir/test_writefile.ok, src/testdir/test_writefile.vim, src/Makefile *** ../vim-7.4.2304/src/testdir/Make_all.mak 2016-08-26 19:13:02.115897031 +0200 --- src/testdir/Make_all.mak 2016-09-01 22:11:13.744197537 +0200 *************** *** 86,92 **** test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ ! test_charsearch.out \ test_close_count.out \ test_command_count.out \ test_comparators.out \ --- 86,92 ---- test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ ! test_charsearch.out \ test_close_count.out \ test_command_count.out \ test_comparators.out \ *************** *** 97,108 **** test_insertcount.out \ test_listchars.out \ test_listlbr.out \ - test_marks.out \ - test_nested_function.out \ test_search_mbyte.out \ test_utf8.out \ ! test_wordcount.out \ ! test_writefile.out # Tests that run on most systems, but not on Amiga. --- 97,105 ---- test_insertcount.out \ test_listchars.out \ test_listlbr.out \ test_search_mbyte.out \ test_utf8.out \ ! test_wordcount.out # Tests that run on most systems, but not on Amiga. *************** *** 175,181 **** --- 172,180 ---- test_json.res \ test_langmap.res \ test_man.res \ + test_marks.res \ test_matchadd_conceal.res \ + test_nested_function.res \ test_netbeans.res \ test_packadd.res \ test_perl.res \ *************** *** 194,199 **** --- 193,199 ---- test_viml.res \ test_visual.res \ test_window_id.res \ + test_writefile.res \ test_alot_latin.res \ test_alot_utf8.res \ test_alot.res *** ../vim-7.4.2304/src/testdir/test_marks.in 2016-01-10 20:21:50.836727126 +0100 --- src/testdir/test_marks.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,34 **** - Tests for marks. - - STARTTEST - :so small.vim - :" test that a deleted mark is restored after delete-undo-redo-undo - :/^\t/+1 - :set nocp viminfo+=nviminfo - madduu - :let a = string(getpos("'a")) - :$put ='Mark after delete-undo-redo-undo: '.a - :'' - ENDTEST - - textline A - textline B - textline C - - STARTTEST - :" test that CTRL-A and CTRL-X updates last changed mark '[, ']. - :/^123/ - :execute "normal! \`[v`]rAjwvjw\`[v`]rX" - ENDTEST - - CTRL-A CTRL-X: - 123 123 123 - 123 123 123 - 123 123 123 - - STARTTEST - :g/^STARTTEST/.,/^ENDTEST/d - :wq! test.out - ENDTEST - - Results: --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_marks.ok 2016-01-10 20:21:50.836727126 +0100 --- src/testdir/test_marks.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,16 **** - Tests for marks. - - - textline A - textline B - textline C - - - CTRL-A CTRL-X: - AAA 123 123 - 123 XXXXXXX - XXX 123 123 - - - Results: - Mark after delete-undo-redo-undo: [0, 15, 2, 0] --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_marks.vim 2016-09-01 22:18:04.540809356 +0200 --- src/testdir/test_marks.vim 2016-09-01 22:07:07.518224423 +0200 *************** *** 0 **** --- 1,26 ---- + + " Test that a deleted mark is restored after delete-undo-redo-undo. + function! Test_Restore_DelMark() + enew! + call append(0, [" textline A", " textline B", " textline C"]) + normal! 2gg + set nocp viminfo+=nviminfo + exe "normal! i\u\" + exe "normal! maddu\u" + let pos = getpos("'a") + call assert_equal(2, pos[1]) + call assert_equal(1, pos[2]) + enew! + endfunction + + " Test that CTRL-A and CTRL-X updates last changed mark '[, ']. + function! Test_Incr_Marks() + enew! + call append(0, ["123 123 123", "123 123 123", "123 123 123"]) + normal! gg + execute "normal! \`[v`]rAjwvjw\`[v`]rX" + call assert_equal("AAA 123 123", getline(1)) + call assert_equal("123 XXXXXXX", getline(2)) + call assert_equal("XXX 123 123", getline(3)) + enew! + endfunction *** ../vim-7.4.2304/src/testdir/test_nested_function.in 2014-12-13 21:00:52.059036480 +0100 --- src/testdir/test_nested_function.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,34 **** - Tests for Nested function vim: set ft=vim : - - STARTTEST - :so small.vim - :fu! NestedFunc() - : fu! Func1() - : $put ='Func1' - : endfunction - : call Func1() - : fu! s:func2() - : $put ='s:func2' - : endfunction - : call s:func2() - : fu! s:_func3() - : $put ='s:_func3' - : endfunction - : call s:_func3() - : let fn = 'Func4' - : fu! {fn}() - : $put ='Func4' - : endfunction - : call {fn}() - : let fn = 'func5' - : fu! s:{fn}() - : $put ='s:func5' - : endfunction - : call s:{fn}() - :endfunction - :call NestedFunc() - :/^result:/,$w! test.out - :qa! - ENDTEST - - result: --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_nested_function.ok 2014-12-13 21:00:52.059036480 +0100 --- src/testdir/test_nested_function.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,6 **** - result: - Func1 - s:func2 - s:_func3 - Func4 - s:func5 --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_nested_function.vim 2016-09-01 22:18:04.556809223 +0200 --- src/testdir/test_nested_function.vim 2016-09-01 22:07:07.518224423 +0200 *************** *** 0 **** --- 1,32 ---- + "Tests for nested functions + " + function! NestedFunc() + fu! Func1() + let g:text .= 'Func1 ' + endfunction + call Func1() + fu! s:func2() + let g:text .= 's:func2 ' + endfunction + call s:func2() + fu! s:_func3() + let g:text .= 's:_func3 ' + endfunction + call s:_func3() + let fn = 'Func4' + fu! {fn}() + let g:text .= 'Func4 ' + endfunction + call {fn}() + let fn = 'func5' + fu! s:{fn}() + let g:text .= 's:func5' + endfunction + call s:{fn}() + endfunction + + function! Test_nested_functions() + let g:text = '' + call NestedFunc() + call assert_equal('Func1 s:func2 s:_func3 Func4 s:func5', g:text) + endfunction *** ../vim-7.4.2304/src/testdir/test_writefile.in 2016-01-25 20:38:26.248524169 +0100 --- src/testdir/test_writefile.in 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,19 **** - Tests for writefile() - - STARTTEST - :source small.vim - :%delete _ - :let f = tempname() - :call writefile(["over","written"], f, "b") - :call writefile(["hello","world"], f, "b") - :call writefile(["!", "good"], f, "a") - :call writefile(["morning"], f, "ab") - :call writefile(["", "vimmers"], f, "ab") - :bwipeout! - :$put =readfile(f) - :1 delete _ - :w! test.out - :call delete(f) - :qa! - ENDTEST - --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_writefile.ok 2014-11-05 18:05:48.660441306 +0100 --- src/testdir/test_writefile.ok 1970-01-01 01:00:00.000000000 +0100 *************** *** 1,5 **** - hello - world! - good - morning - vimmers --- 0 ---- *** ../vim-7.4.2304/src/testdir/test_writefile.vim 2016-09-01 22:18:04.568809124 +0200 --- src/testdir/test_writefile.vim 2016-09-01 22:07:07.518224423 +0200 *************** *** 0 **** --- 1,16 ---- + + function! Test_WriteFile() + let f = tempname() + call writefile(["over","written"], f, "b") + call writefile(["hello","world"], f, "b") + call writefile(["!", "good"], f, "a") + call writefile(["morning"], f, "ab") + call writefile(["", "vimmers"], f, "ab") + let l = readfile(f) + call assert_equal("hello", l[0]) + call assert_equal("world!", l[1]) + call assert_equal("good", l[2]) + call assert_equal("morning", l[3]) + call assert_equal("vimmers", l[4]) + call delete(f) + endfunction *** ../vim-7.4.2304/src/Makefile 2016-08-28 21:00:47.155343947 +0200 --- src/Makefile 2016-09-01 22:12:06.931758867 +0200 *************** *** 2039,2050 **** test_listchars \ test_listlbr \ test_listlbr_utf8 \ - test_marks \ - test_nested_function \ test_search_mbyte \ test_utf8 \ test_wordcount \ - test_writefile \ test2 test3 test4 test5 test6 test7 test8 test9 \ test11 test12 test13 test14 test15 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ --- 2039,2047 ---- *************** *** 2105,2115 **** --- 2102,2114 ---- test_lispwords \ test_man \ test_mapping \ + test_marks \ test_match \ test_matchadd_conceal \ test_matchadd_conceal_utf8 \ test_menu \ test_messages \ + test_nested_function \ test_netbeans \ test_options \ test_packadd \ *************** *** 2148,2153 **** --- 2147,2153 ---- test_visual \ test_window_cmd \ test_window_id \ + test_writefile \ test_alot_latin \ test_alot_utf8 \ test_alot: *** ../vim-7.4.2304/src/version.c 2016-09-01 21:26:16.170308443 +0200 --- src/version.c 2016-09-01 22:13:15.075196839 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2305, /**/ -- hundred-and-one symptoms of being an internet addict: 130. You can't get out of your desk even if it's time to eat or time to go to the bathroom. /// 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 ///