diff options
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_balloon.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_cindent.vim | 114 | ||||
-rw-r--r-- | src/testdir/test_const.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_debugger.vim | 56 | ||||
-rw-r--r-- | src/testdir/test_functions.vim | 15 | ||||
-rw-r--r-- | src/testdir/test_goto.vim | 288 | ||||
-rw-r--r-- | src/testdir/test_gui.vim | 18 | ||||
-rw-r--r-- | src/testdir/test_highlight.vim | 13 | ||||
-rw-r--r-- | src/testdir/test_join.vim | 166 | ||||
-rw-r--r-- | src/testdir/test_let.vim | 10 | ||||
-rw-r--r-- | src/testdir/test_memory_usage.vim | 34 | ||||
-rw-r--r-- | src/testdir/test_messages.vim | 24 | ||||
-rw-r--r-- | src/testdir/test_mksession_utf8.vim | 36 | ||||
-rw-r--r-- | src/testdir/test_normal.vim | 182 | ||||
-rw-r--r-- | src/testdir/test_popup.vim | 35 | ||||
-rw-r--r-- | src/testdir/test_popupwin.vim | 134 | ||||
-rw-r--r-- | src/testdir/test_profile.vim | 12 | ||||
-rw-r--r-- | src/testdir/test_quickfix.vim | 178 | ||||
-rw-r--r-- | src/testdir/test_xxd.vim | 16 |
19 files changed, 701 insertions, 636 deletions
diff --git a/src/testdir/test_balloon.vim b/src/testdir/test_balloon.vim index 793eb3a571..b3c680e111 100644 --- a/src/testdir/test_balloon.vim +++ b/src/testdir/test_balloon.vim @@ -13,7 +13,7 @@ if !CanRunVimInTerminal() throw 'Skipped: cannot make screendumps' endif -let s:common_script =<< [CODE] +let s:common_script =<< trim [CODE] call setline(1, ["one one one", "two tXo two", "three three three"]) set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100 func MyBalloonExpr() diff --git a/src/testdir/test_cindent.vim b/src/testdir/test_cindent.vim index a813c6cbec..a8a2345577 100644 --- a/src/testdir/test_cindent.vim +++ b/src/testdir/test_cindent.vim @@ -18,23 +18,23 @@ func Test_cino_extern_c() " Test for cino-E let without_ind =<< trim [CODE] - #ifdef __cplusplus - extern "C" { - #endif - int func_a(void); - #ifdef __cplusplus - } - #endif + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif [CODE] let with_ind =<< trim [CODE] - #ifdef __cplusplus - extern "C" { - #endif - int func_a(void); - #ifdef __cplusplus - } - #endif + #ifdef __cplusplus + extern "C" { + #endif + int func_a(void); + #ifdef __cplusplus + } + #endif [CODE] new setlocal cindent cinoptions=E0 @@ -89,30 +89,30 @@ func Test_cindent_expr() endfunc setl expandtab sw=8 indentkeys+=; indentexpr=MyIndentFunction() let testinput =<< trim [CODE] - var_a = something() - b = something() + var_a = something() + b = something() [CODE] call setline(1, testinput) call cursor(1, 1) call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') - let expected =<< trim [CODE] - var_a = something(); - b = something(); - [CODE] + let expected =<< [CODE] + var_a = something(); +b = something(); +[CODE] call assert_equal(expected, getline(1, '$')) %d - let testinput =<< trim [CODE] - var_a = something() - b = something() - [CODE] + let testinput =<< [CODE] + var_a = something() + b = something() +[CODE] call setline(1, testinput) call cursor(1, 1) call feedkeys("^\<c-v>j$A;\<esc>", 'tnix') - let expected =<< trim [CODE] - var_a = something(); - b = something() - [CODE] + let expected =<< [CODE] + var_a = something(); + b = something() +[CODE] call assert_equal(expected, getline(1, '$')) bw! endfunc @@ -2069,14 +2069,14 @@ func Test_cindent_2() let &wm = &columns - 20 let code =<< trim [CODE] - { - - /* this is - * a real serious important big - * comment - */ - /* insert " about life, the universe, and the rest" after "serious" */ - } + { + + /* this is + * a real serious important big + * comment + */ + /* insert " about life, the universe, and the rest" after "serious" */ + } [CODE] call append(0, code) @@ -3243,32 +3243,32 @@ func Test_cindent_30() setl cindent ts=4 sw=4 setl cino=+20 - let code =<< trim [CODE] - void - foo() - { - if (a) - { - } else - asdf; - } - [CODE] + let code =<< [CODE] + void +foo() +{ + if (a) + { + } else + asdf; +} +[CODE] call append(0, code) normal gg normal ]]=][ - let expected =<< trim [CODE] - void - foo() - { - if (a) - { - } else - asdf; - } + let expected =<< [CODE] + void +foo() +{ + if (a) + { + } else + asdf; +} - [CODE] +[CODE] call assert_equal(expected, getline(1, '$')) enew! | close @@ -3461,7 +3461,7 @@ func Test_cindent_34() normal =][ let expected =<< trim [CODE] - + void func(int a #if defined(FOO) diff --git a/src/testdir/test_const.vim b/src/testdir/test_const.vim index d4dccb1b83..d93de72bd4 100644 --- a/src/testdir/test_const.vim +++ b/src/testdir/test_const.vim @@ -18,7 +18,7 @@ func Test_define_var_with_lock() const n = v:null const bl = 0zC0FFEE const here =<< trim EOS - hello + hello EOS call assert_true(exists('i')) @@ -84,7 +84,7 @@ func Test_define_l_var_with_lock() const l:n = v:null const l:bl = 0zC0FFEE const l:here =<< trim EOS - hello + hello EOS call assert_fails('let l:i = 1', 'E741:') diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim index 4528b2bdbc..811717208e 100644 --- a/src/testdir/test_debugger.vim +++ b/src/testdir/test_debugger.vim @@ -26,27 +26,29 @@ func Test_Debugger() endif " Create a Vim script with some functions - call writefile([ - \ 'func Foo()', - \ ' let var1 = 1', - \ ' let var2 = Bar(var1) + 9', - \ ' return var2', - \ 'endfunc', - \ 'func Bar(var)', - \ ' let var1 = 2 + a:var', - \ ' let var2 = Bazz(var1) + 4', - \ ' return var2', - \ 'endfunc', - \ 'func Bazz(var)', - \ ' try', - \ ' let var1 = 3 + a:var', - \ ' let var3 = "another var"', - \ ' let var3 = "value2"', - \ ' catch', - \ ' let var4 = "exception"', - \ ' endtry', - \ ' return var1', - \ 'endfunc'], 'Xtest.vim') + let lines =<< trim END + func Foo() + let var1 = 1 + let var2 = Bar(var1) + 9 + return var2 + endfunc + func Bar(var) + let var1 = 2 + a:var + let var2 = Bazz(var1) + 4 + return var2 + endfunc + func Bazz(var) + try + let var1 = 3 + a:var + let var3 = "another var" + let var3 = "value2" + catch + let var4 = "exception" + endtry + return var1 + endfunc + END + call writefile(lines, 'Xtest.vim') " Start Vim in a terminal let buf = RunVimInTerminal('-S Xtest.vim', {}) @@ -294,11 +296,13 @@ func Test_Debugger() " Tests for :breakadd file and :breakadd here " Breakpoints should be set before sourcing the file - call writefile([ - \ 'let var1 = 10', - \ 'let var2 = 20', - \ 'let var3 = 30', - \ 'let var4 = 40'], 'Xtest.vim') + let lines =<< trim END + let var1 = 10 + let var2 = 20 + let var3 = 30 + let var4 = 40 + END + call writefile(lines, 'Xtest.vim') " Start Vim in a terminal let buf = RunVimInTerminal('Xtest.vim', {}) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index d574a8baed..cd3f253bbe 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -277,13 +277,14 @@ func Test_resolve_win32() if executable('cscript') new Xfile wq - call writefile([ - \ 'Set fs = CreateObject("Scripting.FileSystemObject")', - \ 'Set ws = WScript.CreateObject("WScript.Shell")', - \ 'Set shortcut = ws.CreateShortcut("Xlink.lnk")', - \ 'shortcut.TargetPath = fs.BuildPath(ws.CurrentDirectory, "Xfile")', - \ 'shortcut.Save' - \], 'link.vbs') + let lines =<< trim END + Set fs = CreateObject("Scripting.FileSystemObject") + Set ws = WScript.CreateObject("WScript.Shell") + Set shortcut = ws.CreateShortcut("Xlink.lnk") + shortcut.TargetPath = fs.BuildPath(ws.CurrentDirectory, "Xfile") + shortcut.Save + END + call writefile(lines, 'link.vbs') silent !cscript link.vbs call delete('link.vbs') call assert_equal(s:normalize_fname(getcwd() . '\Xfile'), s:normalize_fname(resolve('./Xlink.lnk'))) diff --git a/src/testdir/test_goto.vim b/src/testdir/test_goto.vim index c00e4e4376..1248de3f01 100644 --- a/src/testdir/test_goto.vim +++ b/src/testdir/test_goto.vim @@ -16,12 +16,12 @@ endfunc func Test_gD() let lines =<< trim [CODE] - int x; - - int func(void) - { - return x; - } + int x; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 1, 5) @@ -29,12 +29,12 @@ endfunc func Test_gD_too() let lines =<< trim [CODE] - Filename x; - - int Filename - int func() { Filename x; - return x; + + int Filename + int func() { + Filename x; + return x; [CODE] call XTest_goto_decl('gD', lines, 1, 10) @@ -42,13 +42,13 @@ endfunc func Test_gD_comment() let lines =<< trim [CODE] - /* int x; */ - int x; - - int func(void) - { - return x; - } + /* int x; */ + int x; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 2, 5) @@ -56,13 +56,13 @@ endfunc func Test_gD_inline_comment() let lines =<< trim [CODE] - int y /* , x */; - int x; - - int func(void) - { - return x; - } + int y /* , x */; + int x; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 2, 5) @@ -70,13 +70,13 @@ endfunc func Test_gD_string() let lines =<< trim [CODE] - char *s[] = "x"; - int x = 1; - - int func(void) - { - return x; - } + char *s[] = "x"; + int x = 1; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 2, 5) @@ -84,12 +84,12 @@ endfunc func Test_gD_string_same_line() let lines =<< trim [CODE] - char *s[] = "x", int x = 1; - - int func(void) - { - return x; - } + char *s[] = "x", int x = 1; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 1, 22) @@ -97,13 +97,13 @@ endfunc func Test_gD_char() let lines =<< trim [CODE] - char c = 'x'; - int x = 1; - - int func(void) - { - return x; - } + char c = 'x'; + int x = 1; + + int func(void) + { + return x; + } [CODE] call XTest_goto_decl('gD', lines, 2, 5) @@ -111,12 +111,12 @@ endfunc func Test_gd() let lines =<< trim [CODE] - int x; - - int func(int x) - { - return x; - } + int x; + + int func(int x) + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 3, 14) @@ -124,15 +124,15 @@ endfunc func Test_gd_not_local() let lines =<< trim [CODE] - int func1(void) - { - return x; - } - - int func2(int x) - { - return x; - } + int func1(void) + { + return x; + } + + int func2(int x) + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 3, 10) @@ -140,11 +140,11 @@ endfunc func Test_gd_kr_style() let lines =<< trim [CODE] - int func(x) - int x; - { - return x; - } + int func(x) + int x; + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 2, 7) @@ -152,15 +152,15 @@ endfunc func Test_gd_missing_braces() let lines =<< trim [CODE] - def func1(a) - a + 1 - end - - a = 1 - - def func2() - return a - end + def func1(a) + a + 1 + end + + a = 1 + + def func2() + return a + end [CODE] call XTest_goto_decl('gd', lines, 1, 11) @@ -168,12 +168,12 @@ endfunc func Test_gd_comment() let lines =<< trim [CODE] - int func(void) - { - /* int x; */ - int x; - return x; - } + int func(void) + { + /* int x; */ + int x; + return x; + } [CODE] call XTest_goto_decl('gd', lines, 4, 7) @@ -181,12 +181,12 @@ endfunc func Test_gd_comment_in_string() let lines =<< trim [CODE] - int func(void) - { - char *s ="//"; int x; - int x; - return x; - } + int func(void) + { + char *s ="//"; int x; + int x; + return x; + } [CODE] call XTest_goto_decl('gd', lines, 3, 22) @@ -195,12 +195,12 @@ endfunc func Test_gd_string_in_comment() set comments= let lines =<< trim [CODE] - int func(void) - { - /* " */ int x; - int x; - return x; - } + int func(void) + { + /* " */ int x; + int x; + return x; + } [CODE] call XTest_goto_decl('gd', lines, 3, 15) @@ -209,10 +209,10 @@ endfunc func Test_gd_inline_comment() let lines =<< trim [CODE] - int func(/* x is an int */ int x) - { - return x; - } + int func(/* x is an int */ int x) + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 1, 32) @@ -220,10 +220,10 @@ endfunc func Test_gd_inline_comment_only() let lines =<< trim [CODE] - int func(void) /* one lonely x */ - { - return x; - } + int func(void) /* one lonely x */ + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 3, 10) @@ -231,16 +231,16 @@ endfunc func Test_gd_inline_comment_body() let lines =<< trim [CODE] - int func(void) - { - int y /* , x */; - - for (/* int x = 0 */; y < 2; y++); - - int x = 0; - - return x; - } + int func(void) + { + int y /* , x */; + + for (/* int x = 0 */; y < 2; y++); + + int x = 0; + + return x; + } [CODE] call XTest_goto_decl('gd', lines, 7, 7) @@ -248,10 +248,10 @@ endfunc func Test_gd_trailing_multiline_comment() let lines =<< trim [CODE] - int func(int x) /* x is an int */ - { - return x; - } + int func(int x) /* x is an int */ + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 1, 14) @@ -259,10 +259,10 @@ endfunc func Test_gd_trailing_comment() let lines =<< trim [CODE] - int func(int x) // x is an int - { - return x; - } + int func(int x) // x is an int + { + return x; + } [CODE] call XTest_goto_decl('gd', lines, 1, 14) @@ -270,25 +270,25 @@ endfunc func Test_gd_string() let lines =<< trim [CODE] - int func(void) - { - char *s = "x"; - int x = 1; - - return x; - } + int func(void) + { + char *s = "x"; + int x = 1; + + return x; + } [CODE] call XTest_goto_decl('gd', lines, 4, 7) endfunc func Test_gd_string_only() let lines =<< trim [CODE] - int func(void) - { - char *s = "x"; - - return x; - } + int func(void) + { + char *s = "x"; + + return x; + } [CODE] call XTest_goto_decl('gd', lines, 5, 10) @@ -311,21 +311,21 @@ endfunc func Test_gd_local_block() let lines =<< trim [CODE] int main() - { - char *a = "NOT NULL"; - if(a) - { - char *b = a; - printf("%s\n", b); - } - else { - char *b = "NULL"; - return b; + char *a = "NOT NULL"; + if(a) + { + char *b = a; + printf("%s\n", b); + } + else + { + char *b = "NULL"; + return b; + } + + return 0; } - - return 0; - } [CODE] call XTest_goto_decl('1gd', lines, 11, 11) diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 7f94e6a8d9..97fd12b2b2 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -792,10 +792,11 @@ endfunc func Test_gui_dash_g() let cmd = GetVimCommand('Xscriptgui') call writefile([""], "Xtestgui") - call writefile([ - \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")', - \ 'au GUIEnter * qall', - \ ], 'Xscriptgui') + let lines =<< trim END + au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui") + au GUIEnter * qall + END + call writefile(lines, 'Xscriptgui') call system(cmd . ' -g') call WaitForAssert({-> assert_equal(['insertmode: 0'], readfile('Xtestgui'))}) @@ -807,10 +808,11 @@ endfunc func Test_gui_dash_y() let cmd = GetVimCommand('Xscriptgui') call writefile([""], "Xtestgui") - call writefile([ - \ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")', - \ 'au GUIEnter * qall', - \ ], 'Xscriptgui') + let lines =<< trim END + au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui") + au GUIEnter * qall + END + call writefile(lines, 'Xscriptgui') call system(cmd . ' -y') call WaitForAssert({-> assert_equal(['insertmode: 1'], readfile('Xtestgui'))}) diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index 78dbead8b9..09f80670f1 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -578,12 +578,13 @@ func Test_wincolor() throw 'Skipped: cannot make screendumps' endif - call writefile([ - \ 'set cursorline cursorcolumn rnu', - \ 'call setline(1, ["","1111111111","22222222222","3 here 3",""])', - \ 'set wincolor=Pmenu', - \ '/here', - \ ], 'Xtest_wincolor') + let lines =<< trim END + set cursorline cursorcolumn rnu + call setline(1, ["","1111111111","22222222222","3 here 3",""]) + set wincolor=Pmenu + /here + END + call writefile(lines, 'Xtest_wincolor') let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8}) call term_wait(buf) call term_sendkeys(buf, "2G5lvj") diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim index 1b4da6f41a..78835b2ccf 100644 --- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -100,22 +100,22 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert ernop - zx cvn. as dfg? hjkl iop! ert ernop + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert ernop + zx cvn. as dfg? hjkl iop! ert ernop [DATA] call assert_equal(expected, getline(1, '$')) @@ -142,22 +142,22 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert enop - zx cvn. as dfg? hjkl iop! ert ernop + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert enop + zx cvn. as dfg? hjkl iop! ert ernop [DATA] @@ -176,21 +176,21 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert a + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert a [DATA] call assert_equal(expected, getline(1, '$')) @@ -255,18 +255,18 @@ action(); " Expected output let expected =<< trim [CODE] -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. -action(); -if (condition) // Remove the next comment leader! OK, I will. -action(); -} + { + /* Make sure the previous comment leader is not removed. */ + /* Make sure the previous comment leader is not removed. */ + // Should the next comment leader be left alone? Yes. + // Should the next comment leader be left alone? Yes. + /* Here the comment leader should be left intact. */ // And so should this one. + /* Here the comment leader should be left intact. */ // And so should this one. + if (condition) // Remove the next comment leader! OK, I will. + action(); + if (condition) // Remove the next comment leader! OK, I will. + action(); + } [CODE] call assert_equal(expected, getline(1, '$')) @@ -378,30 +378,30 @@ int i = 7 /* foo *// 3 exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>" " Expected output - let expected =<< [CODE] -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -int i = 7 /* foo *// 3 // comment - ; -int i = 7 /* foo *// 3 // comment - ; -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. - -Some code!// Make sure backspacing does not remove this comment leader. -} -[CODE] + let expected =<< trim [CODE] + { + /* Make sure the previous comment leader is not removed. */ + /* Make sure the previous comment leader is not removed. */ + /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ + /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ + // Should the next comment leader be left alone? Yes. + // Should the next comment leader be left alone? Yes. + /* Here the comment leader should be left intact. */ // And so should this one. + /* Here the comment leader should be left intact. */ // And so should this one. + if (condition) // Remove the next comment leader! OK, I will. + action(); + if (condition) // Remove the next comment leader! OK, I will. + action(); + int i = 7 /* foo *// 3 // comment + ; + int i = 7 /* foo *// 3 // comment + ; + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. + + Some code!// Make sure backspacing does not remove this comment leader. + } + [CODE] call assert_equal(expected, getline(1, '$')) close! diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index 4fa010bab6..7a547ce623 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -210,10 +210,18 @@ END END call assert_equal(['Line1', ' Line2', "\tLine3", ' END'], var1) + let var1 =<< trim !!! + Line1 + line2 + Line3 + !!! + !!! + call assert_equal(['Line1', ' line2', "\tLine3", '!!!',], var1) + let var1 =<< trim Line1 . - call assert_equal([' Line1'], var1) + call assert_equal(['Line1'], var1) " ignore "endfunc" let var1 =<< END diff --git a/src/testdir/test_memory_usage.vim b/src/testdir/test_memory_usage.vim index b51a110e01..debc9c1859 100644 --- a/src/testdir/test_memory_usage.vim +++ b/src/testdir/test_memory_usage.vim @@ -85,14 +85,15 @@ func Test_memory_func_capture_vargs() " Case: if a local variable captures a:000, funccall object will be free " just after it finishes. let testfile = 'Xtest.vim' - call writefile([ - \ 'func s:f(...)', - \ ' let x = a:000', - \ 'endfunc', - \ 'for _ in range(10000)', - \ ' call s:f(0)', - \ 'endfor', - \ ], testfile) + let lines =<< trim END + func s:f(...) + let x = a:000 + endfunc + for _ in range(10000) + call s:f(0) + endfor + END + call writefile(lines, testfile) let vim = s:vim_new() call vim.start('--clean', '-c', 'set noswapfile', testfile) @@ -122,14 +123,15 @@ func Test_memory_func_capture_lvars() " free until garbage collector runs, but after that memory usage doesn't " increase so much even when rerun Xtest.vim since system memory caches. let testfile = 'Xtest.vim' - call writefile([ - \ 'func s:f()', - \ ' let x = l:', - \ 'endfunc', - \ 'for _ in range(10000)', - \ ' call s:f()', - \ 'endfor', - \ ], testfile) + let lines =<< trim END + func s:f() + let x = l: + endfunc + for _ in range(10000) + call s:f() + endfor + END + call writefile(lines, testfile) let vim = s:vim_new() call vim.start('--clean', '-c', 'set noswapfile', testfile) diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim index 5708183ed4..8c6c854fab 100644 --- a/src/testdir/test_messages.vim +++ b/ |