To: vim_dev@googlegroups.com Subject: Patch 8.2.4994 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4994 Problem: Tests are using legacy functions. Solution: Convert a few tests to use :def functions. Files: src/testdir/test_cindent.vim *** ../vim-8.2.4993/src/testdir/test_cindent.vim 2022-05-16 18:06:12.035283526 +0100 --- src/testdir/test_cindent.vim 2022-05-21 21:24:02.185865945 +0100 *************** *** 1,22 **** " Test for cinoptions and cindent ! func Test_cino_hash() ! " Test that curbuf->b_ind_hash_comment is correctly reset new setlocal cindent cinoptions=#1 setlocal cinoptions= ! call setline(1, ["#include "]) ! call cursor(1, 1) norm! o#include ! "call feedkeys("o#include\", 't') ! call assert_equal(["#include ", "#include"], getline(1,2)) bwipe! ! endfunc ! func Test_cino_extern_c() ! " Test for cino-E ! let without_ind =<< trim [CODE] #ifdef __cplusplus extern "C" { #endif --- 1,22 ---- " Test for cinoptions and cindent ! def Test_cino_hash() ! # Test that curbuf->b_ind_hash_comment is correctly reset new setlocal cindent cinoptions=#1 setlocal cinoptions= ! setline(1, ["#include "]) ! cursor(1, 1) norm! o#include ! assert_equal(["#include ", "#include"], getline(1, 2)) ! bwipe! ! enddef ! def Test_cino_extern_c() ! # Test for cino-E ! var without_ind =<< trim [CODE] #ifdef __cplusplus extern "C" { #endif *************** *** 26,32 **** #endif [CODE] ! let with_ind =<< trim [CODE] #ifdef __cplusplus extern "C" { #endif --- 26,32 ---- #endif [CODE] ! var with_ind =<< trim [CODE] #ifdef __cplusplus extern "C" { #endif *************** *** 37,53 **** [CODE] new setlocal cindent cinoptions=E0 ! call setline(1, without_ind) ! call feedkeys("gg=G", 'tx') ! call assert_equal(with_ind, getline(1, '$')) setlocal cinoptions=E-s ! call setline(1, with_ind) ! call feedkeys("gg=G", 'tx') ! call assert_equal(without_ind, getline(1, '$')) setlocal cinoptions=Es ! let tests = [ \ ['recognized', ['extern "C" {'], "\t\t;"], \ ['recognized', ['extern "C++" {'], "\t\t;"], \ ['recognized', ['extern /* com */ "C"{'], "\t\t;"], --- 37,53 ---- [CODE] new setlocal cindent cinoptions=E0 ! setline(1, without_ind) ! feedkeys("gg=G", 'tx') ! assert_equal(with_ind, getline(1, '$')) setlocal cinoptions=E-s ! setline(1, with_ind) ! feedkeys("gg=G", 'tx') ! assert_equal(without_ind, getline(1, '$')) setlocal cinoptions=Es ! var tests = [ \ ['recognized', ['extern "C" {'], "\t\t;"], \ ['recognized', ['extern "C++" {'], "\t\t;"], \ ['recognized', ['extern /* com */ "C"{'], "\t\t;"], *************** *** 60,137 **** \ ] for pair in tests ! let lines = pair[1] ! call setline(1, lines) ! call feedkeys(len(lines) . "Go;", 'tx') ! call assert_equal(pair[2], getline(len(lines) + 1), 'Failed for "' . string(lines) . '"') endfor bwipe! ! endfunc ! func Test_cindent_rawstring() new setl cindent ! call feedkeys("i" . ! \ "int main() {\" . ! \ "R\"(\" . ! \ ")\";\" . \ "statement;\", "x") ! call assert_equal("\tstatement;", getline(line('.'))) ! bw! ! endfunc ! func Test_cindent_expr() new ! func! MyIndentFunction() return v:lnum == 1 ? shiftwidth() : 0 ! endfunc ! setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction() ! let testinput =<< trim [CODE] var_a = something() b = something() [CODE] ! call setline(1, testinput) ! call cursor(1, 1) ! call feedkeys("^\j$A;\", 'tnix') ! let expected =<< [CODE] var_a = something(); b = something(); [CODE] ! call assert_equal(expected, getline(1, '$')) ! %d ! let testinput =<< [CODE] var_a = something() b = something() [CODE] ! call setline(1, testinput) ! call cursor(1, 1) ! call feedkeys("^\j$A;\", 'tnix') ! let expected =<< [CODE] var_a = something(); b = something() [CODE] ! call assert_equal(expected, getline(1, '$')) ! bw! ! endfunc ! func Test_cindent_func() new setlocal cindent ! call setline(1, ['int main(void)', '{', 'return 0;', '}']) ! call assert_equal(-1, cindent(0)) ! call assert_equal(&sw, 3->cindent()) ! call assert_equal(-1, cindent(line('$')+1)) bwipe! ! endfunc ! func Test_cindent_1() new setl cindent ts=4 sw=4 setl cino& sts& ! let code =<< trim [CODE] /* start of AUTO matically checked vim: set ts=4 : */ { if (test) --- 60,143 ---- \ ] for pair in tests ! var lines = pair[1] ! setline(1, lines) ! feedkeys(len(lines) .. "Go;", 'tx') ! assert_equal(pair[2], getline(len(lines) + 1), ! 'Failed for "' .. string(lines) .. '"') endfor bwipe! ! enddef ! def Test_cindent_rawstring() new setl cindent ! feedkeys("i" .. ! \ "int main() {\" .. ! \ "R\"(\" .. ! \ ")\";\" .. \ "statement;\", "x") ! assert_equal("\tstatement;", getline(line('.'))) ! ! bwipe! ! enddef ! def Test_cindent_expr() new ! def g:MyIndentFunction(): number return v:lnum == 1 ? shiftwidth() : 0 ! enddef ! setl expandtab sw=8 indentkeys+=; indentexpr=g:MyIndentFunction() ! var testinput =<< trim [CODE] var_a = something() b = something() [CODE] ! setline(1, testinput) ! cursor(1, 1) ! feedkeys("^\j$A;\", 'tnix') ! var expected =<< [CODE] var_a = something(); b = something(); [CODE] ! assert_equal(expected, getline(1, '$')) ! :%d ! testinput =<< [CODE] var_a = something() b = something() [CODE] ! setline(1, testinput) ! cursor(1, 1) ! feedkeys("^\j$A;\", 'tnix') ! expected =<< [CODE] var_a = something(); b = something() [CODE] ! assert_equal(expected, getline(1, '$')) ! delfunc g:MyIndentFunction ! ! bwipe! ! enddef ! ! def Test_cindent_func() new setlocal cindent ! setline(1, ['int main(void)', '{', 'return 0;', '}']) ! assert_equal(-1, cindent(0)) ! assert_equal(&sw, 3->cindent()) ! assert_equal(-1, cindent(line('$') + 1)) ! bwipe! ! enddef ! def Test_cindent_1() new setl cindent ts=4 sw=4 setl cino& sts& ! var code =<< trim [CODE] /* start of AUTO matically checked vim: set ts=4 : */ { if (test) *************** *** 1103,1114 **** /* end of AUTO */ [CODE] ! call append(0, code) normal gg ! call search('start of AUTO') exe "normal =/end of AUTO\" ! let expected =<< trim [CODE] /* start of AUTO matically checked vim: set ts=4 : */ { if (test) --- 1109,1120 ---- /* end of AUTO */ [CODE] ! append(0, code) normal gg ! search('start of AUTO') exe "normal =/end of AUTO\" ! var expected =<< trim [CODE] /* start of AUTO matically checked vim: set ts=4 : */ { if (test) *************** *** 2081,2097 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_2() new setl cindent ts=4 sw=4 setl tw=0 noai fo=croq ! let &wm = &columns - 20 ! let code =<< trim [CODE] { /* this is --- 2087,2104 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! ! bwipe! ! enddef ! def Test_cindent_2() new setl cindent ts=4 sw=4 setl tw=0 noai fo=croq ! &wm = &columns - 20 ! var code =<< trim [CODE] { /* this is *************** *** 2102,2113 **** } [CODE] ! call append(0, code) normal gg ! call search('serious', 'e') normal a about life, the universe, and the rest ! let expected =<< trim [CODE] { /* this is --- 2109,2120 ---- } [CODE] ! append(0, code) normal gg ! search('serious', 'e') normal a about life, the universe, and the rest ! var expected =<< trim [CODE] { /* this is *************** *** 2122,2137 **** [CODE] ! call assert_equal(expected, getline(1, '$')) set wm& - enew! | close - endfunc ! func Test_cindent_3() new setl nocindent ts=4 sw=4 ! let code =<< trim [CODE] { /* * Testing for comments, without 'cin' set --- 2129,2145 ---- [CODE] ! assert_equal(expected, getline(1, '$')) set wm& ! bwipe! ! enddef ! ! def Test_cindent_3() new setl nocindent ts=4 sw=4 ! var code =<< trim [CODE] { /* * Testing for comments, without 'cin' set *************** *** 2149,2166 **** } [CODE] ! call append(0, code) normal gg ! call search('comments') normal joabout life ! call search('happens') normal jothere ! call search('below') normal oline ! call search('this') normal Ohello ! let expected =<< trim [CODE] { /* * Testing for comments, without 'cin' set --- 2157,2174 ---- } [CODE] ! append(0, code) normal gg ! search('comments') normal joabout life ! search('happens') normal jothere ! search('below') normal oline ! search('this') normal Ohello ! var expected =<< trim [CODE] { /* * Testing for comments, without 'cin' set *************** *** 2183,2197 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_4() new setl cindent ts=4 sw=4 ! let code =<< trim [CODE] { var = this + that + vec[0] * vec[0] + vec[1] * vec[1] --- 2191,2206 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! ! bwipe! ! enddef ! def Test_cindent_4() new setl cindent ts=4 sw=4 ! var code =<< trim [CODE] { var = this + that + vec[0] * vec[0] + vec[1] * vec[1] *************** *** 2199,2210 **** } [CODE] ! call append(0, code) normal gg ! call search('vec2') normal == ! let expected =<< trim [CODE] { var = this + that + vec[0] * vec[0] + vec[1] * vec[1] --- 2208,2219 ---- } [CODE] ! append(0, code) normal gg ! search('vec2') normal == ! var expected =<< trim [CODE] { var = this + that + vec[0] * vec[0] + vec[1] * vec[1] *************** *** 2213,2228 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_5() new setl cindent ts=4 sw=4 setl cino=}4 ! let code =<< trim [CODE] { asdf asdflkajds f; if (tes & ting) { --- 2222,2238 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_5() new setl cindent ts=4 sw=4 setl cino=}4 ! var code =<< trim [CODE] { asdf asdflkajds f; if (tes & ting) { *************** *** 2239,2251 **** } [CODE] ! call append(0, code) normal gg ! call search('testing1') exe "normal k2==/testing2\" normal k2== ! let expected =<< trim [CODE] { asdf asdflkajds f; if (tes & ting) { --- 2249,2261 ---- } [CODE] ! append(0, code) normal gg ! search('testing1') exe "normal k2==/testing2\" normal k2== ! var expected =<< trim [CODE] { asdf asdflkajds f; if (tes & ting) { *************** *** 2263,2278 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_6() new setl cindent ts=4 sw=4 setl cino=(0,)20 ! let code =<< trim [CODE] main ( int first_par, /* * Comment for * first par --- 2273,2289 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_6() new setl cindent ts=4 sw=4 setl cino=(0,)20 ! var code =<< trim [CODE] main ( int first_par, /* * Comment for * first par *************** *** 2296,2307 **** } [CODE] ! call append(0, code) normal gg ! call search('main') normal =][ ! let expected =<< trim [CODE] main ( int first_par, /* * Comment for * first par --- 2307,2318 ---- } [CODE] ! append(0, code) normal gg ! search('main') normal =][ ! var expected =<< trim [CODE] main ( int first_par, /* * Comment for * first par *************** *** 2326,2341 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_7() new setl cindent ts=4 sw=4 setl cino=es,n0s ! let code =<< trim [CODE] main(void) { /* Make sure that cino=X0s is not parsed like cino=Xs. */ --- 2337,2353 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_7() new setl cindent ts=4 sw=4 setl cino=es,n0s ! var code =<< trim [CODE] main(void) { /* Make sure that cino=X0s is not parsed like cino=Xs. */ *************** *** 2348,2359 **** } [CODE] ! call append(0, code) normal gg ! call search('main') normal =][ ! let expected =<< trim [CODE] main(void) { /* Make sure that cino=X0s is not parsed like cino=Xs. */ --- 2360,2371 ---- } [CODE] ! append(0, code) normal gg ! search('main') normal =][ ! var expected =<< trim [CODE] main(void) { /* Make sure that cino=X0s is not parsed like cino=Xs. */ *************** *** 2366,2382 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_8() new setl cindent ts=4 sw=4 setl cino= ! let code =<< trim [CODE] { do --- 2378,2394 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_8() new setl cindent ts=4 sw=4 setl cino= ! var code =<< trim [CODE] { do *************** *** 2393,2403 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] { do --- 2405,2415 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] { do *************** *** 2415,2429 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_9() new setl cindent ts=4 sw=4 ! let code =<< trim [CODE] void f() { --- 2427,2442 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_9() new setl cindent ts=4 sw=4 ! var code =<< trim [CODE] void f() { *************** *** 2438,2448 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { --- 2451,2461 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { *************** *** 2458,2473 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_10() new setl cindent ts=4 sw=4 setl cino={s,e-s ! let code =<< trim [CODE] void f() { --- 2471,2487 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! ! bwipe! ! enddef ! def Test_cindent_10() new setl cindent ts=4 sw=4 setl cino={s,e-s ! var code =<< trim [CODE] void f() { *************** *** 2481,2491 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { --- 2495,2505 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { *************** *** 2500,2515 **** [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_11() new setl cindent ts=4 sw=4 setl cino={s,fs ! let code =<< trim [CODE] void bar(void) { static array[2][2] = --- 2514,2530 ---- [CODE] ! assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_11() new setl cindent ts=4 sw=4 setl cino={s,fs ! var code =<< trim [CODE] void bar(void) { static array[2][2] = *************** *** 2544,2554 **** /* foo */ [CODE] ! call append(0, code) normal gg exe "normal ]]=/ foo\" ! let expected =<< trim [CODE] void bar(void) { static array[2][2] = --- 2559,2569 ---- /* foo */ [CODE] ! append(0, code) normal gg exe "normal ]]=/ foo\" ! var expected =<< trim [CODE] void bar(void) { static array[2][2] = *************** *** 2583,2599 **** /* foo */ [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_12() new setl cindent ts=4 sw=4 setl cino= ! let code =<< trim [CODE] a() { do { --- 2598,2614 ---- /* foo */ [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_12() new setl cindent ts=4 sw=4 setl cino= ! var code =<< trim [CODE] a() { do { *************** *** 2605,2616 **** } [CODE] ! call append(0, code) normal gg ! call search('while') normal ohere ! let expected =<< trim [CODE] a() { do { --- 2620,2631 ---- } [CODE] ! append(0, code) normal gg ! search('while') normal ohere ! var expected =<< trim [CODE] a() { do { *************** *** 2623,2639 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_13() new setl cindent ts=4 sw=4 setl cino= com= ! let code =<< trim [CODE] a() { label1: --- 2638,2654 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_13() new setl cindent ts=4 sw=4 setl cino= com= ! var code =<< trim [CODE] a() { label1: *************** *** 2642,2654 **** } [CODE] ! call append(0, code) normal gg ! call search('comment') ! exe "normal olabel2: b();\rlabel3 /* post */:\r/* pre */ label4:\r" . ! \ "f(/*com*/);\rif (/*com*/)\rcmd();" ! let expected =<< trim [CODE] a() { label1: --- 2657,2669 ---- } [CODE] ! append(0, code) normal gg ! search('comment') ! exe "normal olabel2: b();\rlabel3 /* post */:\r/* pre */ label4:\r" ! .. "f(/*com*/);\rif (/*com*/)\rcmd();" ! var expected =<< trim [CODE] a() { label1: *************** *** 2663,2679 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_14() new setl cindent ts=4 sw=4 setl comments& comments^=s:/*,m:**,ex:*/ ! let code =<< trim [CODE] /* * A simple comment */ --- 2678,2694 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_14() new setl cindent ts=4 sw=4 setl comments& comments^=s:/*,m:**,ex:*/ ! var code =<< trim [CODE] /* * A simple comment */ *************** *** 2683,2694 **** */ [CODE] ! call append(0, code) normal gg ! call search('simple') normal =5j ! let expected =<< trim [CODE] /* * A simple comment */ --- 2698,2709 ---- */ [CODE] ! append(0, code) normal gg ! search('simple') normal =5j ! var expected =<< trim [CODE] /* * A simple comment */ *************** *** 2698,2715 **** */ [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_15() new setl cindent ts=4 sw=4 setl cino=c0 setl comments& comments-=s1:/* comments^=s0:/* ! let code =<< trim [CODE] void f() { --- 2713,2730 ---- */ [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_15() new setl cindent ts=4 sw=4 setl cino=c0 setl comments& comments-=s1:/* comments^=s0:/* ! var code =<< trim [CODE] void f() { *************** *** 2719,2729 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { --- 2734,2744 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { *************** *** 2733,2750 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_16() new setl cindent ts=4 sw=4 setl cino=c0,C1 setl comments& comments-=s1:/* comments^=s0:/* ! let code =<< trim [CODE] void f() { --- 2748,2765 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_16() new setl cindent ts=4 sw=4 setl cino=c0,C1 setl comments& comments-=s1:/* comments^=s0:/* ! var code =<< trim [CODE] void f() { *************** *** 2754,2764 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { --- 2769,2779 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { *************** *** 2768,2784 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_17() new setl cindent ts=4 sw=4 setl cino= ! let code =<< trim [CODE] void f() { c = c1 && --- 2783,2799 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_17() new setl cindent ts=4 sw=4 setl cino= ! var code =<< trim [CODE] void f() { c = c1 && *************** *** 2789,2799 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { c = c1 && --- 2804,2814 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { c = c1 && *************** *** 2804,2820 **** } [CODE] - call assert_equal(expected, getline(1, '$')) - enew! | close - endfunc ! func Test_cindent_18() new setl cindent ts=4 sw=4 setl cino=(s ! let code =<< trim [CODE] void f() { c = c1 && --- 2819,2835 ---- } [CODE] call assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! ! def Test_cindent_18() new setl cindent ts=4 sw=4 setl cino=(s ! var code =<< trim [CODE] void f() { c = c1 && *************** *** 2825,2835 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { c = c1 && --- 2840,2850 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { c = c1 && *************** *** 2840,2856 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_19() new setl cindent ts=4 sw=4 set cino=(s,U1 ! let code =<< trim [CODE] void f() { c = c1 && --- 2855,2871 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_19() new setl cindent ts=4 sw=4 set cino=(s,U1 ! var code =<< trim [CODE] void f() { c = c1 && *************** *** 2861,2871 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { c = c1 && --- 2876,2886 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { c = c1 && *************** *** 2876,2892 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_20() new setl cindent ts=4 sw=4 setl cino=(0 ! let code =<< trim [CODE] void f() { if ( c1 --- 2891,2907 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_20() new setl cindent ts=4 sw=4 setl cino=(0 ! var code =<< trim [CODE] void f() { if ( c1 *************** *** 2896,2906 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { if ( c1 --- 2911,2921 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { if ( c1 *************** *** 2910,2926 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_21() new setl cindent ts=4 sw=4 setl cino=(0,w1 ! let code =<< trim [CODE] void f() { if ( c1 --- 2925,2941 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_21() new setl cindent ts=4 sw=4 setl cino=(0,w1 ! var code =<< trim [CODE] void f() { if ( c1 *************** *** 2930,2940 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { if ( c1 --- 2945,2955 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { if ( c1 *************** *** 2944,2960 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_22() new setl cindent ts=4 sw=4 setl cino=(s ! let code =<< trim [CODE] void f() { c = c1 && ( --- 2959,2975 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_22() new setl cindent ts=4 sw=4 setl cino=(s ! var code =<< trim [CODE] void f() { c = c1 && ( *************** *** 2968,2978 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { c = c1 && ( --- 2983,2993 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { c = c1 && ( *************** *** 2986,3002 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_23() new setl cindent ts=4 sw=4 setl cino=(s,m1 ! let code =<< trim [CODE] void f() { c = c1 && ( --- 3001,3017 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_23() new setl cindent ts=4 sw=4 setl cino=(s,m1 ! var code =<< trim [CODE] void f() { c = c1 && ( *************** *** 3010,3020 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { c = c1 && ( --- 3025,3035 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { c = c1 && ( *************** *** 3028,3044 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_24() new setl cindent ts=4 sw=4 setl cino=b1 ! let code =<< trim [CODE] void f() { switch (x) --- 3043,3059 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_24() new setl cindent ts=4 sw=4 setl cino=b1 ! var code =<< trim [CODE] void f() { switch (x) *************** *** 3053,3063 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { switch (x) --- 3068,3078 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { switch (x) *************** *** 3072,3088 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_25() new setl cindent ts=4 sw=4 setl cino=(0,W5 ! let code =<< trim [CODE] void f() { invokeme( --- 3087,3103 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_25() new setl cindent ts=4 sw=4 setl cino=(0,W5 ! var code =<< trim [CODE] void f() { invokeme( *************** *** 3098,3108 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { invokeme( --- 3113,3123 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { invokeme( *************** *** 3118,3134 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_26() new setl cindent ts=4 sw=4 setl cino=/6 ! let code =<< trim [CODE] void f() { statement; --- 3133,3149 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_26() new setl cindent ts=4 sw=4 setl cino=/6 ! var code =<< trim [CODE] void f() { statement; *************** *** 3137,3147 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void f() { statement; --- 3152,3162 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void f() { statement; *************** *** 3150,3166 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_27() new setl cindent ts=4 sw=4 setl cino= ! let code =<< trim [CODE] void f() { statement; --- 3165,3181 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_27() new setl cindent ts=4 sw=4 setl cino= ! var code =<< trim [CODE] void f() { statement; *************** *** 3169,3179 **** } [CODE] ! call append(0, code) normal gg exe "normal ]]/comment 1/+1\==" ! let expected =<< trim [CODE] void f() { statement; --- 3184,3194 ---- } [CODE] ! append(0, code) normal gg exe "normal ]]/comment 1/+1\==" ! var expected =<< trim [CODE] void f() { statement; *************** *** 3182,3198 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_28() new setl cindent ts=4 sw=4 setl cino=g0 ! let code =<< trim [CODE] class CAbc { int Test() { return FALSE; } --- 3197,3213 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_28() new setl cindent ts=4 sw=4 setl cino=g0 ! var code =<< trim [CODE] class CAbc { int Test() { return FALSE; } *************** *** 3204,3214 **** }; [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] class CAbc { int Test() { return FALSE; } --- 3219,3229 ---- }; [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] class CAbc { int Test() { return FALSE; } *************** *** 3220,3236 **** }; [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_29() new setl cindent ts=4 sw=4 setl cino=(0,gs,hs ! let code =<< trim [CODE] class Foo : public Bar { public: --- 3235,3251 ---- }; [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_29() new setl cindent ts=4 sw=4 setl cino=(0,gs,hs ! var code =<< trim [CODE] class Foo : public Bar { public: *************** *** 3241,3251 **** }; [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] class Foo : public Bar { public: --- 3256,3266 ---- }; [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] class Foo : public Bar { public: *************** *** 3256,3272 **** }; [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_30() new setl cindent ts=4 sw=4 setl cino=+20 ! let code =<< [CODE] void foo() { --- 3271,3287 ---- }; [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_30() new setl cindent ts=4 sw=4 setl cino=+20 ! var code =<< [CODE] void foo() { *************** *** 3277,3287 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< [CODE] void foo() { --- 3292,3302 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< [CODE] void foo() { *************** *** 3292,3308 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_31() new setl cindent ts=4 sw=4 setl cino=(0,W2s ! let code =<< trim [CODE] { averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd( --- 3307,3323 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_31() new setl cindent ts=4 sw=4 setl cino=(0,W2s ! var code =<< trim [CODE] { averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd( *************** *** 3342,3352 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] { averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd( --- 3357,3367 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] { averylongfunctionnamelongfunctionnameaverylongfunctionname()->asd( *************** *** 3386,3402 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_32() new setl cindent ts=4 sw=4 setl cino=M1 ! let code =<< trim [CODE] int main () { if (cond1 && --- 3401,3417 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_32() new setl cindent ts=4 sw=4 setl cino=M1 ! var code =<< trim [CODE] int main () { if (cond1 && *************** *** 3406,3416 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] int main () { if (cond1 && --- 3421,3431 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] int main () { if (cond1 && *************** *** 3420,3436 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_33() new setl cindent ts=4 sw=4 setl cino=(0,ts ! let code =<< trim [CODE] void func(int a #if defined(FOO) , int b --- 3435,3451 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_33() new setl cindent ts=4 sw=4 setl cino=(0,ts ! var code =<< trim [CODE] void func(int a #if defined(FOO) , int b *************** *** 3441,3451 **** } [CODE] ! call append(0, code) normal gg normal 2j=][ ! let expected =<< trim [CODE] void func(int a #if defined(FOO) , int b --- 3456,3466 ---- } [CODE] ! append(0, code) normal gg normal 2j=][ ! var expected =<< trim [CODE] void func(int a #if defined(FOO) , int b *************** *** 3456,3472 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_34() new setl cindent ts=4 sw=4 setl cino=(0 ! let code =<< trim [CODE] void func(int a --- 3471,3487 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_34() new setl cindent ts=4 sw=4 setl cino=(0 ! var code =<< trim [CODE] void func(int a *************** *** 3479,3489 **** } [CODE] ! call append(0, code) normal gg normal =][ ! let expected =<< trim [CODE] void func(int a --- 3494,3504 ---- } [CODE] ! append(0, code) normal gg normal =][ ! var expected =<< trim [CODE] void func(int a *************** *** 3496,3512 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_35() new setl cindent ts=4 sw=4 setl cino& ! let code =<< trim [CODE] void func(void) { if(x==y) --- 3511,3527 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_35() new setl cindent ts=4 sw=4 setl cino& ! var code =<< trim [CODE] void func(void) { if(x==y) *************** *** 3579,3589 **** } [CODE] ! call append(0, code) normal gg normal ]]=7][ ! let expected =<< trim [CODE] void func(void) { if(x==y) --- 3594,3604 ---- } [CODE] ! append(0, code) normal gg normal ]]=7][ ! var expected =<< trim [CODE] void func(void) { if(x==y) *************** *** 3656,3673 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_36() new setl cindent ts=4 sw=4 setl cino& setl cino+=l1 ! let code =<< trim [CODE] void func(void) { int tab[] = --- 3671,3688 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_36() new setl cindent ts=4 sw=4 setl cino& setl cino+=l1 ! var code =<< trim [CODE] void func(void) { int tab[] = *************** *** 3693,3703 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { int tab[] = --- 3708,3718 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { int tab[] = *************** *** 3723,3739 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_37() new setl cindent ts=4 sw=4 setl cino& ! let code =<< trim [CODE] void func(void) { cout << "a" --- 3738,3754 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_37() new setl cindent ts=4 sw=4 setl cino& ! var code =<< trim [CODE] void func(void) { cout << "a" *************** *** 3743,3753 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { cout << "a" --- 3758,3768 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { cout << "a" *************** *** 3757,3773 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_38() new setl cindent ts=4 sw=4 setl com=s1:/*,m:*,ex:*/ ! let code =<< trim [CODE] void func(void) { /* --- 3772,3788 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_38() new setl cindent ts=4 sw=4 setl com=s1:/*,m:*,ex:*/ ! var code =<< trim [CODE] void func(void) { /* *************** *** 3776,3786 **** } [CODE] ! call append(0, code) normal gg normal ]]3jofoo(); ! let expected =<< trim [CODE] void func(void) { /* --- 3791,3801 ---- } [CODE] ! append(0, code) normal gg normal ]]3jofoo(); ! var expected =<< trim [CODE] void func(void) { /* *************** *** 3790,3806 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_39() new setl cindent ts=4 sw=4 setl cino& ! let code =<< trim [CODE] void func(void) { for (int i = 0; i < 10; ++i) --- 3805,3821 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_39() new setl cindent ts=4 sw=4 setl cino& ! var code =<< trim [CODE] void func(void) { for (int i = 0; i < 10; ++i) *************** *** 3812,3822 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { for (int i = 0; i < 10; ++i) --- 3827,3837 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { for (int i = 0; i < 10; ++i) *************** *** 3828,3844 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_40() new setl cindent ts=4 sw=4 setl cino=k2s,(0 ! let code =<< trim [CODE] void func(void) { if (condition1 --- 3843,3859 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_40() new setl cindent ts=4 sw=4 setl cino=k2s,(0 ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 3866,3876 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 3881,3891 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 3898,3914 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_41() new setl cindent ts=4 sw=4 setl cino=k2s,(s ! let code =<< trim [CODE] void func(void) { if (condition1 --- 3913,3929 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_41() new setl cindent ts=4 sw=4 setl cino=k2s,(s ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 3936,3946 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 3951,3961 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 3968,3984 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_42() new setl cindent ts=4 sw=4 setl cino=k2s,(s,U1 ! let code =<< trim [CODE] void func(void) { if (condition1 --- 3983,3999 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_42() new setl cindent ts=4 sw=4 setl cino=k2s,(s,U1 ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 4007,4017 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 4022,4032 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 4040,4056 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_43() new setl cindent ts=4 sw=4 setl cino=k2s,(0,W4 ! let code =<< trim [CODE] void func(void) { if (condition1 --- 4055,4071 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_43() new setl cindent ts=4 sw=4 setl cino=k2s,(0,W4 ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 4084,4094 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 4099,4109 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 4122,4138 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_44() new setl cindent ts=4 sw=4 setl cino=k2s,u2 ! let code =<< trim [CODE] void func(void) { if (condition1 --- 4137,4153 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_44() new setl cindent ts=4 sw=4 setl cino=k2s,u2 ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 4155,4165 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 4170,4180 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 4182,4198 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_45() new setl cindent ts=4 sw=4 setl cino=k2s,(0,w1 ! let code =<< trim [CODE] void func(void) { if (condition1 --- 4197,4213 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_45() new setl cindent ts=4 sw=4 setl cino=k2s,(0,w1 ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 4224,4234 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 4239,4249 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 4260,4276 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_46() new setl cindent ts=4 sw=4 setl cino=k2,(s ! let code =<< trim [CODE] void func(void) { if (condition1 --- 4275,4291 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_46() new setl cindent ts=4 sw=4 setl cino=k2,(s ! var code =<< trim [CODE] void func(void) { if (condition1 *************** *** 4289,4299 **** } [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] void func(void) { if (condition1 --- 4304,4314 ---- } [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] void func(void) { if (condition1 *************** *** 4312,4328 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_47() new setl cindent ts=4 sw=4 setl cino=N-s ! let code =<< trim [CODE] NAMESPACESTART /* valid namespaces with normal indent */ namespace --- 4327,4343 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_47() new setl cindent ts=4 sw=4 setl cino=N-s ! var code =<< trim [CODE] NAMESPACESTART /* valid namespaces with normal indent */ namespace *************** *** 4420,4431 **** NAMESPACEEND [CODE] ! call append(0, code) normal gg call search('^NAMESPACESTART') exe "normal =/^NAMESPACEEND\n" ! let expected =<< trim [CODE] NAMESPACESTART /* valid namespaces with normal indent */ namespace --- 4435,4446 ---- NAMESPACEEND [CODE] ! append(0, code) normal gg call search('^NAMESPACESTART') exe "normal =/^NAMESPACEEND\n" ! var expected =<< trim [CODE] NAMESPACESTART /* valid namespaces with normal indent */ namespace *************** *** 4523,4539 **** NAMESPACEEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_48() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART var bar = { foo: { --- 4538,4554 ---- NAMESPACEEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_48() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART var bar = { foo: { *************** *** 4550,4561 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART var bar = { foo: { --- 4565,4576 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART var bar = { foo: { *************** *** 4572,4588 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_49() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART var foo = [ 1, --- 4587,4603 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_49() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART var foo = [ 1, *************** *** 4592,4603 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART var foo = [ 1, --- 4607,4618 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART var foo = [ 1, *************** *** 4607,4623 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_50() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART function bar() { var foo = [ --- 4622,4638 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_50() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART function bar() { var foo = [ *************** *** 4629,4640 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART function bar() { var foo = [ --- 4644,4655 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART function bar() { var foo = [ *************** *** 4646,4662 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_51() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART (function($){ --- 4661,4677 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_51() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART (function($){ *************** *** 4719,4730 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART (function($){ --- 4734,4745 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART (function($){ *************** *** 4787,4803 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_52() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART function init(options) { $(this).data(class_name+'_public',$.extend({},{ --- 4802,4818 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_52() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART function init(options) { $(this).data(class_name+'_public',$.extend({},{ *************** *** 4816,4827 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART function init(options) { $(this).data(class_name+'_public',$.extend({},{ --- 4831,4842 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART function init(options) { $(this).data(class_name+'_public',$.extend({},{ *************** *** 4840,4856 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_53() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! let code =<< trim [CODE] JSSTART (function($){ function init(options) { --- 4855,4871 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_53() new setl cindent ts=4 sw=4 setl cino=j1,J1 ! var code =<< trim [CODE] JSSTART (function($){ function init(options) { *************** *** 4871,4882 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART (function($){ function init(options) { --- 4886,4897 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART (function($){ function init(options) { *************** *** 4897,4913 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_54() new setl cindent ts=4 sw=4 setl cino=j1,J1,+2 ! let code =<< trim [CODE] JSSTART // Results of JavaScript indent // 1 --- 4912,4928 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_54() new setl cindent ts=4 sw=4 setl cino=j1,J1,+2 ! var code =<< trim [CODE] JSSTART // Results of JavaScript indent // 1 *************** *** 5061,5072 **** JSEND [CODE] ! call append(0, code) normal gg ! call search('^JSSTART') exe "normal =/^JSEND\n" ! let expected =<< trim [CODE] JSSTART // Results of JavaScript indent // 1 --- 5076,5087 ---- JSEND [CODE] ! append(0, code) normal gg ! search('^JSSTART') exe "normal =/^JSEND\n" ! var expected =<< trim [CODE] JSSTART // Results of JavaScript indent // 1 *************** *** 5220,5236 **** JSEND [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_55() new setl cindent ts=4 sw=4 setl cino& ! let code =<< trim [CODE] /* start of define */ { } --- 5235,5251 ---- JSEND [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_55() new setl cindent ts=4 sw=4 setl cino& ! var code =<< trim [CODE] /* start of define */ { } *************** *** 5245,5256 **** /* end of define */ [CODE] ! call append(0, code) normal gg ! call search('start of define') exe "normal =/end of define\n" ! let expected =<< trim [CODE] /* start of define */ { } --- 5260,5271 ---- /* end of define */ [CODE] ! append(0, code) normal gg ! search('start of define') exe "normal =/end of define\n" ! var expected =<< trim [CODE] /* start of define */ { } *************** *** 5265,5338 **** /* end of define */ [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_56() new setl cindent ts=4 sw=4 setl cino& ! let code =<< trim [CODE] { a = second/*bug*/*line; } [CODE] ! call append(0, code) normal gg ! call search('a = second') normal ox ! let expected =<< trim [CODE] { a = second/*bug*/*line; x } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc " this was going beyond the end of the line. ! func Test_cindent_case() new ! call setline(1, 'case x: // x') set cindent norm! f:a: ! call assert_equal('case x:: // x', getline(1)) set cindent& bwipe! ! endfunc " Test for changing multiple lines (using c) with cindent ! func Test_cindent_change_multline() new setlocal cindent ! call setline(1, ['if (a)', '{', ' i = 1;', '}']) normal! jc3jm = 2; ! call assert_equal("\tm = 2;", getline(2)) ! close! ! endfunc " This was reading past the end of the line ! func Test_cindent_check_funcdecl() new sil norm o0('\0=L bwipe! ! endfunc ! func Test_cindent_scopedecls() new setl cindent ts=4 sw=4 setl cino=g0 setl cinsd+=public\ slots,signals ! let code =<< trim [CODE] class Foo { public: --- 5280,5353 ---- /* end of define */ [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_56() new setl cindent ts=4 sw=4 setl cino& ! var code =<< trim [CODE] { a = second/*bug*/*line; } [CODE] ! append(0, code) normal gg ! search('a = second') normal ox ! var expected =<< trim [CODE] { a = second/*bug*/*line; x } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef " this was going beyond the end of the line. ! def Test_cindent_case() new ! setline(1, 'case x: // x') set cindent norm! f:a: ! assert_equal('case x:: // x', getline(1)) set cindent& bwipe! ! enddef " Test for changing multiple lines (using c) with cindent ! def Test_cindent_change_multline() new setlocal cindent ! setline(1, ['if (a)', '{', ' i = 1;', '}']) normal! jc3jm = 2; ! assert_equal("\tm = 2;", getline(2)) ! bwipe! ! enddef " This was reading past the end of the line ! def Test_cindent_check_funcdecl() new sil norm o0('\0=L bwipe! ! enddef ! def Test_cindent_scopedecls() new setl cindent ts=4 sw=4 setl cino=g0 setl cinsd+=public\ slots,signals ! var code =<< trim [CODE] class Foo { public: *************** *** 5346,5356 **** }; [CODE] ! call append(0, code) normal gg normal ]]=][ ! let expected =<< trim [CODE] class Foo { public: --- 5361,5371 ---- }; [CODE] ! append(0, code) normal gg normal ]]=][ ! var expected =<< trim [CODE] class Foo { public: *************** *** 5364,5380 **** }; [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_cindent_pragma() new setl cindent ts=4 sw=4 setl cino=Ps ! let code =<< trim [CODE] { #pragma omp parallel { --- 5379,5395 ---- }; [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_cindent_pragma() new setl cindent ts=4 sw=4 setl cino=Ps ! var code =<< trim [CODE] { #pragma omp parallel { *************** *** 5385,5395 **** } [CODE] ! call append(0, code) normal gg normal =G ! let expected =<< trim [CODE] { #pragma omp parallel { --- 5400,5410 ---- } [CODE] ! append(0, code) normal gg normal =G ! var expected =<< trim [CODE] { #pragma omp parallel { *************** *** 5400,5427 **** } [CODE] ! call assert_equal(expected, getline(1, '$')) ! enew! | close ! endfunc ! func Test_backslash_at_end_of_line() new exe "norm v>O'\\\-" exe "norm \=" bwipe! ! endfunc ! func Test_find_brace_backwards() ! " this was looking beyond the end of the line new norm R/* norm o0{ norm o// norm V{= ! call assert_equal(['/*', ' 0{', '//'], getline(1, 3)) bwipe! ! endfunc " vim: shiftwidth=2 sts=2 expandtab --- 5415,5442 ---- } [CODE] + assert_equal(expected, getline(1, '$')) ! bwipe! ! enddef ! def Test_backslash_at_end_of_line() new exe "norm v>O'\\\-" exe "norm \=" bwipe! ! enddef ! def Test_find_brace_backwards() ! # this was looking beyond the end of the line new norm R/* norm o0{ norm o// norm V{= ! assert_equal(['/*', ' 0{', '//'], getline(1, 3)) bwipe! ! enddef " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4993/src/version.c 2022-05-21 20:16:51.011567174 +0100 --- src/version.c 2022-05-21 21:24:31.313858146 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 4994, /**/ -- hundred-and-one symptoms of being an internet addict: 249. You've forgotten what the outside looks like. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///