diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-03-11 00:33:02 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-03-11 00:33:02 -0400 |
commit | 7c29aa10604162a4302c7b2686c1dcfcd5c206c8 (patch) | |
tree | 793f1356cdffe95092af91723955638ec0816014 /test/functional/legacy | |
parent | 51c6f38fcac82fb56965548631e913e8347dbe6a (diff) | |
parent | c9fefe2a7432d3ac1c9397d65abe2fb7f6c557cc (diff) | |
download | rneovim-7c29aa10604162a4302c7b2686c1dcfcd5c206c8.tar.gz rneovim-7c29aa10604162a4302c7b2686c1dcfcd5c206c8.tar.bz2 rneovim-7c29aa10604162a4302c7b2686c1dcfcd5c206c8.zip |
Merge #2029 'migrate legacy tests'
Diffstat (limited to 'test/functional/legacy')
-rw-r--r-- | test/functional/legacy/015_alignment_spec.lua | 258 | ||||
-rw-r--r-- | test/functional/legacy/084_curswant_spec.lua | 48 | ||||
-rw-r--r-- | test/functional/legacy/090_sha256_spec.lua | 64 | ||||
-rw-r--r-- | test/functional/legacy/091_context_variables_spec.lua | 176 | ||||
-rw-r--r-- | test/functional/legacy/095_regexp_multibyte_spec.lua | 270 | ||||
-rw-r--r-- | test/functional/legacy/098_scrollbind_spec.lua | 48 | ||||
-rw-r--r-- | test/functional/legacy/100_undo_level.lua | 142 | ||||
-rw-r--r-- | test/functional/legacy/103_visual_mode_reset.lua | 47 | ||||
-rw-r--r-- | test/functional/legacy/listlbr_utf8_spec.lua | 79 | ||||
-rw-r--r-- | test/functional/legacy/qf_title_spec.lua | 30 |
10 files changed, 1162 insertions, 0 deletions
diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua new file mode 100644 index 0000000000..e71f9d1c90 --- /dev/null +++ b/test/functional/legacy/015_alignment_spec.lua @@ -0,0 +1,258 @@ +-- Tests for :right on text with embedded TAB. +-- Also test formatting a paragraph. +-- Also test undo after ":%s" and formatting. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('alignment', function() + setup(clear) + + it('is working', function() + insert([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx + xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx + xx xxxxxxx. xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx + > xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + + execute('set tw=65') + + feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]]) + feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]]) + feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]]) + + execute('set fo+=tcroql tw=72') + + feed('/xxxxxxxx$<cr>') + feed('0gq6kk<cr>') + + -- Undo/redo here to make the next undo only work on the following changes. + feed('u<cr>') + execute('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq') + execute('/^aa') + feed('ggu<cr>') + + -- Assert buffer contents. + expect([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. + xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx + > xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + end) +end) diff --git a/test/functional/legacy/084_curswant_spec.lua b/test/functional/legacy/084_curswant_spec.lua new file mode 100644 index 0000000000..55df5d3e73 --- /dev/null +++ b/test/functional/legacy/084_curswant_spec.lua @@ -0,0 +1,48 @@ +-- Tests for curswant not changing when setting an option. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('curswant', function() + setup(clear) + + it('is working', function() + insert([[ + start target options + tabstop + timeoutlen + ttimeoutlen + end target options]]) + + source([[ + /^start target options$/+1,/^end target options$/-1 yank + let target_option_names = split(@0) + function TestCurswant(option_name) + normal! ggf8j + let curswant_before = winsaveview().curswant + execute 'let' '&'.a:option_name '=' '&'.a:option_name + let curswant_after = winsaveview().curswant + return [a:option_name, curswant_before, curswant_after] + endfunction + + new + put =['1234567890', '12345'] + 1 delete _ + let result = [] + for option_name in target_option_names + call add(result, TestCurswant(option_name)) + endfor + + new + put =map(copy(result), 'join(v:val, '' '')') + 1 delete _ + ]]) + + -- Assert buffer contents. + expect([[ + tabstop 7 4 + timeoutlen 7 7 + ttimeoutlen 7 7]]) + end) +end) diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua new file mode 100644 index 0000000000..35fbd5752e --- /dev/null +++ b/test/functional/legacy/090_sha256_spec.lua @@ -0,0 +1,64 @@ +-- Tests for sha256() function. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('sha256()', function() + setup(clear) + + it('is working', function() + insert("start:") + + source([[ + let testcase='test for empty string: ' + if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 1 char: ' + if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 3 chars: ' + if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains meta char: ' + if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains non-ascii char: ' + if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + ]]) + + -- Assert buffer contents. + expect([[ + start: + test for empty string: ok + test for 1 char: ok + test for 3 chars: ok + test for contains meta char: ok + test for contains non-ascii char: ok]]) + end) +end) diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua new file mode 100644 index 0000000000..bb9c32b84f --- /dev/null +++ b/test/functional/legacy/091_context_variables_spec.lua @@ -0,0 +1,176 @@ +-- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('context variables', function() + setup(clear) + + it('is working', function() + insert("start:") + + -- Test for getbufvar(). + -- Use strings to test for memory leaks. + source([[ + let b:var_num = '1234' + let def_num = '5678' + $put =string(getbufvar(1, 'var_num')) + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + unlet b:var_num + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + $put =string(getbufvar(9, '')) + $put =string(getbufvar(9, '', def_num)) + unlet def_num + $put =string(getbufvar(1, '&autoindent')) + $put =string(getbufvar(1, '&autoindent', 1)) + ]]) + + -- Open new window with forced option values. + source([[ + set fileformats=unix,dos + new ++ff=dos ++bin ++enc=iso-8859-2 + let otherff = getbufvar(bufnr('%'), '&fileformat') + let otherbin = getbufvar(bufnr('%'), '&bin') + let otherfenc = getbufvar(bufnr('%'), '&fenc') + close + $put =otherff + $put =string(otherbin) + $put =otherfenc + unlet otherff otherbin otherfenc + ]]) + + -- Test for getwinvar(). + source([[ + let w:var_str = "Dance" + let def_str = "Chance" + $put =string(getwinvar(1, 'var_str')) + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + unlet w:var_str + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + $put =string(getwinvar(9, '')) + $put =string(getwinvar(9, '', def_str)) + $put =string(getwinvar(1, '&nu')) + $put =string(getwinvar(1, '&nu', 1)) + unlet def_str + ]]) + + -- Test for gettabvar(). + source([[ + tabnew + tabnew + let t:var_list = [1, 2, 3] + let t:other = 777 + let def_list = [4, 5, 6, 7] + tabrewind + $put =string(gettabvar(3, 'var_list')) + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(3, '')) + $put =string(gettabvar(3, '', def_list)) + tablast + unlet t:var_list + tabrewind + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(9, '')) + $put =string(gettabvar(9, '', def_list)) + $put =string(gettabvar(3, '&nu')) + $put =string(gettabvar(3, '&nu', def_list)) + unlet def_list + tabonly + ]]) + + -- Test for gettabwinvar(). + source([[ + tabnew + tabnew + tabprev + split + split + wincmd w + vert split + wincmd w + let w:var_dict = {'dict': 'tabwin'} + let def_dict = {'dict2': 'newval'} + wincmd b + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict')) + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + tabnext + 3wincmd w + unlet w:var_dict + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + $put =string(gettabwinvar(2, 9, '')) + $put =string(gettabwinvar(2, 9, '', def_dict)) + $put =string(gettabwinvar(9, 3, '')) + $put =string(gettabwinvar(9, 3, '', def_dict)) + unlet def_dict + $put =string(gettabwinvar(2, 3, '&nux')) + $put =string(gettabwinvar(2, 3, '&nux', 1)) + tabonly + ]]) + + -- Assert buffer contents. + expect([[ + start: + '1234' + '1234' + {'var_num': '1234'} + {'var_num': '1234'} + '5678' + {} + {} + '' + '5678' + 0 + 0 + dos + 1 + iso-8859-2 + 'Dance' + 'Dance' + {'var_str': 'Dance'} + {'var_str': 'Dance'} + 'Chance' + {} + {} + '' + 'Chance' + 0 + 0 + [1, 2, 3] + [1, 2, 3] + {'var_list': [1, 2, 3], 'other': 777} + {'var_list': [1, 2, 3], 'other': 777} + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + {'dict': 'tabwin'} + {'dict': 'tabwin'} + {'var_dict': {'dict': 'tabwin'}} + {'var_dict': {'dict': 'tabwin'}} + {'dict2': 'newval'} + {} + {} + '' + {'dict2': 'newval'} + '' + {'dict2': 'newval'} + '' + 1]]) + end) +end) diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua new file mode 100644 index 0000000000..a72fb669d2 --- /dev/null +++ b/test/functional/legacy/095_regexp_multibyte_spec.lua @@ -0,0 +1,270 @@ +-- Test for regexp patterns with multi-byte support, using utf-8. +-- See test64 for the non-multi-byte tests. +-- A pattern that gives the expected result produces OK, so that we know it was +-- actually tried. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('regex with multi-byte', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test95:]]) + + source([=[ + set encoding=utf-8 nomore + let tl = [] + + call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) + call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes + call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) + call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) + call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) + + call add(tl, [2, '\p\+', 'ìa', 'ìa']) + call add(tl, [2, '\p*', 'aあ', 'aあ']) + + call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) + call add(tl, [2, '\f\+', '&*fname ', 'fname']) + + call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) + call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) + call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "a", "ca\u0300t"]) + call add(tl, [2, "ca", "ca\u0300t"]) + call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) + call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) + + call add(tl, [2, 'ú\Z', 'x']) + call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "\u05b9\\Z", "xyz"]) + call add(tl, [2, "\\Z\u05b9", "xyz"]) + call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) + call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) + call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + + call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) + + for t in tl + let re = t[0] + let pat = t[1] + let text = t[2] + let matchidx = 3 + for engine in [0, 1, 2] + if engine == 2 && re == 0 || engine == 1 && re == 1 + continue + endif + let ®expengine = engine + try + let l = matchlist(text, pat) + catch + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' + endtry + if len(l) == 0 && len(t) > matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' + elseif len(l) > 0 && len(t) == matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' + elseif len(t) > matchidx && l[0] != t[matchidx] + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' + else + $put ='OK ' . engine . ' - ' . pat + endif + if len(l) > 0 + for i in range(1, 9) + if len(t) <= matchidx + i + let e = '' + else + let e = t[matchidx + i] + endif + if l[i] != e + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' + endif + endfor + unlet i + endif + endfor + endfor + unlet t tl e l + + set regexpengine=1 ambiwidth=single + $put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=1 ambiwidth=double + $put ='eng 1 ambi double: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=single + $put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=double + $put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') + ]=]) + + -- Assert buffer contents. + expect([=[ + Results of test95: + OK 0 - [[:alpha:][=a=]]\+ + OK 1 - [[:alpha:][=a=]]\+ + OK 2 - [[:alpha:][=a=]]\+ + OK 0 - [[=a=]]\+ + OK 1 - [[=a=]]\+ + OK 2 - [[=a=]]\+ + OK 0 - [^ม ]\+ + OK 1 - [^ม ]\+ + OK 2 - [^ม ]\+ + OK 0 - [^ ]\+ + OK 1 - [^ ]\+ + OK 2 - [^ ]\+ + OK 0 - [ม[:alpha:][=a=]]\+ + OK 1 - [ม[:alpha:][=a=]]\+ + OK 2 - [ม[:alpha:][=a=]]\+ + OK 0 - \p\+ + OK 1 - \p\+ + OK 2 - \p\+ + OK 0 - \p* + OK 1 - \p* + OK 2 - \p* + OK 0 - \i\+ + OK 1 - \i\+ + OK 2 - \i\+ + OK 0 - \f\+ + OK 1 - \f\+ + OK 2 - \f\+ + OK 0 - .ม + OK 1 - .ม + OK 2 - .ม + OK 0 - .ม่ + OK 1 - .ม่ + OK 2 - .ม่ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - a + OK 1 - a + OK 2 - a + OK 0 - ca + OK 1 - ca + OK 2 - ca + OK 0 - à + OK 1 - à + OK 2 - à + OK 0 - a\%C + OK 1 - a\%C + OK 2 - a\%C + OK 0 - ca\%C + OK 1 - ca\%C + OK 2 - ca\%C + OK 0 - ca\%Ct + OK 1 - ca\%Ct + OK 2 - ca\%Ct + OK 0 - ú\Z + OK 1 - ú\Z + OK 2 - ú\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יְ\Z + OK 1 - יְ\Z + OK 2 - יְ\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\+\Z + OK 2 - ֹ\+\Z + OK 0 - \Zֹ\+ + OK 2 - \Zֹ\+ + OK 0 - [^[=a=]]\+ + OK 1 - [^[=a=]]\+ + OK 2 - [^[=a=]]\+ + eng 1 ambi single: 0 + eng 1 ambi double: 0 + eng 2 ambi single: 0 + eng 2 ambi double: 0]=]) + end) +end) diff --git a/test/functional/legacy/098_scrollbind_spec.lua b/test/functional/legacy/098_scrollbind_spec.lua new file mode 100644 index 0000000000..7b2059e38b --- /dev/null +++ b/test/functional/legacy/098_scrollbind_spec.lua @@ -0,0 +1,48 @@ +-- Test for 'scrollbind' causing an unexpected scroll of one of the windows. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('scrollbind', function() + setup(clear) + + it('is working', function() + source([[ + set laststatus=0 + let g:totalLines = &lines * 20 + let middle = g:totalLines / 2 + wincmd n + wincmd o + for i in range(1, g:totalLines) + call setline(i, 'LINE ' . i) + endfor + exe string(middle) + normal zt + normal M + aboveleft vert new + for i in range(1, g:totalLines) + call setline(i, 'line ' . i) + endfor + exe string(middle) + normal zt + normal M + setl scb | wincmd p + setl scb + wincmd w + let topLineLeft = line('w0') + wincmd p + let topLineRight = line('w0') + setl noscrollbind + wincmd p + setl noscrollbind + q! + %del _ + call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) + brewind + ]]) + + -- Assert buffer contents. + expect("Difference between the top lines (left - right): 0") + end) +end) diff --git a/test/functional/legacy/100_undo_level.lua b/test/functional/legacy/100_undo_level.lua new file mode 100644 index 0000000000..9143d9e540 --- /dev/null +++ b/test/functional/legacy/100_undo_level.lua @@ -0,0 +1,142 @@ +-- Tests for 'undolevel' setting being global-local + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('undolevel', function() + setup(clear) + + it('is working', function() + source([[ + set ul=5 + fu! FillBuffer() + for i in range(1,13) + put=i + exe "setg ul=" . &g:ul + endfor + endfu + fu! UndoLevel() + redir @z + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + redir end + $put z + endfu + + 0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + call FillBuffer() + setlocal undolevels< + earlier 10 + call UndoLevel() + set ff=unix + %yank A + %delete + + 0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' + setlocal ul=2 + call FillBuffer() + earlier 10 + call UndoLevel() + setlocal ul=10 + call UndoLevel() + set ff=unix + %yank A + %delete + setlocal undolevels< + redir @A + echo "global value shouldn't be changed and still be 5!" + echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + echo "" + redir end + + setglobal ul=50 + 1put ='global value should be changed to 50' + 2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' + call UndoLevel() + set ff=unix + %yank A + %delete + setglobal lispwords=foo,bar,baz + setlocal lispwords-=foo + setlocal lispwords+=quux + redir @A + echo "Testing 'lispwords' local value" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + echo '' + redir end + setlocal lispwords< + redir @A + echo "Testing 'lispwords' value reset" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + redir end + + 0put a + $d + ]]) + + -- Assert buffer contents. + expect([[ + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + undolevels=5 global + undolevels=-123456 local + TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + undolevels=5 global + undolevels=2 local + + undolevels=5 global + undolevels=10 local + + global value shouldn't be changed and still be 5! + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + undolevels=5 global + undolevels=-123456 local + + global value should be changed to 50 + THREE: expecting global undolevels: 50, local undolevels: -123456 (default) + + undolevels=50 global + undolevels=-123456 local + + Testing 'lispwords' local value + lispwords=foo,bar,baz + lispwords=bar,baz,quux + bar,baz,quux + + Testing 'lispwords' value reset + lispwords=foo,bar,baz + lispwords=foo,bar,baz + foo,bar,baz]]) + end) +end) diff --git a/test/functional/legacy/103_visual_mode_reset.lua b/test/functional/legacy/103_visual_mode_reset.lua new file mode 100644 index 0000000000..6b2f3bc1b6 --- /dev/null +++ b/test/functional/legacy/103_visual_mode_reset.lua @@ -0,0 +1,47 @@ +-- Test for visual mode not being reset causing E315 error. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('E315 error', function() + setup(clear) + + it('is working', function() + -- At this point there is no visual selection because :call reset it. + -- Let's restore the selection: + source([[ + let g:msg="Everything's fine." + function! TriggerTheProblem() + normal gv + '<,'>del _ + try + exe "normal \<Esc>" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry + endfunction + enew + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + ]]) + + -- NOTE: this has to be done by a call to a function because executing + -- :del the ex-way will require the colon operator which resets the + -- visual mode thus preventing the problem: + feed('GV:call TriggerTheProblem()<cr>') + + source([[ + %del _ + call append(line('$'), g:msg) + brewind + ]]) + + -- Assert buffer contents. + expect([[ + + Everything's fine.]]) + end) +end) diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua new file mode 100644 index 0000000000..303596976f --- /dev/null +++ b/test/functional/legacy/listlbr_utf8_spec.lua @@ -0,0 +1,79 @@ +-- Test for linebreak and list option in utf-8 mode + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('linebreak', function() + setup(clear) + + it('is working', function() + source([[ + set wildchar=^E + 10new + vsp + vert resize 20 + put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" + norm! zt + set ts=4 sw=4 sts=4 linebreak sbr=+ wrap + fu! ScreenChar(width) + let c='' + for j in range(1,4) + for i in range(1,a:width) + let c.=nr2char(screenchar(j, i)) + endfor + let c.="\n" + endfor + return c + endfu + fu! DoRecordScreen() + wincmd l + $put =printf(\"\n%s\", g:test) + $put =g:line + wincmd p + endfu + let g:test ="Test 1: set linebreak + set list + fancy listchars" + exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 2: set nolinebreak list" + set list nolinebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 3: set linebreak nolist" + $put =\"\t*mask = nil;\" + $ + norm! zt + set nolist linebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + ]]) + + -- Assert buffer contents. + expect([[ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + + Test 1: set linebreak + set list + fancy listchars + ▕———abcdef + +hijklmn▕——— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + + Test 2: set nolinebreak list + ▕———abcdef hijklmn▕— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + ¶ + *mask = nil; + + Test 3: set linebreak nolist + *mask = nil; + ~ + ~ + ~ ]]) + end) +end) diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua new file mode 100644 index 0000000000..aa005117be --- /dev/null +++ b/test/functional/legacy/qf_title_spec.lua @@ -0,0 +1,30 @@ +-- Tests for quickfix window's title + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('qf_title', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test_qf_title:]]) + + source([[ + set efm=%E%f:%l:%c:%m + cgetexpr ['file:1:1:message'] + let qflist=getqflist() + call setqflist(qflist, 'r') + copen + let g:quickfix_title=w:quickfix_title + wincmd p + $put =g:quickfix_title + ]]) + + -- Assert buffer contents. + expect([[ + Results of test_qf_title: + :setqflist()]]) + end) +end) |