aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/legacy/057_sort_spec.lua91
-rw-r--r--test/functional/legacy/059_utf8_spell_checking_spec.lua70
-rw-r--r--test/functional/legacy/eval_spec.lua696
-rw-r--r--test/functional/legacy/glob2regpat_spec.lua22
-rw-r--r--test/functional/legacy/increment_spec.lua723
-rw-r--r--test/functional/legacy/listlbr_utf8_spec.lua104
-rw-r--r--test/functional/legacy/quickfix_spec.lua18
7 files changed, 1688 insertions, 36 deletions
diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua
index 65defbae96..7eed31e292 100644
--- a/test/functional/legacy/057_sort_spec.lua
+++ b/test/functional/legacy/057_sort_spec.lua
@@ -600,39 +600,72 @@ describe(':sort', function()
eq('Vim(sort):E474: Invalid argument', eval('tmpvar'))
expect(text)
end)
-
+
it('binary', function()
insert([[
- 0b111000
- 0b101100
- 0b101001
- 0b101001
- 0b101000
- 0b000000
- 0b001000
- 0b010000
- 0b101000
- 0b100000
- 0b101010
- 0b100010
- 0b100100
- 0b100010]])
+ 0b111000
+ 0b101100
+ 0b101001
+ 0b101001
+ 0b101000
+ 0b000000
+ 0b001000
+ 0b010000
+ 0b101000
+ 0b100000
+ 0b101010
+ 0b100010
+ 0b100100
+ 0b100010]])
execute([[sort b]])
expect([[
- 0b000000
- 0b001000
- 0b010000
- 0b100000
- 0b100010
- 0b100010
- 0b100100
- 0b101000
- 0b101000
- 0b101001
- 0b101001
- 0b101010
- 0b101100
- 0b111000]])
+ 0b000000
+ 0b001000
+ 0b010000
+ 0b100000
+ 0b100010
+ 0b100010
+ 0b100100
+ 0b101000
+ 0b101000
+ 0b101001
+ 0b101001
+ 0b101010
+ 0b101100
+ 0b111000]])
end)
+ it('binary with leading characters', function()
+ insert([[
+ 0b100010
+ 0b010000
+ 0b101001
+ b0b101100
+ 0b100010
+ 0b100100
+ a0b001000
+ 0b101000
+ 0b101000
+ a0b101001
+ ab0b100000
+ 0b101010
+ 0b000000
+ b0b111000]])
+ execute([[sort b]])
+ expect([[
+ 0b000000
+ a0b001000
+ 0b010000
+ ab0b100000
+ 0b100010
+ 0b100010
+ 0b100100
+ 0b101000
+ 0b101000
+ 0b101001
+ a0b101001
+ 0b101010
+ b0b101100
+ b0b111000]])
+ end)
end)
diff --git a/test/functional/legacy/059_utf8_spell_checking_spec.lua b/test/functional/legacy/059_utf8_spell_checking_spec.lua
index 5794e875a0..63df387be3 100644
--- a/test/functional/legacy/059_utf8_spell_checking_spec.lua
+++ b/test/functional/legacy/059_utf8_spell_checking_spec.lua
@@ -31,8 +31,6 @@ describe("spell checking with 'encoding' set to utf-8", function()
RAR ?
BAD !
- #NOSPLITSUGS
-
PFX I N 1
PFX I 0 in .
@@ -92,8 +90,6 @@ describe("spell checking with 'encoding' set to utf-8", function()
RAR ?
BAD !
- #NOSPLITSUGS
-
PFX I N 1
PFX I 0 in .
@@ -300,6 +296,24 @@ describe("spell checking with 'encoding' set to utf-8", function()
tail/123
middle/77,1
]])
+ write_latin1('Xtest8.aff', [[
+ SET ISO8859-1
+
+ NOSPLITSUGS
+ ]])
+ write_latin1('Xtest8.dic', [[
+ 1234
+ foo
+ bar
+ faabar
+ ]])
+ write_latin1('Xtest9.aff', [[
+ ]])
+ write_latin1('Xtest9.dic', [[
+ 1234
+ foo
+ bar
+ ]])
write_latin1('Xtest-sal.aff', [[
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
@@ -314,8 +328,6 @@ describe("spell checking with 'encoding' set to utf-8", function()
RAR ?
BAD !
- #NOSPLITSUGS
-
PFX I N 1
PFX I 0 in .
@@ -483,6 +495,10 @@ describe("spell checking with 'encoding' set to utf-8", function()
os.remove('Xtest6.dic')
os.remove('Xtest7.aff')
os.remove('Xtest7.dic')
+ os.remove('Xtest8.aff')
+ os.remove('Xtest8.dic')
+ os.remove('Xtest9.aff')
+ os.remove('Xtest9.dic')
end)
-- Function to test .aff/.dic with list of good and bad words. This was a
@@ -940,4 +956,46 @@ describe("spell checking with 'encoding' set to utf-8", function()
leadprobar
['leadprebar', 'lead prebar', 'leadbar']]=])
end)
+
+ it('part 8-8', function()
+ insert([[
+ 8good: foo bar faabar
+ bad: foobar barfoo
+ badend
+ ]])
+ -- NOSPLITSUGS
+ test_one(8, 8)
+ -- Assert buffer contents.
+ execute('1,/^test 8-8/-1d')
+ expect([=[
+ test 8-8
+ # file: Xtest.utf-8.spl
+ bar
+ faabar
+ foo
+ -------
+ bad
+ ['bar', 'foo']
+ foobar
+ ['faabar', 'foo bar', 'bar']
+ barfoo
+ ['bar foo', 'bar', 'foo']]=])
+ end)
+
+ it('part 9-9', function()
+ insert([[
+ 9good: 0b1011 0777 1234 0x01ff
+ badend
+ ]])
+ -- NOSPLITSUGS
+ test_one(9, 9)
+ -- Assert buffer contents.
+ execute('1,/^test 9-9/-1d')
+ expect([=[
+ test 9-9
+ # file: Xtest.utf-8.spl
+ bar
+ foo
+ -------]=])
+ end)
end)
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
new file mode 100644
index 0000000000..05cd73dbd4
--- /dev/null
+++ b/test/functional/legacy/eval_spec.lua
@@ -0,0 +1,696 @@
+-- Test for various eval features.
+
+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
+local eq, eval, wait, write_file = helpers.eq, helpers.eval, helpers.wait, helpers.write_file
+
+local function has_clipboard()
+ clear()
+ return 1 == eval("has('clipboard')")
+end
+
+describe('eval', function()
+ setup(function()
+ write_file('test_eval_setup.vim', [[
+ set noswapfile
+ lang C
+
+ fun AppendRegContents(reg)
+ call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1)))
+ endfun
+
+ fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1)
+ call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1))
+ endfun
+
+ command -nargs=? AR :call AppendRegContents(<q-args>)
+
+ fun SetReg(...)
+ call call('setreg', a:000)
+ call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2]))
+ call AppendRegContents(a:1)
+ if a:1 isnot# '='
+ execute "silent normal! Go==\n==\e\"".a:1."P"
+ endif
+ endfun
+ ]])
+ end)
+ before_each(clear)
+ teardown(function()
+ os.remove('test_eval_setup.vim')
+ end)
+
+ it(':let', function()
+ execute('so test_eval_setup.vim')
+ execute([[let @" = 'abc']])
+ execute('AR "')
+ execute([[let @" = "abc\n"]])
+ source('AR "')
+ execute([[let @" = "abc\<C-m>"]])
+ execute('AR "')
+ execute([[let @= = '"abc"']])
+ execute('AR =')
+ expect([[
+
+ ": type v; value: abc (['abc']), expr: abc (['abc'])
+ ": type V; value: abc]].."\x00 (['abc']), expr: abc\x00"..[[ (['abc'])
+ ": type V; value: abc]].."\r\x00 (['abc\r']), expr: abc\r\x00 (['abc\r"..[['])
+ =: type v; value: abc (['abc']), expr: "abc" (['"abc"'])]])
+ end)
+
+ it('basic setreg() tests', function()
+ execute('so test_eval_setup.vim')
+ insert('{{{1 Basic setreg tests')
+ execute([[call SetReg('a', 'abcA', 'c')]])
+ execute([[call SetReg('b', 'abcB', 'v')]])
+ execute([[call SetReg('c', 'abcC', 'l')]])
+ execute([[call SetReg('d', 'abcD', 'V')]])
+ execute([[call SetReg('e', 'abcE', 'b')]])
+ execute([[call SetReg('f', 'abcF', "\<C-v>")]])
+ execute([[call SetReg('g', 'abcG', 'b10')]])
+ execute([[call SetReg('h', 'abcH', "\<C-v>10")]])
+ execute([[call SetReg('I', 'abcI')]])
+
+ feed('Go{{{1 Appending single lines with setreg()<esc>')
+ execute([[call SetReg('A', 'abcAc', 'c')]])
+ execute([[call SetReg('A', 'abcAl', 'l')]])
+ execute([[call SetReg('A', 'abcAc2','c')]])
+ execute([[call SetReg('b', 'abcBc', 'ca')]])
+ execute([[call SetReg('b', 'abcBb', 'ba')]])
+ execute([[call SetReg('b', 'abcBc2','ca')]])
+ execute([[call SetReg('b', 'abcBb2','b50a')]])
+ execute([[call SetReg('C', 'abcCl', 'l')]])
+ execute([[call SetReg('C', 'abcCc', 'c')]])
+ execute([[call SetReg('D', 'abcDb', 'b')]])
+ execute([[call SetReg('E', 'abcEb', 'b')]])
+ execute([[call SetReg('E', 'abcEl', 'l')]])
+ execute([[call SetReg('F', 'abcFc', 'c')]])
+ expect([[
+ {{{1 Basic setreg tests
+ {{{2 setreg('a', 'abcA', 'c')
+ a: type v; value: abcA (['abcA']), expr: abcA (['abcA'])
+ ==
+ =abcA=
+ {{{2 setreg('b', 'abcB', 'v')
+ b: type v; value: abcB (['abcB']), expr: abcB (['abcB'])
+ ==
+ =abcB=
+ {{{2 setreg('c', 'abcC', 'l')
+ c: type V; value: abcC]].."\x00 (['abcC']), expr: abcC\x00"..[[ (['abcC'])
+ ==
+ abcC
+ ==
+ {{{2 setreg('d', 'abcD', 'V')
+ d: type V; value: abcD]].."\x00 (['abcD']), expr: abcD\x00"..[[ (['abcD'])
+ ==
+ abcD
+ ==
+ {{{2 setreg('e', 'abcE', 'b')
+ e: type ]]..'\x16'..[[4; value: abcE (['abcE']), expr: abcE (['abcE'])
+ ==
+ =abcE=
+ {{{2 setreg('f', 'abcF', ']]..'\x16'..[[')
+ f: type ]]..'\x16'..[[4; value: abcF (['abcF']), expr: abcF (['abcF'])
+ ==
+ =abcF=
+ {{{2 setreg('g', 'abcG', 'b10')
+ g: type ]]..'\x16'..[[10; value: abcG (['abcG']), expr: abcG (['abcG'])
+ ==
+ =abcG =
+ {{{2 setreg('h', 'abcH', ']]..'\x16'..[[10')
+ h: type ]]..'\x16'..[[10; value: abcH (['abcH']), expr: abcH (['abcH'])
+ ==
+ =abcH =
+ {{{2 setreg('I', 'abcI')
+ I: type v; value: abcI (['abcI']), expr: abcI (['abcI'])
+ ==
+ =abcI=
+ {{{1 Appending single lines with setreg()
+ {{{2 setreg('A', 'abcAc', 'c')
+ A: type v; value: abcAabcAc (['abcAabcAc']), expr: abcAabcAc (['abcAabcAc'])
+ ==
+ =abcAabcAc=
+ {{{2 setreg('A', 'abcAl', 'l')
+ A: type V; value: abcAabcAcabcAl]].."\x00 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\x00"..[[ (['abcAabcAcabcAl'])
+ ==
+ abcAabcAcabcAl
+ ==
+ {{{2 setreg('A', 'abcAc2', 'c')
+ A: type v; value: abcAabcAcabcAl]].."\x00abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\x00"..[[abcAc2 (['abcAabcAcabcAl', 'abcAc2'])
+ ==
+ =abcAabcAcabcAl
+ abcAc2=
+ {{{2 setreg('b', 'abcBc', 'ca')
+ b: type v; value: abcBabcBc (['abcBabcBc']), expr: abcBabcBc (['abcBabcBc'])
+ ==
+ =abcBabcBc=
+ {{{2 setreg('b', 'abcBb', 'ba')
+ b: type ]]..'\x16'..[[5; value: abcBabcBcabcBb (['abcBabcBcabcBb']), expr: abcBabcBcabcBb (['abcBabcBcabcBb'])
+ ==
+ =abcBabcBcabcBb=
+ {{{2 setreg('b', 'abcBc2', 'ca')
+ b: type v; value: abcBabcBcabcBb]].."\x00abcBc2 (['abcBabcBcabcBb', 'abcBc2']), expr: abcBabcBcabcBb\x00"..[[abcBc2 (['abcBabcBcabcBb', 'abcBc2'])
+ ==
+ =abcBabcBcabcBb
+ abcBc2=
+ {{{2 setreg('b', 'abcBb2', 'b50a')
+ b: type ]].."\x1650; value: abcBabcBcabcBb\x00abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\x00"..[[abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2'])
+ ==
+ =abcBabcBcabcBb =
+ abcBc2abcBb2
+ {{{2 setreg('C', 'abcCl', 'l')
+ C: type V; value: abcC]].."\x00abcCl\x00 (['abcC', 'abcCl']), expr: abcC\x00abcCl\x00"..[[ (['abcC', 'abcCl'])
+ ==
+ abcC
+ abcCl
+ ==
+ {{{2 setreg('C', 'abcCc', 'c')
+ C: type v; value: abcC]].."\x00abcCl\x00abcCc (['abcC', 'abcCl', 'abcCc']), expr: abcC\x00abcCl\x00"..[[abcCc (['abcC', 'abcCl', 'abcCc'])
+ ==
+ =abcC
+ abcCl
+ abcCc=
+ {{{2 setreg('D', 'abcDb', 'b')
+ D: type ]].."\x165; value: abcD\x00abcDb (['abcD', 'abcDb']), expr: abcD\x00"..[[abcDb (['abcD', 'abcDb'])
+ ==
+ =abcD =
+ abcDb
+ {{{2 setreg('E', 'abcEb', 'b')
+ E: type ]].."\x165; value: abcE\x00abcEb (['abcE', 'abcEb']), expr: abcE\x00"..[[abcEb (['abcE', 'abcEb'])
+ ==
+ =abcE =
+ abcEb
+ {{{2 setreg('E', 'abcEl', 'l')
+ E: type V; value: abcE]].."\x00abcEb\x00abcEl\x00 (['abcE', 'abcEb', 'abcEl']), expr: abcE\x00abcEb\x00abcEl\x00"..[[ (['abcE', 'abcEb', 'abcEl'])
+ ==
+ abcE
+ abcEb
+ abcEl
+ ==
+ {{{2 setreg('F', 'abcFc', 'c')
+ F: type v; value: abcF]].."\x00abcFc (['abcF', 'abcFc']), expr: abcF\x00"..[[abcFc (['abcF', 'abcFc'])
+ ==
+ =abcF
+ abcFc=]])
+ end)
+
+ it('appending NL with setreg()', function()
+ execute('so test_eval_setup.vim')
+
+ execute([[call setreg('a', 'abcA2', 'c')]])
+ execute([[call setreg('b', 'abcB2', 'v')]])
+ execute([[call setreg('c', 'abcC2', 'l')]])
+ execute([[call setreg('d', 'abcD2', 'V')]])
+ execute([[call setreg('e', 'abcE2', 'b')]])
+ execute([[call setreg('f', 'abcF2', "\<C-v>")]])
+ -- These registers where set like this in the old test_eval.in but never
+ -- copied to the output buffer with SetReg(). They do not appear in
+ -- test_eval.ok. Therefore they are commented out.
+ --execute([[call setreg('g', 'abcG2', 'b10')]])
+ --execute([[call setreg('h', 'abcH2', "\<C-v>10")]])
+ --execute([[call setreg('I', 'abcI2')]])
+
+ execute([[call SetReg('A', "\n")]])
+ execute([[call SetReg('B', "\n", 'c')]])
+ execute([[call SetReg('C', "\n")]])
+ execute([[call SetReg('D', "\n", 'l')]])
+ execute([[call SetReg('E', "\n")]])
+ execute([[call SetReg('F', "\n", 'b')]])
+ expect([[
+
+ {{{2 setreg('A', ']]..'\x00'..[[')
+ A: type V; value: abcA2]].."\x00 (['abcA2']), expr: abcA2\x00"..[[ (['abcA2'])
+ ==
+ abcA2
+ ==
+ {{{2 setreg('B', ']]..'\x00'..[[', 'c')
+ B: type v; value: abcB2]].."\x00 (['abcB2', '']), expr: abcB2\x00"..[[ (['abcB2', ''])
+ ==
+ =abcB2
+ =
+ {{{2 setreg('C', ']]..'\x00'..[[')
+ C: type V; value: abcC2]].."\x00\x00 (['abcC2', '']), expr: abcC2\x00\x00"..[[ (['abcC2', ''])
+ ==
+ abcC2
+
+ ==
+ {{{2 setreg('D', ']]..'\x00'..[[', 'l')
+ D: type V; value: abcD2]].."\x00\x00 (['abcD2', '']), expr: abcD2\x00\x00"..[[ (['abcD2', ''])
+ ==
+ abcD2
+
+ ==
+ {{{2 setreg('E', ']]..'\x00'..[[')
+ E: type V; value: abcE2]].."\x00\x00 (['abcE2', '']), expr: abcE2\x00\x00"..[[ (['abcE2', ''])
+ ==
+ abcE2
+
+ ==
+ {{{2 setreg('F', ']]..'\x00'..[[', 'b')
+ F: type ]].."\x160; value: abcF2\x00 (['abcF2', '']), expr: abcF2\x00"..[[ (['abcF2', ''])
+ ==
+ =abcF2=
+ ]])
+ end)
+
+ it('setting and appending list with setreg()', function()
+ execute('so test_eval_setup.vim')
+
+ execute([[$put ='{{{1 Setting lists with setreg()']])
+ execute([=[call SetReg('a', ['abcA3'], 'c')]=])
+ execute([=[call SetReg('b', ['abcB3'], 'l')]=])
+ execute([=[call SetReg('c', ['abcC3'], 'b')]=])
+ execute([=[call SetReg('d', ['abcD3'])]=])
+ execute([=[call SetReg('e', [1, 2, 'abc', 3])]=])
+ execute([=[call SetReg('f', [1, 2, 3])]=])
+
+ execute([[$put ='{{{1 Appending lists with setreg()']])
+ execute([=[call SetReg('A', ['abcA3c'], 'c')]=])
+ execute([=[call SetReg('b', ['abcB3l'], 'la')]=])
+ execute([=[call SetReg('C', ['abcC3b'], 'lb')]=])
+ execute([=[call SetReg('D', ['abcD32'])]=])
+ execute([=[call SetReg('A', ['abcA32'])]=])
+ execute([=[call SetReg('B', ['abcB3c'], 'c')]=])
+ execute([=[call SetReg('C', ['abcC3l'], 'l')]=])
+ execute([=[call SetReg('D', ['abcD3b'], 'b')]=])
+ expect([[
+
+ {{{1 Setting lists with setreg()
+ {{{2 setreg('a', ['abcA3'], 'c')
+ a: type v; value: abcA3 (['abcA3']), expr: abcA3 (['abcA3'])
+ ==
+ =abcA3=
+ {{{2 setreg('b', ['abcB3'], 'l')
+ b: type V; value: abcB3]].."\x00 (['abcB3']), expr: abcB3\x00"..[[ (['abcB3'])
+ ==
+ abcB3
+ ==
+ {{{2 setreg('c', ['abcC3'], 'b')
+ c: type ]]..'\x16'..[[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3'])
+ ==
+ =abcC3=
+ {{{2 setreg('d', ['abcD3'])
+ d: type V; value: abcD3]].."\x00 (['abcD3']), expr: abcD3\x00"..[[ (['abcD3'])
+ ==
+ abcD3
+ ==
+ {{{2 setreg('e', [1, 2, 'abc', 3])
+ e: type V; value: 1]].."\x002\x00abc\x003\x00 (['1', '2', 'abc', '3']), expr: 1\x002\x00abc\x003\x00"..[[ (['1', '2', 'abc', '3'])
+ ==
+ 1
+ 2
+ abc
+ 3
+ ==
+ {{{2 setreg('f', [1, 2, 3])
+ f: type V; value: 1]].."\x002\x003\x00 (['1', '2', '3']), expr: 1\x002\x003\x00"..[[ (['1', '2', '3'])
+ ==
+ 1
+ 2
+ 3
+ ==
+ {{{1 Appending lists with setreg()
+ {{{2 setreg('A', ['abcA3c'], 'c')
+ A: type v; value: abcA3]].."\x00abcA3c (['abcA3', 'abcA3c']), expr: abcA3\x00"..[[abcA3c (['abcA3', 'abcA3c'])
+ ==
+ =abcA3
+ abcA3c=
+ {{{2 setreg('b', ['abcB3l'], 'la')
+ b: type V; value: abcB3]].."\x00abcB3l\x00 (['abcB3', 'abcB3l']), expr: abcB3\x00abcB3l\x00"..[[ (['abcB3', 'abcB3l'])
+ ==
+ abcB3
+ abcB3l
+ ==
+ {{{2 setreg('C', ['abcC3b'], 'lb')
+ C: type ]].."\x166; value: abcC3\x00abcC3b (['abcC3', 'abcC3b']), expr: abcC3\x00"..[[abcC3b (['abcC3', 'abcC3b'])
+ ==
+ =abcC3 =
+ abcC3b
+ {{{2 setreg('D', ['abcD32'])
+ D: type V; value: abcD3]].."\x00abcD32\x00 (['abcD3', 'abcD32']), expr: abcD3\x00abcD32\x00"..[[ (['abcD3', 'abcD32'])
+ ==
+ abcD3
+ abcD32
+ ==
+ {{{2 setreg('A', ['abcA32'])
+ A: type V; value: abcA3]].."\x00abcA3c\x00abcA32\x00 (['abcA3', 'abcA3c', 'abcA32']), expr: abcA3\x00abcA3c\x00abcA32\x00"..[[ (['abcA3', 'abcA3c', 'abcA32'])
+ ==
+ abcA3
+ abcA3c
+ abcA32
+ ==
+ {{{2 setreg('B', ['abcB3c'], 'c')
+ B: type v; value: abcB3]].."\x00abcB3l\x00abcB3c (['abcB3', 'abcB3l', 'abcB3c']), expr: abcB3\x00abcB3l\x00"..[[abcB3c (['abcB3', 'abcB3l', 'abcB3c'])
+ ==
+ =abcB3
+ abcB3l
+ abcB3c=
+ {{{2 setreg('C', ['abcC3l'], 'l')
+ C: type V; value: abcC3]].."\x00abcC3b\x00abcC3l\x00 (['abcC3', 'abcC3b', 'abcC3l']), expr: abcC3\x00abcC3b\x00abcC3l\x00"..[[ (['abcC3', 'abcC3b', 'abcC3l'])
+ ==
+ abcC3
+ abcC3b
+ abcC3l
+ ==
+ {{{2 setreg('D', ['abcD3b'], 'b')
+ D: type ]].."\x166; value: abcD3\x00abcD32\x00abcD3b (['abcD3', 'abcD32', 'abcD3b']), expr: abcD3\x00abcD32\x00"..[[abcD3b (['abcD3', 'abcD32', 'abcD3b'])
+ ==
+ =abcD3 =
+ abcD32
+ abcD3b]])
+
+ -- From now on we delete the buffer contents after each expect() to make
+ -- the next expect() easier to write. This is neccessary because null
+ -- bytes on a line by itself don't play well together with the dedent
+ -- function used in expect().
+ execute('%delete')
+ execute([[$put ='{{{1 Appending lists with NL with setreg()']])
+ execute([=[call SetReg('A', ["\n", 'abcA3l2'], 'l')]=])
+ expect(
+ '\n'..
+ '{{{1 Appending lists with NL with setreg()\n'..
+ "{{{2 setreg('A', ['\x00', 'abcA3l2'], 'l')\n"..
+ "A: type V; value: abcA3\x00abcA3c\x00abcA32\x00\x00\x00abcA3l2\x00 (['abcA3', 'abcA3c', 'abcA32', '\x00', 'abcA3l2']), expr: abcA3\x00abcA3c\x00abcA32\x00\x00\x00abcA3l2\x00 (['abcA3', 'abcA3c', 'abcA32', '\x00', 'abcA3l2'])\n"..
+ '==\n'..
+ 'abcA3\n'..
+ 'abcA3c\n'..
+ 'abcA32\n'..
+ '\x00\n'..
+ 'abcA3l2\n'..
+ '==')
+ execute('%delete')
+ execute([=[call SetReg('B', ["\n", 'abcB3c2'], 'c')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('B', ['\x00', 'abcB3c2'], 'c')\n"..
+ "B: type v; value: abcB3\x00abcB3l\x00abcB3c\x00\x00\x00abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\x00', 'abcB3c2']), expr: abcB3\x00abcB3l\x00abcB3c\x00\x00\x00abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\x00', 'abcB3c2'])\n"..
+ '==\n'..
+ '=abcB3\n'..
+ 'abcB3l\n'..
+ 'abcB3c\n'..
+ '\x00\n'..
+ 'abcB3c2=')
+ execute('%delete')
+ execute([=[call SetReg('C', ["\n", 'abcC3b2'], 'b')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('C', ['\x00', 'abcC3b2'], 'b')\n"..
+ "C: type \x167; value: abcC3\x00abcC3b\x00abcC3l\x00\x00\x00abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\x00', 'abcC3b2']), expr: abcC3\x00abcC3b\x00abcC3l\x00\x00\x00abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\x00', 'abcC3b2'])\n"..
+ '==\n'..
+ '=abcC3 =\n'..
+ ' abcC3b\n'..
+ ' abcC3l\n'..
+ ' \x00\n'..
+ ' abcC3b2')
+ execute('%delete')
+ execute([=[call SetReg('D', ["\n", 'abcD3b50'],'b50')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('D', ['\x00', 'abcD3b50'], 'b50')\n"..
+ "D: type \x1650; value: abcD3\x00abcD32\x00abcD3b\x00\x00\x00abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\x00', 'abcD3b50']), expr: abcD3\x00abcD32\x00abcD3b\x00\x00\x00abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\x00', 'abcD3b50'])\n"..
+ '==\n'..
+ '=abcD3 =\n'..
+ ' abcD32\n'..
+ ' abcD3b\n'..
+ ' \x00\n'..
+ ' abcD3b50')
+ end)
+
+ -- The tests for setting lists with NLs are split into seperate it() blocks
+ -- to make the expect() calls easier to write. Otherwise the null byte can
+ -- make trouble on a line on its own.
+ it('setting lists with NLs with setreg(), part 1', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('a', ['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2'])\n"..
+ "a: type V; value: abcA4-0\x00\x00\x00abcA4-2\x00\x00\x00abcA4-3\x00abcA4-4\x00abcA4-4-2\x00 (['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2']), expr: abcA4-0\x00\x00\x00abcA4-2\x00\x00\x00abcA4-3\x00abcA4-4\x00abcA4-4-2\x00 (['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2'])\n"..
+ '==\n'..
+ 'abcA4-0\n'..
+ '\x00\n'..
+ 'abcA4-2\x00\n'..
+ '\x00abcA4-3\n'..
+ 'abcA4-4\x00abcA4-4-2\n'..
+ '==')
+ end)
+
+ it('setting lists with NLs with setreg(), part 2', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('b', ['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2'], 'c')\n"..
+ "b: type v; value: abcB4c-0\x00\x00\x00abcB4c-2\x00\x00\x00abcB4c-3\x00abcB4c-4\x00abcB4c-4-2 (['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2']), expr: abcB4c-0\x00\x00\x00abcB4c-2\x00\x00\x00abcB4c-3\x00abcB4c-4\x00abcB4c-4-2 (['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2'])\n"..
+ '==\n'..
+ '=abcB4c-0\n'..
+ '\x00\n'..
+ 'abcB4c-2\x00\n'..
+ '\x00abcB4c-3\n'..
+ 'abcB4c-4\x00abcB4c-4-2=')
+ end)
+
+ it('setting lists with NLs with setreg(), part 3', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('c', ['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2'], 'l')\n"..
+ "c: type V; value: abcC4l-0\x00\x00\x00abcC4l-2\x00\x00\x00abcC4l-3\x00abcC4l-4\x00abcC4l-4-2\x00 (['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2']), expr: abcC4l-0\x00\x00\x00abcC4l-2\x00\x00\x00abcC4l-3\x00abcC4l-4\x00abcC4l-4-2\x00 (['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2'])\n"..
+ '==\n'..
+ 'abcC4l-0\n'..
+ '\x00\n'..
+ 'abcC4l-2\x00\n'..
+ '\x00abcC4l-3\n'..
+ 'abcC4l-4\x00abcC4l-4-2\n'..
+ '==')
+ end)
+ it('setting lists with NLs with setreg(), part 4', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('d', ['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2'], 'b')\n"..
+ "d: type \x1619; value: abcD4b-0\x00\x00\x00abcD4b-2\x00\x00\x00abcD4b-3\x00abcD4b-4\x00abcD4b-4-2 (['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2']), expr: abcD4b-0\x00\x00\x00abcD4b-2\x00\x00\x00abcD4b-3\x00abcD4b-4\x00abcD4b-4-2 (['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2'])\n"..
+ '==\n'..
+ '=abcD4b-0 =\n'..
+ ' \x00\n'..
+ ' abcD4b-2\x00\n'..
+ ' \x00abcD4b-3\n'..
+ ' abcD4b-4\x00abcD4b-4-2')
+ end)
+ it('setting lists with NLs with setreg(), part 5', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=])
+ expect(
+ '\n'..
+ "{{{2 setreg('e', ['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2'], 'b10')\n"..
+ "e: type \x1610; value: abcE4b10-0\x00\x00\x00abcE4b10-2\x00\x00\x00abcE4b10-3\x00abcE4b10-4\x00abcE4b10-4-2 (['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2']), expr: abcE4b10-0\x00\x00\x00abcE4b10-2\x00\x00\x00abcE4b10-3\x00abcE4b10-4\x00abcE4b10-4-2 (['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2'])\n"..
+ '==\n'..
+ '=abcE4b10-0=\n'..
+ ' \x00\n'..
+ ' abcE4b10-2\x00\n'..
+ ' \x00abcE4b10-3\n'..
+ ' abcE4b10-4\x00abcE4b10-4-2')
+ end)
+
+ it('search and expressions', function()
+ execute('so test_eval_setup.vim')
+ execute([=[call SetReg('/', ['abc/'])]=])
+ execute([=[call SetReg('/', ["abc/\n"])]=])
+ execute([=[call SetReg('=', ['"abc/"'])]=])
+ execute([=[call SetReg('=', ["\"abc/\n\""])]=])
+ expect([[
+
+ {{{2 setreg('/', ['abc/'])
+ /: type v; value: abc/ (['abc/']), expr: abc/ (['abc/'])
+ ==
+ =abc/=
+ {{{2 setreg('/', ['abc/]]..'\x00'..[['])
+ /: type v; value: abc/]].."\x00 (['abc/\x00']), expr: abc/\x00 (['abc/\x00"..[['])
+ ==
+ =abc/]]..'\x00'..[[=
+ {{{2 setreg('=', ['"abc/"'])
+ =: type v; value: abc/ (['abc/']), expr: "abc/" (['"abc/"'])
+ {{{2 setreg('=', ['"abc/]]..'\x00'..[["'])
+ =: type v; value: abc/]].."\x00 (['abc/\x00"..[[']), expr: "abc/]]..'\x00'..[[" (['"abc/]]..'\x00'..[["'])]])
+ end)
+
+ if has_clipboard() then
+ it('system clipboard', function()
+ insert([[
+ Some first line (this text was at the top of the old test_eval.in).
+
+ Note: system clipboard is saved, changed and restored.
+
+ clipboard contents
+ something else]])
+ execute('so test_eval_setup.vim')
+ -- Save and restore system clipboard.
+ execute("let _clipreg = ['*', getreg('*'), getregtype('*')]")
+ execute('let _clipopt = &cb')
+ execute("let &cb='unnamed'")
+ execute('5y')
+ execute('AR *')
+ execute('tabdo :windo :echo "hi"')
+ execute('6y')
+ execute('AR *')
+ execute('let &cb=_clipopt')
+ execute("call call('setreg', _clipreg)")
+ expect([[
+ Some first line (this text was at the top of the old test_eval.in).
+
+ Note: system clipboard is saved, changed and restored.
+
+ clipboard contents
+ something else
+ *: type V; value: clipboard contents]]..'\00'..[[ (['clipboard contents']), expr: clipboard contents]]..'\00'..[[ (['clipboard contents'])
+ *: type V; value: something else]]..'\00'..[[ (['something else']), expr: something else]]..'\00'..[[ (['something else'])]])
+ end)
+ else
+ pending('system clipboard not available', function() end)
+ end
+
+ it('errors', function()
+ source([[
+ fun ErrExe(str)
+ call append('$', 'Executing '.a:str)
+ try
+ execute a:str
+ catch
+ $put =v:exception
+ endtry
+ endfun]])
+ execute([[call ErrExe('call setreg()')]])
+ execute([[call ErrExe('call setreg(1)')]])
+ execute([[call ErrExe('call setreg(1, 2, 3, 4)')]])
+ execute([=[call ErrExe('call setreg([], 2)')]=])
+ execute([[call ErrExe('call setreg(1, {})')]])
+ execute([=[call ErrExe('call setreg(1, 2, [])')]=])
+ execute([=[call ErrExe('call setreg("/", ["1", "2"])')]=])
+ execute([=[call ErrExe('call setreg("=", ["1", "2"])')]=])
+ execute([=[call ErrExe('call setreg(1, ["", "", [], ""])')]=])
+ expect([[
+
+ Executing call setreg()
+ Vim(call):E119: Not enough arguments for function: setreg
+ Executing call setreg(1)
+ Vim(call):E119: Not enough arguments for function: setreg
+ Executing call setreg(1, 2, 3, 4)
+ Vim(call):E118: Too many arguments for function: setreg
+ Executing call setreg([], 2)
+ Vim(call):E730: using List as a String
+ Executing call setreg(1, {})
+ Vim(call):E731: using Dictionary as a String
+ Executing call setreg(1, 2, [])
+ Vim(call):E730: using List as a String
+ Executing call setreg("/", ["1", "2"])
+ Vim(call):E883: search pattern and expression register may not contain two or more lines
+ Executing call setreg("=", ["1", "2"])
+ Vim(call):E883: search pattern and expression register may not contain two or more lines
+ Executing call setreg(1, ["", "", [], ""])
+ Vim(call):E730: using List as a String]])
+ end)
+
+ it('function name not starting with a capital', function()
+ execute('try')
+ execute(' func! g:test()')
+ execute(' echo "test"')
+ execute(' endfunc')
+ execute('catch')
+ execute(' let tmp = v:exception')
+ execute('endtry')
+ eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()', eval('tmp'))
+ end)
+
+ it('Function name followed by #', function()
+ execute('try')
+ execute(' func! test2() "#')
+ execute(' echo "test2"')
+ execute(' endfunc')
+ execute('catch')
+ execute(' let tmp = v:exception')
+ execute('endtry')
+ eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#', eval('tmp'))
+ end)
+
+ it('function name includes a colon', function()
+ execute('try')
+ execute(' func! b:test()')
+ execute(' echo "test"')
+ execute(' endfunc')
+ execute('catch')
+ execute(' let tmp = v:exception')
+ execute('endtry')
+ eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()', eval('tmp'))
+ end)
+
+ it('function name starting with/without "g:", buffer-local funcref', function()
+ execute('function! g:Foo(n)')
+ execute(" $put ='called Foo(' . a:n . ')'")
+ execute('endfunction')
+ execute("let b:my_func = function('Foo')")
+ execute('call b:my_func(1)')
+ execute('echo g:Foo(2)')
+ execute('echo Foo(3)')
+ expect([[
+
+ called Foo(1)
+ called Foo(2)
+ called Foo(3)]])
+ end)
+
+ it('script-local function used in Funcref must exist', function()
+ source([[
+ " Vim script used in test_eval.in. Needed for script-local function.
+
+ func! s:Testje()
+ return "foo"
+ endfunc
+
+ let Bar = function('s:Testje')
+
+ $put ='s:Testje exists: ' . exists('s:Testje')
+ $put ='func s:Testje exists: ' . exists('*s:Testje')
+ $put ='Bar exists: ' . exists('Bar')
+ $put ='func Bar exists: ' . exists('*Bar')
+ ]])
+ expect([[
+
+ s:Testje exists: 0
+ func s:Testje exists: 1
+ Bar exists: 1
+ func Bar exists: 1]])
+ end)
+
+ it("using $ instead of '$' must give an error", function()
+ execute('try')
+ execute(" call append($, 'foobar')")
+ execute('catch')
+ execute(' let tmp = v:exception')
+ execute('endtry')
+ eq('Vim(call):E116: Invalid arguments for function append', eval('tmp'))
+ end)
+
+ it('getcurpos/setpos', function()
+ insert([[
+ 012345678
+ 012345678
+
+ start:]])
+ execute('/^012345678')
+ feed('6l')
+ execute('let sp = getcurpos()')
+ feed('0')
+ execute("call setpos('.', sp)")
+ feed('jyl')
+ execute('$put')
+ expect([[
+ 012345678
+ 012345678
+
+ start:
+ 6]])
+ end)
+end)
diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua
new file mode 100644
index 0000000000..357128bcb6
--- /dev/null
+++ b/test/functional/legacy/glob2regpat_spec.lua
@@ -0,0 +1,22 @@
+-- Tests for signs
+
+local helpers = require('test.functional.helpers')
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
+
+describe('glob2regpat()', function()
+ before_each(clear)
+
+ it('handles invalid input', function()
+ execute('call glob2regpat(1.33)')
+ helpers.feed('<cr>')
+ neq(nil, string.find(eval('v:errmsg'), '^E806:'))
+ end)
+ it('returns ^$ for empty input', function()
+ eq('^$', eval("glob2regpat('')"))
+ end)
+ it('handles valid input', function()
+ eq('^foo\\.', eval("glob2regpat('foo.*')"))
+ eq('\\.vim$', eval("glob2regpat('*.vim')"))
+ end)
+end)
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
new file mode 100644
index 0000000000..6139ec0b67
--- /dev/null
+++ b/test/functional/legacy/increment_spec.lua
@@ -0,0 +1,723 @@
+-- Tests for using Ctrl-A/Ctrl-X on visual selections
+
+local helpers = require('test.functional.helpers')
+local source, execute = helpers.source, helpers.execute
+local call, clear = helpers.call, helpers.clear
+local eq, nvim = helpers.eq, helpers.meths
+
+describe('Ctrl-A/Ctrl-X on visual selections', function()
+
+ before_each(function()
+ clear()
+ source([=[
+ " 1) Ctrl-A on visually selected number
+ " Text:
+ " foobar-10
+ " Expected:
+ " 1) Ctrl-A on start of line:
+ " foobar-9
+ " 2) Ctrl-A on visually selected "-10":
+ " foobar-9
+ " 3) Ctrl-A on visually selected "10":
+ " foobar-11
+ " 4) Ctrl-X on visually selected "-10"
+ " foobar-11
+ " 5) Ctrl-X on visually selected "10"
+ " foobar-9
+ func Test_visual_increment_01()
+ call setline(1, repeat(["foobaar-10"], 5))
+
+ call cursor(1, 1)
+ exec "norm! \<C-A>"
+ call assert_equal("foobaar-9", getline('.'))
+ call assert_equal([0, 1, 9, 0], getpos('.'))
+
+ call cursor(2, 1)
+ exec "norm! f-v$\<C-A>"
+ call assert_equal("foobaar-9", getline('.'))
+ call assert_equal([0, 2, 8, 0], getpos('.'))
+
+ call cursor(3, 1)
+ exec "norm! f1v$\<C-A>"
+ call assert_equal("foobaar-11", getline('.'))
+ call assert_equal([0, 3, 9, 0], getpos('.'))
+
+ call cursor(4, 1)
+ exec "norm! f-v$\<C-X>"
+ call assert_equal("foobaar-11", getline('.'))
+ call assert_equal([0, 4, 8, 0], getpos('.'))
+
+ call cursor(5, 1)
+ exec "norm! f1v$\<C-X>"
+ call assert_equal("foobaar-9", getline('.'))
+ call assert_equal([0, 5, 9, 0], getpos('.'))
+ endfunc
+
+ " 2) Ctrl-A on visually selected lines
+ " Text:
+ " 10
+ " 20
+ " 30
+ " 40
+ "
+ " Expected:
+ " 1) Ctrl-A on visually selected lines:
+ " 11
+ " 21
+ " 31
+ " 41
+ "
+ " 2) Ctrl-X on visually selected lines:
+ " 9
+ " 19
+ " 29
+ " 39
+ func Test_visual_increment_02()
+ call setline(1, ["10", "20", "30", "40"])
+ exec "norm! GV3k$\<C-A>"
+ call assert_equal(["11", "21", "31", "41"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, ["10", "20", "30", "40"])
+ exec "norm! GV3k$\<C-X>"
+ call assert_equal(["9", "19", "29", "39"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 3) g Ctrl-A on visually selected lines, with non-numbers in between
+ " Text:
+ " 10
+ "
+ " 20
+ "
+ " 30
+ "
+ " 40
+ "
+ " Expected:
+ " 1) 2 g Ctrl-A on visually selected lines:
+ " 12
+ "
+ " 24
+ "
+ " 36
+ "
+ " 48
+ " 2) 2 g Ctrl-X on visually selected lines
+ " 8
+ "
+ " 16
+ "
+ " 24
+ "
+ " 32
+ func Test_visual_increment_03()
+ call setline(1, ["10", "", "20", "", "30", "", "40"])
+ exec "norm! GV6k2g\<C-A>"
+ call assert_equal(["12", "", "24", "", "36", "", "48"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, ["10", "", "20", "", "30", "", "40"])
+ exec "norm! GV6k2g\<C-X>"
+ call assert_equal(["8", "", "16", "", "24", "", "32"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 4) Ctrl-A on non-number
+ " Text:
+ " foobar-10
+ " Expected:
+ " 1) visually select foobar:
+ " foobar-10
+ func Test_visual_increment_04()
+ call setline(1, ["foobar-10"])
+ exec "norm! vf-\<C-A>"
+ call assert_equal(["foobar-10"], getline(1, '$'))
+ " NOTE: I think this is correct behavior...
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 5) g<Ctrl-A> on letter
+ " Test:
+ " a
+ " a
+ " a
+ " a
+ " Expected:
+ " 1) g Ctrl-A on visually selected lines
+ " b
+ " c
+ " d
+ " e
+ func Test_visual_increment_05()
+ set nrformats+=alpha
+ call setline(1, repeat(["a"], 4))
+ exec "norm! GV3kg\<C-A>"
+ call assert_equal(["b", "c", "d", "e"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 6) g<Ctrl-A> on letter
+ " Test:
+ " z
+ " z
+ " z
+ " z
+ " Expected:
+ " 1) g Ctrl-X on visually selected lines
+ " y
+ " x
+ " w
+ " v
+ func Test_visual_increment_06()
+ set nrformats+=alpha
+ call setline(1, repeat(["z"], 4))
+ exec "norm! GV3kg\<C-X>"
+ call assert_equal(["y", "x", "w", "v"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 7) <Ctrl-A> on letter
+ " Test:
+ " 2
+ " 1
+ " 0
+ " -1
+ " -2
+ "
+ " Expected:
+ " 1) Ctrl-A on visually selected lines
+ " 3
+ " 2
+ " 1
+ " 0
+ " -1
+ "
+ " 2) Ctrl-X on visually selected lines
+ " 1
+ " 0
+ " -1
+ " -2
+ " -3
+ func Test_visual_increment_07()
+ call setline(1, ["2", "1", "0", "-1", "-2"])
+ exec "norm! GV4k\<C-A>"
+ call assert_equal(["3", "2", "1", "0", "-1"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, ["2", "1", "0", "-1", "-2"])
+ exec "norm! GV4k\<C-X>"
+ call assert_equal(["1", "0", "-1", "-2", "-3"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 8) Block increment on 0x9
+ " Text:
+ " 0x9
+ " 0x9
+ " Expected:
+ " 1) Ctrl-A on visually block selected region (cursor at beginning):
+ " 0xa
+ " 0xa
+ " 2) Ctrl-A on visually block selected region (cursor at end)
+ " 0xa
+ " 0xa
+ func Test_visual_increment_08()
+ call setline(1, repeat(["0x9"], 2))
+ exec "norm! \<C-V>j$\<C-A>"
+ call assert_equal(["0xa", "0xa"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, repeat(["0x9"], 2))
+ exec "norm! gg$\<C-V>+\<C-A>"
+ call assert_equal(["0xa", "0xa"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 9) Increment and redo
+ " Text:
+ " 2
+ " 2
+ "
+ " 3
+ " 3
+ "
+ " Expected:
+ " 1) 2 Ctrl-A on first 2 visually selected lines
+ " 4
+ " 4
+ " 2) redo (.) on 3
+ " 5
+ " 5
+ func Test_visual_increment_09()
+ call setline(1, ["2", "2", "", "3", "3", ""])
+ exec "norm! ggVj2\<C-A>"
+ call assert_equal(["4", "4", "", "3", "3", ""], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ exec "norm! 3j."
+ call assert_equal(["4", "4", "", "5", "5", ""], getline(1, '$'))
+ call assert_equal([0, 4, 1, 0], getpos('.'))
+ endfunc
+
+ " 10) sequentially decrement 1
+ " Text:
+ " 1
+ " 1
+ " 1
+ " 1
+ " Expected:
+ " 1) g Ctrl-X on visually selected lines
+ " 0
+ " -1
+ " -2
+ " -3
+ func Test_visual_increment_10()
+ call setline(1, repeat(["1"], 4))
+ exec "norm! GV3kg\<C-X>"
+ call assert_equal(["0", "-1", "-2", "-3"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 11) visually block selected indented lines
+ " Text:
+ " 1
+ " 1
+ " 1
+ " 1
+ " Expexted:
+ " 1) g Ctrl-A on block selected indented lines
+ " 2
+ " 1
+ " 3
+ " 4
+ func Test_visual_increment_11()
+ call setline(1, [" 1", "1", " 1", " 1"])
+ exec "norm! f1\<C-V>3jg\<C-A>"
+ call assert_equal([" 2", "1", " 3", " 4"], getline(1, '$'))
+ call assert_equal([0, 1, 5, 0], getpos('.'))
+ endfunc
+
+ " 12) visually selected several columns
+ " Text:
+ " 0 0
+ " 0 0
+ " 0 0
+ " Expected:
+ " 1) 'v' select last zero and first zeroes
+ " 0 1
+ " 1 0
+ " 1 0
+ func Test_visual_increment_12()
+ call setline(1, repeat(["0 0"], 3))
+ exec "norm! $v++\<C-A>"
+ call assert_equal(["0 1", "1 0", "1 0"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+ endfunc
+
+ " 13) visually selected part of columns
+ " Text:
+ " max: 100px
+ " max: 200px
+ " max: 300px
+ " max: 400px
+ " Expected:
+ " 1) 'v' on first two numbers Ctrl-A
+ " max: 110px
+ " max: 220px
+ " max: 330px
+ " max: 400px
+ " 2) 'v' on first two numbers Ctrl-X
+ " max: 90px
+ " max: 190px
+ " max: 290px
+ " max: 400px
+ func Test_visual_increment_13()
+ call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"])
+ exec "norm! f1\<C-V>l2j\<C-A>"
+ call assert_equal(["max: 110px", "max: 210px", "max: 310px", "max: 400px"], getline(1, '$'))
+ call assert_equal([0, 1, 6, 0], getpos('.'))
+
+ call setline(1, ["max: 100px", "max: 200px", "max: 300px", "max: 400px"])
+ exec "norm! ggf1\<C-V>l2j\<C-X>"
+ call assert_equal(["max: 90px", "max: 190px", "max: 290px", "max: 400px"], getline(1, '$'))
+ call assert_equal([0, 1, 6, 0], getpos('.'))
+ endfunc
+
+ " 14) redo in block mode
+ " Text:
+ " 1 1
+ " 1 1
+ " Expected:
+ " 1) Ctrl-a on first column, redo on second column
+ " 2 2
+ " 2 2
+ func Test_visual_increment_14()
+ call setline(1, repeat(["1 1"], 2))
+ exec "norm! G\<C-V>k\<C-A>w."
+ call assert_equal(["2 2", "2 2"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+ endfunc
+
+ " 15) block select single numbers
+ " Text:
+ " 101
+ " Expected:
+ " 1) Ctrl-a on visually selected zero
+ " 111
+ func Test_visual_increment_15()
+ call setline(1, ["101"])
+ exec "norm! lv\<C-A>"
+ call assert_equal(["111"], getline(1, '$'))
+ call assert_equal([0, 1, 2, 0], getpos('.'))
+ endfunc
+
+ " 16) increment right aligned numbers
+ " Text:
+ " 1
+ " 19
+ " 119
+ " Expected:
+ " 1) Ctrl-a on line selected region
+ " 2
+ " 20
+ " 120
+ func Test_visual_increment_16()
+ call setline(1, [" 1", " 19", " 119"])
+ exec "norm! VG\<C-A>"
+ call assert_equal([" 2", " 20", " 120"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 17) block-wise increment and redo
+ " Text:
+ " 100
+ " 1
+ "
+ " 100
+ " 1
+ "
+ " Expected:
+ " 1) Ctrl-V j $ on first block, afterwards '.' on second
+ " 101
+ " 2
+ "
+ " 101
+ " 2
+ func Test_visual_increment_17()
+ call setline(1, [" 100", " 1", "", " 100", " 1"])
+ exec "norm! \<C-V>j$\<C-A>2j."
+ call assert_equal([" 101", " 2", "", " 101", " 1"], getline(1, '$'))
+ call assert_equal([0, 3, 1, 0], getpos('.'))
+ endfunc
+
+ " 18) repeat of g<Ctrl-a>
+ " Text:
+ " 0
+ " 0
+ " 0
+ " 0
+ "
+ " Expected:
+ " 1) V 4j g<ctrl-a>, repeat twice afterwards with .
+ " 3
+ " 6
+ " 9
+ " 12
+ func Test_visual_increment_18()
+ call setline(1, repeat(["0"], 4))
+ exec "norm! GV3kg\<C-A>"
+ exec "norm! .."
+ call assert_equal(["3", "6", "9", "12"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 19) increment on number with nrformat including alpha
+ " Text:
+ " 1
+ " 1a
+ "
+ " Expected:
+ " 1) <Ctrl-V>j$ <ctrl-a>
+ " 2
+ " 2a
+ func Test_visual_increment_19()
+ set nrformats+=alpha
+ call setline(1, ["1", "1a"])
+ exec "norm! \<C-V>G$\<C-A>"
+ call assert_equal(["2", "2a"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 20) increment a single letter
+ " Text:
+ " a
+ "
+ " Expected:
+ " 1) <Ctrl-a> and cursor is on a
+ " b
+ func Test_visual_increment_20()
+ set nrformats+=alpha
+ call setline(1, ["a"])
+ exec "norm! \<C-A>"
+ call assert_equal(["b"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 21) block-wise increment on part of hexadecimal
+ " Text:
+ " 0x123456
+ "
+ " Expected:
+ " 1) Ctrl-V f3 <ctrl-a>
+ " 0x124456
+ func Test_visual_increment_21()
+ call setline(1, ["0x123456"])
+ exec "norm! \<C-V>f3\<C-A>"
+ call assert_equal(["0x124456"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 22) Block increment on 0b0
+ " Text:
+ " 0b1
+ " 0b1
+ " Expected:
+ " 1) Ctrl-A on visually block selected region (cursor at beginning):
+ " 0b10
+ " 0b10
+ " 2) Ctrl-A on visually block selected region (cursor at end)
+ " 0b10
+ " 0b10
+ func Test_visual_increment_22()
+ call setline(1, repeat(["0b1"], 2))
+ exec "norm! \<C-V>j$\<C-A>"
+ call assert_equal(repeat(["0b10"], 2), getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, repeat(["0b1"], 2))
+ exec "norm! $\<C-V>+\<C-A>"
+ call assert_equal(repeat(["0b10"], 2), getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 23) block-wise increment on part of binary
+ " Text:
+ " 0b1001
+ "
+ " Expected:
+ " 1) Ctrl-V 5l <ctrl-a>
+ " 0b1011
+ func Test_visual_increment_23()
+ call setline(1, ["0b1001"])
+ exec "norm! \<C-V>4l\<C-A>"
+ call assert_equal(["0b1011"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 24) increment hexadecimal
+ " Text:
+ " 0x0b1001
+ "
+ " Expected:
+ " 1) <ctrl-a>
+ " 0x0b1002
+ func Test_visual_increment_24()
+ call setline(1, ["0x0b1001"])
+ exec "norm! \<C-V>$\<C-A>"
+ call assert_equal(["0x0b1002"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 25) increment binary with nrformats including alpha
+ " Text:
+ " 0b1001a
+ "
+ " Expected:
+ " 1) <ctrl-a>
+ " 0b1010a
+ func Test_visual_increment_25()
+ set nrformats+=alpha
+ call setline(1, ["0b1001a"])
+ exec "norm! \<C-V>$\<C-A>"
+ call assert_equal(["0b1010a"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " 26) increment binary with 32 bits
+ " Text:
+ " 0b11111111111111111111111111111110
+ "
+ " Expected:
+ " 1) <ctrl-a>
+ " 0b11111111111111111111111111111111
+ func Test_visual_increment_26()
+ set nrformats+=alpha
+ call setline(1, ["0b11111111111111111111111111111110"])
+ exec "norm! \<C-V>$\<C-A>"
+ call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ set nrformats-=alpha
+ endfunc
+
+ " 27) increment with 'rightreft', if supported
+ func Test_visual_increment_27()
+ if exists('+rightleft')
+ set rightleft
+ call setline(1, ["1234 56"])
+
+ exec "norm! $\<C-A>"
+ call assert_equal(["1234 57"], getline(1, '$'))
+ call assert_equal([0, 1, 7, 0], getpos('.'))
+
+ exec "norm! \<C-A>"
+ call assert_equal(["1234 58"], getline(1, '$'))
+ call assert_equal([0, 1, 7, 0], getpos('.'))
+ set norightleft
+ endif
+ endfunc
+
+ " Tab code and linewise-visual inc/dec
+ func Test_visual_increment_28()
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! Vj\<C-A>"
+ call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! ggVj\<C-X>"
+ call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " Tab code and linewise-visual inc/dec with 'nrformats'+=alpha
+ func Test_visual_increment_29()
+ set nrformats+=alpha
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! Vj\<C-A>"
+ call assert_equal(["y\<TAB>10", "\<TAB>0"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! ggVj\<C-X>"
+ call assert_equal(["w\<TAB>10", "\<TAB>-2"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " Tab code and character-visual inc/dec
+ func Test_visual_increment_30()
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! f1vjf1\<C-A>"
+ call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! ggf1vjf1\<C-X>"
+ call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+ endfunc
+
+ " Tab code and blockwise-visual inc/dec
+ func Test_visual_increment_31()
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! f1\<C-V>jl\<C-A>"
+ call assert_equal(["x\<TAB>11", "\<TAB>0"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+
+ call setline(1, ["x\<TAB>10", "\<TAB>-1"])
+ exec "norm! ggf1\<C-V>jl\<C-X>"
+ call assert_equal(["x\<TAB>9", "\<TAB>-2"], getline(1, '$'))
+ call assert_equal([0, 1, 3, 0], getpos('.'))
+ endfunc
+
+ " Tab code and blockwise-visual decrement with 'linebreak' and 'showbreak'
+ func Test_visual_increment_32()
+ 28vnew dummy_31
+ set linebreak showbreak=+
+ call setline(1, ["x\<TAB>\<TAB>\<TAB>10", "\<TAB>\<TAB>\<TAB>\<TAB>-1"])
+ exec "norm! ggf0\<C-V>jg_\<C-X>"
+ call assert_equal(["x\<TAB>\<TAB>\<TAB>1-1", "\<TAB>\<TAB>\<TAB>\<TAB>-2"], getline(1, '$'))
+ call assert_equal([0, 1, 6, 0], getpos('.'))
+ bwipe!
+ endfunc
+
+ " Tab code and blockwise-visual increment with $
+ func Test_visual_increment_33()
+ call setline(1, ["\<TAB>123", "456"])
+ exec "norm! gg0\<C-V>j$\<C-A>"
+ call assert_equal(["\<TAB>124", "457"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " Tab code and blockwise-visual increment and redo
+ func Test_visual_increment_34()
+ call setline(1, ["\<TAB>123", " 456789"])
+ exec "norm! gg0\<C-V>j\<C-A>"
+ call assert_equal(["\<TAB>123", " 457789"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ exec "norm! .."
+ call assert_equal(["\<TAB>123", " 459789"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " Tab code, spaces and character-visual increment and redo
+ func Test_visual_increment_35()
+ call setline(1, ["\<TAB>123", " 123", "\<TAB>123", "\<TAB>123"])
+ exec "norm! ggvjf3\<C-A>..."
+ call assert_equal(["\<TAB>127", " 127", "\<TAB>123", "\<TAB>123"], getline(1, '$'))
+ call assert_equal([0, 1, 2, 0], getpos('.'))
+ endfunc
+
+ " Tab code, spaces and blockwise-visual increment and redo
+ func Test_visual_increment_36()
+ call setline(1, [" 123", "\<TAB>456789"])
+ exec "norm! G0\<C-V>kl\<C-A>"
+ call assert_equal([" 123", "\<TAB>556789"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+
+ exec "norm! ..."
+ call assert_equal([" 123", "\<TAB>856789"], getline(1, '$'))
+ call assert_equal([0, 1, 1, 0], getpos('.'))
+ endfunc
+
+ " block-wise increment and dot-repeat
+ " Text:
+ " 1 23
+ " 4 56
+ "
+ " Expected:
+ " 1) f2 Ctrl-V jl <ctrl-a>, repeat twice afterwards with .
+ " 1 26
+ " 4 59
+ "
+ " Try with and without indent.
+ func Test_visual_increment_37()
+ call setline(1, [" 1 23", " 4 56"])
+ exec "norm! ggf2\<C-V>jl\<C-A>.."
+ call assert_equal([" 1 26", " 4 59"], getline(1, 2))
+
+ call setline(1, ["1 23", "4 56"])
+ exec "norm! ggf2\<C-V>jl\<C-A>.."
+ call assert_equal(["1 26", "4 59"], getline(1, 2))
+ endfunc
+
+ " Check redo after the normal mode increment
+ func Test_visual_increment_38()
+ exec "norm! i10\<ESC>5\<C-A>."
+ call assert_equal(["20"], getline(1, '$'))
+ call assert_equal([0, 1, 2, 0], getpos('.'))
+ endfunc
+ ]=])
+ end)
+
+ for i = 1, 38 do
+ local id = string.format('%02d', i)
+
+ it('works on Test ' .. id, function()
+ execute('set nrformats&vi') -- &vi makes Vim compatible
+ call('Test_visual_increment_' .. id)
+ eq({}, nvim.get_vvar('errors'))
+ end)
+ end
+end)
diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua
index 69e7b87a21..df0e817533 100644
--- a/test/functional/legacy/listlbr_utf8_spec.lua
+++ b/test/functional/legacy/listlbr_utf8_spec.lua
@@ -2,6 +2,7 @@
local helpers = require('test.functional.helpers')
local source = helpers.source
+local feed = helpers.feed
local clear, expect = helpers.clear, helpers.expect
describe('linebreak', function()
@@ -32,16 +33,19 @@ describe('linebreak', function()
$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),4)
call DoRecordScreen()
+ "
let g:test ="Test 2: set nolinebreak list"
set list nolinebreak
redraw!
let line=ScreenChar(winwidth(0),4)
call DoRecordScreen()
+ "
let g:test ="Test 3: set linebreak nolist"
$put =\"\t*mask = nil;\"
$
@@ -50,6 +54,7 @@ describe('linebreak', function()
redraw!
let line=ScreenChar(winwidth(0),4)
call DoRecordScreen()
+ "
let g:test ="Test 4: set linebreak list listchars and concealing"
let c_defines=['#define ABCDE 1','#define ABCDEF 1','#define ABCDEFG 1','#define ABCDEFGH 1', '#define MSG_MODE_FILE 1','#define MSG_MODE_CONSOLE 2','#define MSG_MODE_FILE_AND_CONSOLE 3','#define MSG_MODE_FILE_THEN_CONSOLE 4']
call append('$', c_defines)
@@ -61,6 +66,84 @@ describe('linebreak', function()
redraw!
let line=ScreenChar(winwidth(0),7)
call DoRecordScreen()
+ "
+ let g:test ="Test 5: set linebreak list listchars and concealing part2"
+ let c_defines=['bbeeeeee ; some text']
+ call append('$', c_defines)
+ $
+ norm! zt
+ set nowrap ts=2 list linebreak listchars=tab:>- cole=2 concealcursor=n
+ syn clear
+ syn match meaning /;\s*\zs.*/
+ syn match hasword /^\x\{8}/ contains=word
+ syn match word /\<\x\{8}\>/ contains=beginword,endword contained
+ syn match beginword /\<\x\x/ contained conceal
+ syn match endword /\x\{6}\>/ contained
+ hi meaning guibg=blue
+ hi beginword guibg=green
+ hi endword guibg=red
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call DoRecordScreen()
+ "
+ let g:test ="Test 6: Screenattributes for comment"
+ $put =g:test
+ call append('$', ' /* and some more */')
+ exe "set ft=c ts=7 linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
+ syntax on
+ hi SpecialKey term=underline ctermfg=red guifg=red
+ let attr=[]
+ nnoremap <expr> GG ":let attr += ['".screenattr(screenrow(),screencol())."']\n"
+ $
+ norm! zt0
+ ]])
+ feed('GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl')
+ source([[
+ call append('$', ['ScreenAttributes for test6:'])
+ if attr[0] != attr[1] && attr[1] != attr[3] && attr[3] != attr[5]
+ call append('$', "Attribut 0 and 1 and 3 and 5 are different!")
+ else
+ call append('$', "Not all attributes are different")
+ endif
+ set cpo&vim linebreak selection=exclusive
+ let g:test ="Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char"
+ $put =g:test
+ ]])
+ feed("Golong line: <Esc>40afoobar <Esc>aTARGETÃ' at end<Esc>")
+ source([[
+ exe "norm! $3B\<C-v>eAx\<Esc>"
+ "
+ let g:test ="Test 9: a multibyte sign and colorcolumn"
+ let attr=[]
+ let attr2=[]
+ $put =''
+ $put ='a b c'
+ $put ='a b c'
+ set list nolinebreak cc=3
+ ]])
+ feed(':sign define foo text=<C-v>uff0b<CR>')
+ source([[
+ sign place 1 name=foo line=50 buffer=2
+ norm! 2kztj
+ let line1=line('.')
+ ]])
+ feed('0GGlGGlGGlGGl')
+ source([[
+ let line2=line('.')
+ let attr2=attr
+ let attr=[]
+ ]])
+ feed('0GGlGGlGGlGGl')
+ source([[
+ redraw!
+ let line=ScreenChar(winwidth(0),3)
+ call DoRecordScreen()
+ " expected: attr[2] is different because of colorcolumn
+ if attr[0] != attr2[0] || attr[1] != attr2[1] || attr[2] != attr2[2]
+ call append('$', "Screen attributes are different!")
+ else
+ call append('$', "Screen attributes are the same!")
+ endif
]])
-- Assert buffer contents.
@@ -102,6 +185,25 @@ describe('linebreak', function()
#define >CDEFGH>----1
#define >_FILE>--------->--->---1
#define >_CONSOLE>---------->---2
- #define >_FILE_AND_CONSOLE>---------3 ]])
+ #define >_FILE_AND_CONSOLE>---------3
+ bbeeeeee ; some text
+
+ Test 5: set linebreak list listchars and concealing part2
+ eeeeee>--->-;>some text
+ Test 6: Screenattributes for comment
+ /* and some more */
+ ScreenAttributes for test6:
+ Attribut 0 and 1 and 3 and 5 are different!
+ Test 8: set linebreak with visual block mode and v_b_A and selection=exclusive and multibyte char
+ long line: foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar TARGETÃx' at end
+
+ a b c
+ a b c
+
+ Test 9: a multibyte sign and colorcolumn
+ ¶
+ +a b c¶
+ a b c¶
+ Screen attributes are the same!]])
end)
end)
diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua
new file mode 100644
index 0000000000..7a9958b949
--- /dev/null
+++ b/test/functional/legacy/quickfix_spec.lua
@@ -0,0 +1,18 @@
+-- Test for the quickfix commands.
+
+local helpers = require('test.functional.helpers')
+local insert, source = helpers.insert, helpers.source
+local clear, expect = helpers.clear, helpers.expect
+
+describe('helpgrep', function()
+ before_each(clear)
+
+ it('works', function()
+ source([[
+ helpgrep quickfix
+ copen
+ " This wipes out the buffer, make sure that doesn't cause trouble.
+ cclose
+ ]])
+ end)
+end)