diff options
Diffstat (limited to 'test/old')
-rw-r--r-- | test/old/testdir/gen_opt_test.vim | 6 | ||||
-rw-r--r-- | test/old/testdir/setup.vim | 2 | ||||
-rw-r--r-- | test/old/testdir/test_diffmode.vim | 203 | ||||
-rw-r--r-- | test/old/testdir/test_let.vim | 20 | ||||
-rw-r--r-- | test/old/testdir/test_normal.vim | 16 | ||||
-rw-r--r-- | test/old/testdir/test_options.vim | 18 | ||||
-rw-r--r-- | test/old/testdir/test_popup.vim | 84 | ||||
-rw-r--r-- | test/old/testdir/test_search.vim | 33 | ||||
-rw-r--r-- | test/old/testdir/test_shell.vim | 14 |
9 files changed, 382 insertions, 14 deletions
diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 2127945624..fb0af3de0a 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -214,10 +214,12 @@ let test_values = { \ 'closeoff', 'hiddenoff', 'foldcolumn:0', 'foldcolumn:12', \ 'followwrap', 'internal', 'indent-heuristic', 'algorithm:myers', \ 'icase,iwhite', 'algorithm:minimal', 'algorithm:patience', - \ 'algorithm:histogram', 'linematch:5'], + \ 'algorithm:histogram', 'inline:none', 'inline:simple', + \ 'inline:char', 'inline:word', 'inline:char,inline:word', 'linematch:5'], \ ['xxx', 'foldcolumn:', 'foldcolumn:x', 'foldcolumn:xxx', \ 'linematch:', 'linematch:x', 'linematch:xxx', 'algorithm:', - \ 'algorithm:xxx', 'context:', 'context:x', 'context:xxx']], + \ 'algorithm:xxx', 'context:', 'context:x', 'context:xxx', + \ 'inline:xxx']], \ 'display': [['', 'lastline', 'truncate', 'uhex', 'lastline,uhex'], \ ['xxx']], \ 'eadirection': [['both', 'ver', 'hor'], ['xxx', 'ver,hor']], diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim index 87287a57ff..c077eb021a 100644 --- a/test/old/testdir/setup.vim +++ b/test/old/testdir/setup.vim @@ -3,7 +3,7 @@ if exists('s:did_load') set commentstring=/*\ %s\ */ set complete=.,w,b,u,t,i set define=^\\s*#\\s*define - set diffopt=internal,filler,closeoff + set diffopt=internal,filler,closeoff,inline:simple set directory^=. set display= set fillchars=vert:\|,foldsep:\|,fold:- diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 0d20085360..6a5054b37b 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -430,13 +430,13 @@ endfunc func Common_icase_test() edit one - call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve']) + call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#vϵ', 'Si⃗x', 'Se⃗ve⃗n']) redraw let normattr = screenattr(1, 1) diffthis botright vert new two - call setline(1, ['one', 'TWO', 'Three ', 'Four', 'fI=VE']) + call setline(1, ['one', 'TWO', 'Three ', 'Four', 'fI=VΕ', 'SI⃗x', 'SEvE⃗n']) diffthis redraw @@ -444,10 +444,13 @@ func Common_icase_test() call assert_equal(normattr, screenattr(2, 1)) call assert_notequal(normattr, screenattr(3, 1)) call assert_equal(normattr, screenattr(4, 1)) + call assert_equal(normattr, screenattr(6, 2)) + call assert_notequal(normattr, screenattr(7, 2)) let dtextattr = screenattr(5, 3) call assert_notequal(dtextattr, screenattr(5, 1)) call assert_notequal(dtextattr, screenattr(5, 5)) + call assert_notequal(dtextattr, screenattr(7, 4)) diffoff! %bwipe! @@ -779,10 +782,10 @@ endfunc func Test_diff_hlID() new - call setline(1, [1, 2, 3]) + call setline(1, [1, 2, 3, 'Yz', 'a dxxg',]) diffthis vnew - call setline(1, ['1x', 2, 'x', 3]) + call setline(1, ['1x', 2, 'x', 3, 'yx', 'abc defg']) diffthis redraw @@ -793,6 +796,26 @@ func Test_diff_hlID() call diff_hlID(2, 1)->synIDattr("name")->assert_equal("") call diff_hlID(3, 1)->synIDattr("name")->assert_equal("DiffAdd") eval 4->diff_hlID(1)->synIDattr("name")->assert_equal("") + call diff_hlID(5, 1)->synIDattr("name")->assert_equal("DiffText") + call diff_hlID(5, 2)->synIDattr("name")->assert_equal("DiffText") + + set diffopt+=icase " test that caching is invalidated by diffopt change + call diff_hlID(5, 1)->synIDattr("name")->assert_equal("DiffChange") + set diffopt-=icase + call diff_hlID(5, 1)->synIDattr("name")->assert_equal("DiffText") + + call diff_hlID(6, 1)->synIDattr("name")->assert_equal("DiffChange") + call diff_hlID(6, 2)->synIDattr("name")->assert_equal("DiffText") + call diff_hlID(6, 4)->synIDattr("name")->assert_equal("DiffText") + call diff_hlID(6, 7)->synIDattr("name")->assert_equal("DiffText") + call diff_hlID(6, 8)->synIDattr("name")->assert_equal("DiffChange") + set diffopt+=inline:char + call diff_hlID(6, 1)->synIDattr("name")->assert_equal("DiffChange") + call diff_hlID(6, 2)->synIDattr("name")->assert_equal("DiffTextAdd") + call diff_hlID(6, 4)->synIDattr("name")->assert_equal("DiffChange") + call diff_hlID(6, 7)->synIDattr("name")->assert_equal("DiffText") + call diff_hlID(6, 8)->synIDattr("name")->assert_equal("DiffChange") + set diffopt-=inline:char wincmd w call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange") @@ -2099,6 +2122,178 @@ func Test_diff_topline_noscroll() call StopVimInTerminal(buf) endfunc +" Test inline highlighting which shows what's different within each diff block +func Test_diff_inline() + CheckScreendump + + call WriteDiffFiles(0, [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2', {}) + call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w") + + call WriteDiffFiles(buf, ["abcdef ghi jk n", "x", "y"], ["aBcef gHi lm n", "y", "z"]) + call VerifyInternal(buf, "Test_diff_inline_01", "") + call VerifyInternal(buf, "Test_diff_inline_02", " diffopt+=inline:none") + + " inline:simple is the same as default + call VerifyInternal(buf, "Test_diff_inline_01", " diffopt+=inline:simple") + + call VerifyInternal(buf, "Test_diff_inline_03", " diffopt+=inline:char") + call VerifyInternal(buf, "Test_diff_inline_04", " diffopt+=inline:word") + + " multiple inline values will the last one + call VerifyInternal(buf, "Test_diff_inline_01", " diffopt+=inline:none,inline:char,inline:simple") + call VerifyInternal(buf, "Test_diff_inline_02", " diffopt+=inline:simple,inline:word,inline:none") + call VerifyInternal(buf, "Test_diff_inline_03", " diffopt+=inline:simple,inline:word,inline:char") + + " DiffTextAdd highlight + call term_sendkeys(buf, ":hi DiffTextAdd ctermbg=blue\<CR>") + call VerifyInternal(buf, "Test_diff_inline_05", " diffopt+=inline:char") + + " Live update in insert mode + call term_sendkeys(buf, "\<Esc>isometext") + call VerifyScreenDump(buf, "Test_diff_inline_06", {}) + call term_sendkeys(buf, "\<Esc>u") + + " icase simple scenarios + call VerifyInternal(buf, "Test_diff_inline_07", " diffopt+=inline:simple,icase") + call VerifyInternal(buf, "Test_diff_inline_08", " diffopt+=inline:char,icase") + call VerifyInternal(buf, "Test_diff_inline_09", " diffopt+=inline:word,icase") + + " diff algorithms should affect highlight + call WriteDiffFiles(buf, ["apples and oranges"], ["oranges and apples"]) + call VerifyInternal(buf, "Test_diff_inline_10", " diffopt+=inline:char") + call VerifyInternal(buf, "Test_diff_inline_11", " diffopt+=inline:char,algorithm:patience") + + " icase: composing chars and Unicode fold case edge cases + call WriteDiffFiles(buf, + \ ["1 - sigma in 6σ and Ὀδυσσεύς", "1 - angstrom in åå", "1 - composing: ii⃗I⃗"], + \ ["2 - Sigma in 6Σ and ὈΔΥΣΣΕΎΣ", "2 - Angstrom in ÅÅ", "2 - Composing: i⃗I⃗I⃗"]) + call VerifyInternal(buf, "Test_diff_inline_12", " diffopt+=inline:char") + call VerifyInternal(buf, "Test_diff_inline_13", " diffopt+=inline:char,icase") + + " wide chars + call WriteDiffFiles(buf, ["abc😅xde一", "f🚀g"], ["abcy😢de", "二f🚀g"]) + call VerifyInternal(buf, "Test_diff_inline_14", " diffopt+=inline:char,icase") + + " NUL char (\n below is internally substituted as NUL) + call WriteDiffFiles(buf, ["1\n34\n5\n6"], ["1234\n5", "6"]) + call VerifyInternal(buf, "Test_diff_inline_15", " diffopt+=inline:char") + + " word diff: always use first buffer's iskeyword and ignore others' for consistency + call WriteDiffFiles(buf, ["foo+bar test"], ["foo+baz test"]) + call VerifyInternal(buf, "Test_diff_inline_word_01", " diffopt+=inline:word") + + call term_sendkeys(buf, ":set iskeyword+=+\<CR>:diffupdate\<CR>") + call VerifyInternal(buf, "Test_diff_inline_word_02", " diffopt+=inline:word") + + call term_sendkeys(buf, ":set iskeyword&\<CR>:wincmd w\<CR>") + call term_sendkeys(buf, ":set iskeyword+=+\<CR>:wincmd w\<CR>:diffupdate\<CR>") + " Use the previous screen dump as 2nd buffer's iskeyword does not matter + call VerifyInternal(buf, "Test_diff_inline_word_01", " diffopt+=inline:word") + + call term_sendkeys(buf, ":windo set iskeyword&\<CR>:1wincmd w\<CR>") + + " char diff: should slide highlight to whitespace boundary if possible for + " better readability (by using forced indent-heuristics). A wrong result + " would be if the highlight is "Bar, prefix". It should be "prefixBar, " + " instead. + call WriteDiffFiles(buf, ["prefixFoo, prefixEnd"], ["prefixFoo, prefixBar, prefixEnd"]) + call VerifyInternal(buf, "Test_diff_inline_char_01", " diffopt+=inline:char") + + " char diff: small gaps between inline diff blocks will be merged during refine step + " - first segment: test that we iteratively merge small gaps after we merged + " adjacent blocks, but only with limited number (set to 4) of iterations. + " - second and third segments: show that we need a large enough adjacent block to + " trigger a merge. + " - fourth segment: small gaps are not merged when adjacent large block is + " on a different line. + call WriteDiffFiles(buf, + \ ["abcdefghijklmno", "anchor1", + \ "abcdefghijklmno", "anchor2", + \ "abcdefghijklmno", "anchor3", + \ "test", "multiline"], + \ ["a?c?e?g?i?k???o", "anchor1", + \ "a??de?????klmno", "anchor2", + \ "a??de??????lmno", "anchor3", + \ "t?s?", "??????i?e"]) + call VerifyInternal(buf, "Test_diff_inline_char_02", " diffopt+=inline:char") + + " Test multi-line blocks and whitespace + call WriteDiffFiles(buf, + \ ["this is ", "sometest text foo", "baz abc def ", "one", "word another word", "additional line"], + \ ["this is some test", "texts", "foo bar abX Yef ", "oneword another word"]) + call VerifyInternal(buf, "Test_diff_inline_multiline_01", " diffopt+=inline:char,iwhite") + call VerifyInternal(buf, "Test_diff_inline_multiline_02", " diffopt+=inline:word,iwhite") + call VerifyInternal(buf, "Test_diff_inline_multiline_03", " diffopt+=inline:char,iwhiteeol") + call VerifyInternal(buf, "Test_diff_inline_multiline_04", " diffopt+=inline:word,iwhiteeol") + call VerifyInternal(buf, "Test_diff_inline_multiline_05", " diffopt+=inline:char,iwhiteall") + call VerifyInternal(buf, "Test_diff_inline_multiline_06", " diffopt+=inline:word,iwhiteall") + + " newline should be highlighted too when 'list' is set + call term_sendkeys(buf, ":windo set list\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multiline_07", " diffopt+=inline:char") + call VerifyInternal(buf, "Test_diff_inline_multiline_08", " diffopt+=inline:char,iwhite") + call VerifyInternal(buf, "Test_diff_inline_multiline_09", " diffopt+=inline:char,iwhiteeol") + call VerifyInternal(buf, "Test_diff_inline_multiline_10", " diffopt+=inline:char,iwhiteall") + call term_sendkeys(buf, ":windo set nolist\<CR>") + + call StopVimInTerminal(buf) +endfunc + +func Test_diff_inline_multibuffer() + CheckScreendump + + call WriteDiffFiles3(0, [], [], []) + let buf = RunVimInTerminal('-d Xdifile1 Xdifile2 Xdifile3', {}) + call term_sendkeys(buf, ":windo set autoread\<CR>:1wincmd w\<CR>") + call term_sendkeys(buf, ":hi DiffTextAdd ctermbg=blue\<CR>") + + call WriteDiffFiles3(buf, + \ ["That is buffer1.", "anchor", "Some random text", "anchor"], + \ ["This is buffer2.", "anchor", "Some text", "anchor", "buffer2/3"], + \ ["This is buffer3. Last.", "anchor", "Some more", "text here.", "anchor", "only in buffer2/3", "not in buffer1"]) + call VerifyInternal(buf, "Test_diff_inline_multibuffer_01", " diffopt+=inline:char") + + " Close one of the buffers and make sure it updates correctly + call term_sendkeys(buf, ":diffoff\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_02", " diffopt+=inline:char") + + " Update text in the non-diff buffer and nothing should be changed + call term_sendkeys(buf, "\<Esc>isometext") + call VerifyScreenDump(buf, "Test_diff_inline_multibuffer_03", {}) + call term_sendkeys(buf, "\<Esc>u") + + call term_sendkeys(buf, ":diffthis\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_01", " diffopt+=inline:char") + + " Test that removing first buffer from diff will in turn use the next + " earliest buffer's iskeyword during word diff. + call WriteDiffFiles3(buf, + \ ["This+is=a-setence"], + \ ["This+is=another-setence"], + \ ["That+is=a-setence"]) + call term_sendkeys(buf, ":set iskeyword+=+\<CR>:2wincmd w\<CR>:set iskeyword+=-\<CR>:1wincmd w\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_04", " diffopt+=inline:word") + call term_sendkeys(buf, ":diffoff\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_05", " diffopt+=inline:word") + call term_sendkeys(buf, ":diffthis\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_04", " diffopt+=inline:word") + + " Test multi-buffer char diff refinement, and that removing a buffer from + " diff will update the others properly. + call WriteDiffFiles3(buf, + \ ["abcdefghijkYmYYY"], + \ ["aXXdXXghijklmnop"], + \ ["abcdefghijkYmYop"]) + call VerifyInternal(buf, "Test_diff_inline_multibuffer_06", " diffopt+=inline:char") + call term_sendkeys(buf, ":diffoff\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_07", " diffopt+=inline:char") + call term_sendkeys(buf, ":diffthis\<CR>") + call VerifyInternal(buf, "Test_diff_inline_multibuffer_06", " diffopt+=inline:char") + + call StopVimInTerminal(buf) +endfunc + func Test_diffget_diffput_linematch() CheckScreendump call delete('.Xdifile1.swp') diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim index 22a3a35f87..ec83de880c 100644 --- a/test/old/testdir/test_let.vim +++ b/test/old/testdir/test_let.vim @@ -93,6 +93,26 @@ func Test_let() let [l[0], l[1]] = [10, 20] call assert_equal([10, 20, 3], l) + " Test for using curly brace name in the LHS of an assignment + let listvar = [1, 2] + let s = 'listvar' + let {s} = [3, 4] + call assert_equal([3, 4], listvar) + + " Test for using curly brace name as a list and as list index in the LHS of + " an assignment + let listvar = [1, 2] + let idx = 1 + let s = 'listvar' + let {s}[0] = 10 + let s = 'idx' + let listvar[{s}] = 20 + call assert_equal([10, 20], listvar) + let s1 = 'listvar' + let s2 = 'idx' + let {s1}[{s2}] = 30 + call assert_equal([10, 30], listvar) + " Test for errors in conditional expression call assert_fails('let val = [] ? 1 : 2', 'E745:') call assert_fails('let val = 1 ? 5+ : 6', 'E121:') diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index 1d9609cbe1..b8011a81e4 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -2705,6 +2705,22 @@ func Test_normal33_g_cmd2() call assert_equal(87, col('.')) call assert_equal('E', getreg(0)) + " Have an odd number of chars in the line + norm! A. + call assert_equal(145, col('.')) + norm! gMyl + call assert_equal(73, col('.')) + call assert_equal('0', getreg(0)) + + " 'listchars' "eol" should not affect gM behavior + setlocal list listchars=eol:$ + norm! $ + call assert_equal(145, col('.')) + norm! gMyl + call assert_equal(73, col('.')) + call assert_equal('0', getreg(0)) + setlocal nolist + " Test for gM with Tab characters call setline('.', "\ta\tb\tc\td\te\tf") norm! gMyl diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index 9104098baa..f3dcb3bbb7 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -313,11 +313,18 @@ func Test_set_completion() call feedkeys(":set suffixes:\<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"set suffixes:.bak,~,.o,.h,.info,.swp,.obj', @:) - " Expand key codes. + " " Expand key codes. " call feedkeys(":set <H\<C-A>\<C-B>\"\<CR>", 'tx') " call assert_equal('"set <Help> <Home>', @:) - - " Expand terminal options. + " " <BackSpace> (alt name) and <BS> should both show up in auto-complete + " call feedkeys(":set <B\<C-A>\<C-B>\"\<CR>", 'tx') + " call assert_equal('"set <BackSpace> <Bar> <BS> <Bslash>', @:) + " " <ScrollWheelDown> has alt name <MouseUp> but it should not show up here + " " nor show up as duplicates + " call feedkeys(":set <ScrollWheel\<C-A>\<C-B>\"\<CR>", 'tx') + " call assert_equal('"set <ScrollWheelDown> <ScrollWheelLeft> <ScrollWheelRight> <ScrollWheelUp>', @:) + " + " " Expand terminal options. " call feedkeys(":set t_A\<C-A>\<C-B>\"\<CR>", 'tx') " call assert_equal('"set t_AB t_AF t_AU t_AL', @:) " call assert_fails('call feedkeys(":set <t_afoo>=\<C-A>\<CR>", "xt")', 'E474:') @@ -622,10 +629,11 @@ func Test_set_completion_string_values() " call assert_equal([], getcompletion('set completepopup=bogusname:', 'cmdline')) " set previewpopup& completepopup& - " diffopt: special handling of algorithm:<alg_list> + " diffopt: special handling of algorithm:<alg_list> and inline:<inline_type> call assert_equal('filler', getcompletion('set diffopt+=', 'cmdline')[0]) call assert_equal([], getcompletion('set diffopt+=iblank,foldcolumn:', 'cmdline')) call assert_equal('patience', getcompletion('set diffopt+=iblank,algorithm:pat*', 'cmdline')[0]) + call assert_equal('char', getcompletion('set diffopt+=iwhite,inline:ch*', 'cmdline')[0]) " highlight: special parsing, including auto-completing highlight groups " after ':' @@ -715,7 +723,7 @@ func Test_set_completion_string_values() call assert_equal([], getcompletion('set diffopt-=', 'cmdline')) " Test all possible values call assert_equal(['filler', 'context:', 'iblank', 'icase', 'iwhite', 'iwhiteall', 'iwhiteeol', 'horizontal', - \ 'vertical', 'closeoff', 'hiddenoff', 'foldcolumn:', 'followwrap', 'internal', 'indent-heuristic', 'algorithm:', 'linematch:'], + \ 'vertical', 'closeoff', 'hiddenoff', 'foldcolumn:', 'followwrap', 'internal', 'indent-heuristic', 'algorithm:', 'inline:', 'linematch:'], \ getcompletion('set diffopt=', 'cmdline')) set diffopt& diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 8f81db6213..c5591fac05 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1992,4 +1992,88 @@ func Test_pum_complete_with_special_characters() call StopVimInTerminal(buf) endfunc +func Test_pum_maxwidth() + CheckScreendump + + let lines =<< trim END + 123456789_123456789_123456789_a + 123456789_123456789_123456789_b + 123 + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('Xtest', {}) + + call term_sendkeys(buf, "G\"zyy") + call term_sendkeys(buf, "A\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_01', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=10\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_02', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=20\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_03', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pumwidth=20 pummaxwidth=8\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_04', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set lines=10 columns=32\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_09', {'rows': 10, 'cols': 32}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_maxwidth_multibyte() + CheckScreendump + + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [ + \ #{word: "123456789_123456789_123456789_"}, + \ #{word: "一二三四五六七八九十"}, + \ #{word: "abcdefghij"}, + \ #{word: "上下左右"}, + \ ] + endfunc + set omnifunc=Omni_test + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('-S Xtest', {}) + call TermWait(buf) + + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_05', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + call term_sendkeys(buf, ":set pummaxwidth=10\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_06', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_07', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>") + endif + + call term_sendkeys(buf, ":set pummaxwidth=2\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_08', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_search.vim b/test/old/testdir/test_search.vim index cd36f56f17..4e5cb574bd 100644 --- a/test/old/testdir/test_search.vim +++ b/test/old/testdir/test_search.vim @@ -1499,17 +1499,46 @@ func Test_large_hex_chars2() try /[\Ufffffc1f] catch - call assert_match('E486:', v:exception) + call assert_match('E1541:', v:exception) endtry try set re=1 /[\Ufffffc1f] catch - call assert_match('E486:', v:exception) + call assert_match('E1541:', v:exception) endtry set re& endfunc +func Test_large_hex_chars3() + " Validate max number of Unicode char + try + /[\UFFFFFFFF] + catch + call assert_match('E1541:', v:exception) + endtry + try + /[\UFFFFFFF] + catch + call assert_match('E486:', v:exception) + endtry + try + /\%#=2[\d32-\UFFFFFFFF] + catch + call assert_match('E1541:', v:exception) + endtry + try + /\%#=1[\UFFFFFFFF] + catch + call assert_match('E1541:', v:exception) + endtry + try + /\%#=1[\d32-\UFFFFFFFF] + catch + call assert_match('E945:', v:exception) + endtry +endfunc + func Test_one_error_msg() " This was also giving an internal error call assert_fails('call search(" \\((\\v[[=P=]]){185}+ ")', 'E871:') diff --git a/test/old/testdir/test_shell.vim b/test/old/testdir/test_shell.vim index 9499462a70..e30e9c9ec8 100644 --- a/test/old/testdir/test_shell.vim +++ b/test/old/testdir/test_shell.vim @@ -281,4 +281,18 @@ func Test_shell_no_prevcmd() call delete('Xtestdone') endfunc +func Test_shell_filter_buffer_with_nul_bytes() + CheckUnix + new + set noshelltemp + " \n is a NUL byte + let lines = ["aaa\nbbb\nccc\nddd\neee", "fff\nggg\nhhh\niii\njjj"] + call setline(1, lines) + %!cat + call assert_equal(lines, getline(1, '$')) + + set shelltemp& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |