aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/006_argument_list_spec.lua85
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua4
-rw-r--r--test/functional/legacy/025_jump_tag_hidden_spec.lua6
-rw-r--r--test/functional/legacy/030_fileformats_spec.lua2
-rw-r--r--test/functional/legacy/045_folding_spec.lua214
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua234
-rw-r--r--test/functional/legacy/063_match_and_matchadd_spec.lua100
-rw-r--r--test/functional/legacy/072_undo_file_spec.lua2
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua2
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua6
-rw-r--r--test/functional/legacy/arglist_spec.lua228
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua6
-rw-r--r--test/functional/legacy/breakindent_spec.lua44
-rw-r--r--test/functional/legacy/buffer_spec.lua59
-rw-r--r--test/functional/legacy/cmdline_spec.lua183
-rw-r--r--test/functional/legacy/delete_spec.lua2
-rw-r--r--test/functional/legacy/digraph_spec.lua46
-rw-r--r--test/functional/legacy/display_spec.lua148
-rw-r--r--test/functional/legacy/edit_spec.lua64
-rw-r--r--test/functional/legacy/eval_spec.lua2
-rw-r--r--test/functional/legacy/excmd_spec.lua8
-rw-r--r--test/functional/legacy/filechanged_spec.lua4
-rw-r--r--test/functional/legacy/fold_spec.lua335
-rw-r--r--test/functional/legacy/gf_spec.lua3
-rw-r--r--test/functional/legacy/increment_spec.lua2
-rw-r--r--test/functional/legacy/listlbr_spec.lua96
-rw-r--r--test/functional/legacy/match_spec.lua126
-rw-r--r--test/functional/legacy/memory_usage_spec.lua19
-rw-r--r--test/functional/legacy/messages_spec.lua189
-rw-r--r--test/functional/legacy/search_spec.lua73
-rw-r--r--test/functional/legacy/search_stat_spec.lua4
-rw-r--r--test/functional/legacy/source_spec.lua32
-rw-r--r--test/functional/legacy/statusline_spec.lua83
-rw-r--r--test/functional/legacy/substitute_spec.lua (renamed from test/functional/legacy/080_substitute_spec.lua)31
-rw-r--r--test/functional/legacy/syn_attr_spec.lua78
-rw-r--r--test/functional/legacy/tabline_spec.lua100
-rw-r--r--test/functional/legacy/vimscript_spec.lua90
-rw-r--r--test/functional/legacy/visual_mode_spec.lua25
-rw-r--r--test/functional/legacy/window_cmd_spec.lua227
39 files changed, 1959 insertions, 1003 deletions
diff --git a/test/functional/legacy/006_argument_list_spec.lua b/test/functional/legacy/006_argument_list_spec.lua
deleted file mode 100644
index d269bf8ec9..0000000000
--- a/test/functional/legacy/006_argument_list_spec.lua
+++ /dev/null
@@ -1,85 +0,0 @@
--- Test for autocommand that redefines the argument list, when doing ":all".
-
-local helpers = require('test.functional.helpers')(after_each)
-local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local command, dedent, eq = helpers.command, helpers.dedent, helpers.eq
-local curbuf_contents = helpers.curbuf_contents
-local poke_eventloop = helpers.poke_eventloop
-
-describe('argument list', function()
- setup(clear)
-
- it('is working', function()
- insert([[
- start of test file Xxx
- this is a test
- this is a test
- this is a test
- this is a test
- end of test file Xxx]])
- poke_eventloop()
-
- command('au BufReadPost Xxx2 next Xxx2 Xxx1')
- command('/^start of')
-
- -- Write test file Xxx1
- feed('A1<Esc>:.,/end of/w! Xxx1<cr>')
-
- -- Write test file Xxx2
- feed('$r2:.,/end of/w! Xxx2<cr>')
-
- -- Write test file Xxx3
- feed('$r3:.,/end of/w! Xxx3<cr>')
- poke_eventloop()
-
- -- Redefine arglist; go to Xxx1
- command('next! Xxx1 Xxx2 Xxx3')
-
- -- Open window for all args
- command('all')
-
- -- Write contents of Xxx1
- command('%yank A')
-
- -- Append contents of last window (Xxx1)
- feed('')
- poke_eventloop()
- command('%yank A')
-
- -- should now be in Xxx2
- command('rew')
-
- -- Append contents of Xxx2
- command('%yank A')
-
- command('%d')
- command('0put=@a')
- command('$d')
-
- eq(dedent([[
- start of test file Xxx1
- this is a test
- this is a test
- this is a test
- this is a test
- end of test file Xxx
- start of test file Xxx1
- this is a test
- this is a test
- this is a test
- this is a test
- end of test file Xxx
- start of test file Xxx2
- this is a test
- this is a test
- this is a test
- this is a test
- end of test file Xxx]]), curbuf_contents())
- end)
-
- teardown(function()
- os.remove('Xxx1')
- os.remove('Xxx2')
- os.remove('Xxx3')
- end)
-end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 0fa9290f3c..7ae851467f 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -18,11 +18,11 @@ local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
local command = helpers.command
-local iswin = helpers.iswin
local read_file = helpers.read_file
+local is_os = helpers.is_os
local function has_gzip()
- local null = iswin() and 'nul' or '/dev/null'
+ local null = is_os('win') and 'nul' or '/dev/null'
return os.execute('gzip --help >' .. null .. ' 2>&1') == 0
end
diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua
index dd89a3680e..15bd56a601 100644
--- a/test/functional/legacy/025_jump_tag_hidden_spec.lua
+++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua
@@ -23,7 +23,7 @@ describe('jump to a tag with hidden set', function()
feed_command('set hidden')
-- Create a link from test25.dir to the current directory.
- if helpers.iswin() then
+ if helpers.is_os('win') then
feed_command('!rd /q/s test25.dir')
feed_command('!mklink /j test25.dir .')
else
@@ -33,7 +33,7 @@ describe('jump to a tag with hidden set', function()
-- Create tags.text, with the current directory name inserted.
feed_command('/tags line')
- feed_command('r !' .. (helpers.iswin() and 'cd' or 'pwd'))
+ feed_command('r !' .. (helpers.is_os('win') and 'cd' or 'pwd'))
feed('d$/test<cr>')
feed('hP:.w! tags.test<cr>')
@@ -44,7 +44,7 @@ describe('jump to a tag with hidden set', function()
feed('G<C-]> x:yank a<cr>')
feed_command("call delete('tags.test')")
feed_command("call delete('Xxx')")
- if helpers.iswin() then
+ if helpers.is_os('win') then
feed_command('!rd /q test25.dir')
else
feed_command('!rm -f test25.dir')
diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua
index 15dbd05cf5..e88afd9c47 100644
--- a/test/functional/legacy/030_fileformats_spec.lua
+++ b/test/functional/legacy/030_fileformats_spec.lua
@@ -255,7 +255,7 @@ describe('fileformats option', function()
-- Assert buffer contents. This has to be done manually as
-- helpers.expect() calls helpers.dedent() which messes up the white space
- -- and carrige returns.
+ -- and carriage returns.
eq(
'unix\n'..
'unix\n'..
diff --git a/test/functional/legacy/045_folding_spec.lua b/test/functional/legacy/045_folding_spec.lua
deleted file mode 100644
index 7d7856fd37..0000000000
--- a/test/functional/legacy/045_folding_spec.lua
+++ /dev/null
@@ -1,214 +0,0 @@
--- Tests for folding.
-local Screen = require('test.functional.ui.screen')
-
-local helpers = require('test.functional.helpers')(after_each)
-local feed, insert, feed_command, expect_any =
- helpers.feed, helpers.insert, helpers.feed_command, helpers.expect_any
-
-describe('folding', function()
- local screen
-
- before_each(function()
- helpers.clear()
-
- screen = Screen.new(20, 8)
- screen:attach()
- end)
-
- it('creation, opening, moving (to the end) and closing', function()
- insert([[
- 1 aa
- 2 bb
- 3 cc
- last
- ]])
-
- -- Basic test if a fold can be created, opened, moving to the end and
- -- closed.
- feed_command('1')
- feed('zf2j')
- feed_command('call append("$", "manual " . getline(foldclosed(".")))')
- feed('zo')
- feed_command('call append("$", foldclosed("."))')
- feed(']z')
- feed_command('call append("$", getline("."))')
- feed('zc')
- feed_command('call append("$", getline(foldclosed(".")))')
-
- expect_any([[
- manual 1 aa
- -1
- 3 cc
- 1 aa]])
- end)
-
- it("foldmethod=marker", function()
- screen:try_resize(20, 10)
- insert([[
- dd {{{
- ee {{{ }}}
- ff }}}
- ]])
- feed_command('set fdm=marker fdl=1')
- feed_command('2')
- feed_command('call append("$", "line 2 foldlevel=" . foldlevel("."))')
- feed('[z')
- feed_command('call append("$", foldlevel("."))')
- feed('jo{{ <esc>r{jj') -- writes '{{{' and moves 2 lines bot
- feed_command('call append("$", foldlevel("."))')
- feed('kYpj')
- feed_command('call append("$", foldlevel("."))')
-
- helpers.poke_eventloop()
- screen:expect([[
- dd {{{ |
- ee {{{ }}} |
- {{{ |
- ff }}} |
- ff }}} |
- ^ |
- line 2 foldlevel=2 |
- 1 |
- 1 |
- |
- ]])
-
- end)
-
- it("foldmethod=indent", function()
- screen:try_resize(20, 8)
- feed_command('set fdm=indent sw=2')
- insert([[
- aa
- bb
- cc
- last
- ]])
- feed_command('call append("$", "foldlevel line3=" . foldlevel(3))')
- feed_command('call append("$", foldlevel(2))')
- feed('zR')
-
- helpers.poke_eventloop()
- screen:expect([[
- aa |
- bb |
- cc |
- last |
- ^ |
- foldlevel line3=2 |
- 1 |
- |
- ]])
- end)
-
- it("foldmethod=syntax", function()
- screen:try_resize(35, 15)
- insert([[
- 1 aa
- 2 bb
- 3 cc
- 4 dd {{{
- 5 ee {{{ }}}
- 6 ff }}}
- 7 gg
- 8 hh
- 9 ii
- a jj
- b kk
- last]])
- feed_command('set fdm=syntax fdl=0')
- feed_command('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
- feed_command('syn region Fd1 start="ee" end="ff" fold contained')
- feed_command('syn region Fd2 start="gg" end="hh" fold contained')
- feed_command('syn region Fd3 start="commentstart" end="commentend" fold contained')
- feed('Gzk')
- feed_command('call append("$", "folding " . getline("."))')
- feed('k')
- feed_command('call append("$", getline("."))')
- feed('jAcommentstart <esc>Acommentend<esc>')
- feed_command('set fdl=1')
- feed('3j')
- feed_command('call append("$", getline("."))')
- feed_command('set fdl=0')
- feed('zO<C-L>j') -- <C-L> redraws screen
- feed_command('call append("$", getline("."))')
- feed_command('set fdl=0')
- expect_any([[
- folding 9 ii
- 3 cc
- 9 ii
- a jj]])
- end)
-
- it("foldmethod=expression", function()
- insert([[
- 1 aa
- 2 bb
- 3 cc
- 4 dd {{{
- 5 ee {{{ }}}
- 6 ff }}}
- 7 gg
- 8 hh
- 9 ii
- a jj
- b kk
- last ]])
-
- feed_command([[
- fun Flvl()
- let l = getline(v:lnum)
- if l =~ "bb$"
- return 2
- elseif l =~ "gg$"
- return "s1"
- elseif l =~ "ii$"
- return ">2"
- elseif l =~ "kk$"
- return "0"
- endif
- return "="
- endfun
- ]])
- feed_command('set fdm=expr fde=Flvl()')
- feed_command('/bb$')
- feed_command('call append("$", "expr " . foldlevel("."))')
- feed_command('/hh$')
- feed_command('call append("$", foldlevel("."))')
- feed_command('/ii$')
- feed_command('call append("$", foldlevel("."))')
- feed_command('/kk$')
- feed_command('call append("$", foldlevel("."))')
-
- expect_any([[
- expr 2
- 1
- 2
- 0]])
- end)
-
- it('can be opened after :move', function()
- -- luacheck: ignore
- screen:try_resize(35, 8)
- insert([[
- Test fdm=indent and :move bug END
- line2
- Test fdm=indent START
- line3
- line4]])
- feed_command('set noai nosta ')
- feed_command('set fdm=indent')
- feed_command('1m1')
- feed('2jzc')
- feed_command('m0')
- feed('zR')
-
- expect_any([[
- Test fdm=indent START
- line3
- line4
- Test fdm=indent and :move bug END
- line2]])
- end)
-end)
-
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
index 4d71a526c1..75294b3786 100644
--- a/test/functional/legacy/055_list_and_dict_types_spec.lua
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -330,214 +330,6 @@ describe('list and dictionary types', function()
same list: 1]])
end)
- it('locked variables (part 1)', function()
- source([=[
- let l = []
- for depth in range(5)
- $put ='depth is ' . depth
- for u in range(3)
- unlet l
- let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
- exe "lockvar " . depth . " l"
- if u == 1
- exe "unlockvar l"
- elseif u == 2
- exe "unlockvar " . depth . " l"
- endif
- let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
- \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
- \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
- $put =ps
- let ps = ''
- try
- let l[1][1][0] = 99
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l[1][1] = [99]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l[1] = [99]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l[2]['6'][7] = 99
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l[2][6] = {99: 99}
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l[2] = {99: 99}
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- let l = [99]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- $put =ps
- endfor
- endfor]=])
- expect([[
-
- depth is 0
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 1
- 1000-000
- ppppppF
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 2
- 1100-100
- ppFppFF
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 3
- 1110-110
- pFFpFFF
- 0010-010
- pFppFpp
- 0000-000
- ppppppp
- depth is 4
- 1111-111
- FFFFFFF
- 0011-011
- FFpFFpp
- 0000-000
- ppppppp]])
- end)
-
- -- TODO In the original test the 5th line of this source() call was used.
- -- But now the test only passes if I comment it.
- it('unletting locked variables', function()
- source([=[
- let l = []
- for depth in range(5)
- $put ='depth is ' . depth
- for u in range(3)
- "unlet l
- let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
- exe "lockvar " . depth . " l"
- if u == 1
- exe "unlockvar l"
- elseif u == 2
- exe "unlockvar " . depth . " l"
- endif
- let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") .
- \ islocked("l[1][1][0]") . '-' . islocked("l[2]") .
- \ islocked("l[2]['6']") . islocked("l[2]['6'][7]")
- $put =ps
- let ps = ''
- try
- unlet l[2]['6'][7]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l[2][6]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l[2]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l[1][1][0]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l[1][1]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l[1]
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- try
- unlet l
- let ps .= 'p'
- catch
- let ps .= 'F'
- endtry
- $put =ps
- endfor
- endfor]=])
- expect([[
-
- depth is 0
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 1
- 1000-000
- ppFppFp
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 2
- 1100-100
- pFFpFFp
- 0000-000
- ppppppp
- 0000-000
- ppppppp
- depth is 3
- 1110-110
- FFFFFFp
- 0010-010
- FppFppp
- 0000-000
- ppppppp
- depth is 4
- 1111-111
- FFFFFFp
- 0011-011
- FppFppp
- 0000-000
- ppppppp]])
- end)
-
it('locked variables and :unlet or list / dict functions', function()
source([[
$put ='Locks and commands or functions:'
@@ -676,30 +468,6 @@ describe('list and dictionary types', function()
['a', 'b', 3]]=])
end)
- it('locked variables (part 2)', function()
- feed_command(
- 'let l = [1, 2, 3, 4]',
- 'lockvar! l',
- '$put =string(l)',
- 'unlockvar l[1]',
- 'unlet l[0:1]',
- '$put =string(l)',
- 'unlet l[1:2]',
- '$put =string(l)',
- 'unlockvar l[1]',
- 'let l[0:1] = [0, 1]',
- '$put =string(l)',
- 'let l[1:2] = [0, 1]',
- '$put =string(l)')
- expect([=[
-
- [1, 2, 3, 4]
- [1, 2, 3, 4]
- [1, 2, 3, 4]
- [1, 2, 3, 4]
- [1, 2, 3, 4]]=])
- end)
-
it(':lockvar/islocked() triggering script autoloading.', function()
source([[
set rtp+=test/functional/fixtures
@@ -907,7 +675,7 @@ describe('list and dictionary types', function()
feed('o<C-R>=a<CR><esc>')
feed_command('lang C')
feed_command('redir => a')
- -- The test failes if this is not in one line.
+ -- The test fails if this is not in one line.
feed_command("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
feed_command('redir END')
feed('o<C-R>=a<CR><esc>')
diff --git a/test/functional/legacy/063_match_and_matchadd_spec.lua b/test/functional/legacy/063_match_and_matchadd_spec.lua
index d164d9c02f..235a826640 100644
--- a/test/functional/legacy/063_match_and_matchadd_spec.lua
+++ b/test/functional/legacy/063_match_and_matchadd_spec.lua
@@ -3,10 +3,8 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local eval, clear, command = helpers.eval, helpers.clear, helpers.command
-local eq, neq = helpers.eq, helpers.neq
+local clear, command = helpers.clear, helpers.command
local insert = helpers.insert
-local pcall_err = helpers.pcall_err
describe('063: Test for ":match", "matchadd()" and related functions', function()
setup(clear)
@@ -19,105 +17,9 @@ describe('063: Test for ":match", "matchadd()" and related functions', function(
[1] = {background = Screen.colors.Red},
})
- -- Check that "matcharg()" returns the correct group and pattern if a match
- -- is defined.
command("highlight MyGroup1 term=bold ctermbg=red guibg=red")
command("highlight MyGroup2 term=italic ctermbg=green guibg=green")
command("highlight MyGroup3 term=underline ctermbg=blue guibg=blue")
- command("match MyGroup1 /TODO/")
- command("2match MyGroup2 /FIXME/")
- command("3match MyGroup3 /XXX/")
- eq({'MyGroup1', 'TODO'}, eval('matcharg(1)'))
- eq({'MyGroup2', 'FIXME'}, eval('matcharg(2)'))
- eq({'MyGroup3', 'XXX'}, eval('matcharg(3)'))
-
- -- Check that "matcharg()" returns an empty list if the argument is not 1,
- -- 2 or 3 (only 0 and 4 are tested).
- eq({}, eval('matcharg(0)'))
- eq({}, eval('matcharg(4)'))
-
- -- Check that "matcharg()" returns ['', ''] if a match is not defined.
- command("match")
- command("2match")
- command("3match")
- eq({'', ''}, eval('matcharg(1)'))
- eq({'', ''}, eval('matcharg(2)'))
- eq({'', ''}, eval('matcharg(3)'))
-
- -- Check that "matchadd()" and "getmatches()" agree on added matches and
- -- that default values apply.
- command("let m1 = matchadd('MyGroup1', 'TODO')")
- command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
- eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 4},
- {group = 'MyGroup2', pattern = 'FIXME', priority = 42, id = 5},
- {group = 'MyGroup3', pattern = 'XXX', priority = 60, id = 17}},
- eval('getmatches()'))
-
- -- Check that "matchdelete()" deletes the matches defined in the previous
- -- test correctly.
- command("call matchdelete(m1)")
- command("call matchdelete(m2)")
- command("call matchdelete(m3)")
- eq({}, eval('getmatches()'))
-
- --- Check that "matchdelete()" returns 0 if successful and otherwise -1.
- command("let m = matchadd('MyGroup1', 'TODO')")
- eq(0, eval('matchdelete(m)'))
-
- -- matchdelete throws error and returns -1 on failure
- neq(true, pcall(function() eval('matchdelete(42)') end))
- eq('Vim(let):E803: ID not found: 42', pcall_err(command, 'let r2 = matchdelete(42)'))
-
- -- Check that "clearmatches()" clears all matches defined by ":match" and
- -- "matchadd()".
- command("let m1 = matchadd('MyGroup1', 'TODO')")
- command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
- command("match MyGroup1 /COFFEE/")
- command("2match MyGroup2 /HUMPPA/")
- command("3match MyGroup3 /VIM/")
- command("call clearmatches()")
- eq({}, eval('getmatches()'))
-
- -- Check that "setmatches()" restores a list of matches saved by
- -- "getmatches()" without changes. (Matches with equal priority must also
- -- remain in the same order.)
- command("let m1 = matchadd('MyGroup1', 'TODO')")
- command("let m2 = matchadd('MyGroup2', 'FIXME', 42)")
- command("let m3 = matchadd('MyGroup3', 'XXX', 60, 17)")
- command("match MyGroup1 /COFFEE/")
- command("2match MyGroup2 /HUMPPA/")
- command("3match MyGroup3 /VIM/")
- command("let ml = getmatches()")
- local ml = eval("ml")
- command("call clearmatches()")
- command("call setmatches(ml)")
- eq(ml, eval('getmatches()'))
-
- -- Check that "setmatches()" can correctly restore the matches from matchaddpos()
- command("call clearmatches()")
- command("call setmatches(ml)")
- eq(ml, eval('getmatches()'))
-
- -- Check that "setmatches()" will not add two matches with the same ID. The
- -- expected behaviour (for now) is to add the first match but not the
- -- second and to return -1.
- eq('Vim(let):E801: ID already taken: 1',
- pcall_err(command, "let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])"))
- eq({{group = 'MyGroup1', pattern = 'TODO', priority = 10, id = 1}}, eval('getmatches()'))
-
- -- Check that "setmatches()" returns 0 if successful and otherwise -1.
- -- (A range of valid and invalid input values are tried out to generate the
- -- return values.)
- eq(0,eval("setmatches([])"))
- eq(0,eval("setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}])"))
- command("call clearmatches()")
- eq('Vim(let):E714: List required', pcall_err(command, 'let rf1 = setmatches(0)'))
- eq('Vim(let):E474: List item 0 is either not a dictionary or an empty one',
- pcall_err(command, 'let rf2 = setmatches([0])'))
- eq('Vim(let):E474: List item 0 is missing one of the required keys',
- pcall_err(command, "let rf3 = setmatches([{'wrong key': 'wrong value'}])"))
-- Check that "matchaddpos()" positions matches correctly
insert('abcdefghijklmnopq')
diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua
index b4927e779e..80665027c3 100644
--- a/test/functional/legacy/072_undo_file_spec.lua
+++ b/test/functional/legacy/072_undo_file_spec.lua
@@ -69,7 +69,7 @@ describe('72', function()
feed_command('set undofile ul=100')
feed('uuuuuu:w >>test.out<cr>')
- ---- Open the output to see if it meets the expections
+ ---- Open the output to see if it meets the expectations
feed_command('e! test.out')
-- Assert buffer contents.
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index e94b46ca66..54620c7104 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -26,7 +26,7 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
'!_TAG_FILE_ENCODING cp932 //\n' ..
'\130`\130a\130b Xtags2.txt /\130`\130a\130b\n'
)
- -- The last file is very long but repetetive and can be generated on the
+ -- The last file is very long but repetitive and can be generated on the
-- fly.
local text = helpers.dedent([[
!_TAG_FILE_SORTED 1 //
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
index dd5a26ad3b..a62dc4d4c8 100644
--- a/test/functional/legacy/097_glob_path_spec.lua
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -10,7 +10,7 @@ describe('glob() and globpath()', function()
setup(clear)
setup(function()
- if helpers.iswin() then
+ if helpers.is_os('win') then
os.execute("md sautest\\autoload")
os.execute(".>sautest\\autoload\\Test104.vim 2>nul")
os.execute(".>sautest\\autoload\\footest.vim 2>nul")
@@ -28,7 +28,7 @@ describe('glob() and globpath()', function()
-- Consistent sorting of file names
command('set nofileignorecase')
- if helpers.iswin() then
+ if helpers.is_os('win') then
command([[$put =glob('Xxx{')]])
command([[$put =glob('Xxx$')]])
@@ -72,7 +72,7 @@ describe('glob() and globpath()', function()
end)
teardown(function()
- if helpers.iswin() then
+ if helpers.is_os('win') then
os.execute('del /q/f Xxx{ Xxx$')
os.execute('rd /q /s sautest')
else
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua
index 4d9e88c446..a15809907b 100644
--- a/test/functional/legacy/arglist_spec.lua
+++ b/test/functional/legacy/arglist_spec.lua
@@ -3,7 +3,6 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, command, eq = helpers.clear, helpers.command, helpers.eq
-local eval, exc_exec, neq = helpers.eval, helpers.exc_exec, helpers.neq
local expect_exit = helpers.expect_exit
local feed = helpers.feed
local pcall_err = helpers.pcall_err
@@ -11,233 +10,6 @@ local pcall_err = helpers.pcall_err
describe('argument list commands', function()
before_each(clear)
- local function init_abc()
- command('args a b c')
- command('next')
- end
-
- local function reset_arglist()
- command('arga a | %argd')
- end
-
- local function assert_fails(cmd, err)
- neq(nil, exc_exec(cmd):find(err))
- end
-
- it('test that argidx() works', function()
- command('args a b c')
- command('last')
- eq(2, eval('argidx()'))
- command('%argdelete')
- eq(0, eval('argidx()'))
-
- command('args a b c')
- eq(0, eval('argidx()'))
- command('next')
- eq(1, eval('argidx()'))
- command('next')
- eq(2, eval('argidx()'))
- command('1argdelete')
- eq(1, eval('argidx()'))
- command('1argdelete')
- eq(0, eval('argidx()'))
- command('1argdelete')
- eq(0, eval('argidx()'))
- end)
-
- it('test that argadd() works', function()
- command('%argdelete')
- command('argadd a b c')
- eq(0, eval('argidx()'))
-
- command('%argdelete')
- command('argadd a')
- eq(0, eval('argidx()'))
- command('argadd b c d')
- eq(0, eval('argidx()'))
-
- init_abc()
- command('argadd x')
- eq({'a', 'b', 'x', 'c'}, eval('argv()'))
- eq(1, eval('argidx()'))
-
- init_abc()
- command('0argadd x')
- eq({'x', 'a', 'b', 'c'}, eval('argv()'))
- eq(2, eval('argidx()'))
-
- init_abc()
- command('1argadd x')
- eq({'a', 'x', 'b', 'c'}, eval('argv()'))
- eq(2, eval('argidx()'))
-
- init_abc()
- command('$argadd x')
- eq({'a', 'b', 'c', 'x'}, eval('argv()'))
- eq(1, eval('argidx()'))
-
- init_abc()
- command('$argadd x')
- command('+2argadd y')
- eq({'a', 'b', 'c', 'x', 'y'}, eval('argv()'))
- eq(1, eval('argidx()'))
-
- command('%argd')
- command('edit d')
- command('arga')
- eq(1, eval('len(argv())'))
- eq('d', eval('get(argv(), 0, "")'))
-
- command('%argd')
- command('new')
- command('arga')
- eq(0, eval('len(argv())'))
- end)
-
- it('test for 0argadd and 0argedit', function()
- reset_arglist()
-
- command('arga a b c d')
- command('2argu')
- command('0arga added')
- eq({'added', 'a', 'b', 'c', 'd'}, eval('argv()'))
-
- command('%argd')
- command('arga a b c d')
- command('2argu')
- command('0arge edited')
- eq({'edited', 'a', 'b', 'c', 'd'}, eval('argv()'))
-
- command('2argu')
- command('arga third')
- eq({'edited', 'a', 'third', 'b', 'c', 'd'}, eval('argv()'))
- end)
-
- it('test for argc()', function()
- reset_arglist()
- eq(0, eval('argc()'))
- command('argadd a b')
- eq(2, eval('argc()'))
- end)
-
- it('test for arglistid()', function()
- reset_arglist()
- command('arga a b')
- eq(0, eval('arglistid()'))
- command('split')
- command('arglocal')
- eq(1, eval('arglistid()'))
- command('tabnew | tabfirst')
- eq(0, eval('arglistid(2)'))
- eq(1, eval('arglistid(1, 1)'))
- eq(0, eval('arglistid(2, 1)'))
- eq(1, eval('arglistid(1, 2)'))
- command('tabonly | only | enew!')
- command('argglobal')
- eq(0, eval('arglistid()'))
- end)
-
- it('test for argv()', function()
- reset_arglist()
- eq({}, eval('argv()'))
- eq('', eval('argv(2)'))
- command('argadd a b c d')
- eq('c', eval('argv(2)'))
- end)
-
- it('test for :argedit command', function()
- reset_arglist()
- command('argedit a')
- eq({'a'}, eval('argv()'))
- eq('a', eval('expand("%:t")'))
- command('argedit b')
- eq({'a', 'b'}, eval('argv()'))
- eq('b', eval('expand("%:t")'))
- command('argedit a')
- eq({'a', 'b', 'a'}, eval('argv()'))
- eq('a', eval('expand("%:t")'))
- command('argedit c')
- eq({'a', 'b', 'a', 'c'}, eval('argv()'))
- command('0argedit x')
- eq({'x', 'a', 'b', 'a', 'c'}, eval('argv()'))
- command('set nohidden')
- command('enew! | set modified')
- assert_fails('argedit y', 'E37:')
- command('argedit! y')
- eq({'x', 'y', 'y', 'a', 'b', 'a', 'c'}, eval('argv()'))
- command('set hidden')
- command('%argd')
- command('argedit a b')
- eq({'a', 'b'}, eval('argv()'))
- end)
-
- it('test for :argdelete command', function()
- reset_arglist()
- command('args aa a aaa b bb')
- command('argdelete a*')
- eq({'b', 'bb'}, eval('argv()'))
- eq('aa', eval('expand("%:t")'))
- command('last')
- command('argdelete %')
- eq({'b'}, eval('argv()'))
- assert_fails('argdelete', 'E610:')
- assert_fails('1,100argdelete', 'E16:')
- reset_arglist()
- command('args a b c d')
- command('next')
- command('argdel')
- eq({'a', 'c', 'd'}, eval('argv()'))
- command('%argdel')
- end)
-
- it('test for the :next, :prev, :first, :last, :rewind commands', function()
- reset_arglist()
- command('args a b c d')
- command('last')
- eq(3, eval('argidx()'))
- assert_fails('next', 'E165:')
- command('prev')
- eq(2, eval('argidx()'))
- command('Next')
- eq(1, eval('argidx()'))
- command('first')
- eq(0, eval('argidx()'))
- assert_fails('prev', 'E164:')
- command('3next')
- eq(3, eval('argidx()'))
- command('rewind')
- eq(0, eval('argidx()'))
- command('%argd')
- end)
-
- it('test for autocommand that redefines the argument list, when doing ":all"', function()
- command('autocmd BufReadPost Xxx2 next Xxx2 Xxx1')
- command("call writefile(['test file Xxx1'], 'Xxx1')")
- command("call writefile(['test file Xxx2'], 'Xxx2')")
- command("call writefile(['test file Xxx3'], 'Xxx3')")
-
- command('new')
- -- redefine arglist; go to Xxx1
- command('next! Xxx1 Xxx2 Xxx3')
- -- open window for all args
- command('all')
- eq('test file Xxx1', eval('getline(1)'))
- command('wincmd w')
- command('wincmd w')
- eq('test file Xxx1', eval('getline(1)'))
- -- should now be in Xxx2
- command('rewind')
- eq('test file Xxx2', eval('getline(1)'))
-
- command('autocmd! BufReadPost Xxx2')
- command('enew! | only')
- command("call delete('Xxx1')")
- command("call delete('Xxx2')")
- command("call delete('Xxx3')")
- command('argdelete Xxx*')
- command('bwipe! Xxx1 Xxx2 Xxx3')
- end)
-
it('quitting Vim with unedited files in the argument list throws E173', function()
command('set nomore')
command('args a b c')
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 5e586d3a6a..e00b468c16 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -211,7 +211,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should trigger if the current buffer is different from the targetted buffer', function()
+ it('should trigger if the current buffer is different from the targeted buffer', function()
local new_buffer = make_buffer()
local new_bufnr = buf.get_number(new_buffer)
@@ -590,7 +590,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should trigger if the current buffer is different from the targetted buffer', function()
+ it('should trigger if the current buffer is different from the targeted buffer', function()
set_hook('buftype')
local new_buffer = make_buffer()
@@ -616,7 +616,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should not trigger if the current window is different from the targetted window', function()
+ it('should not trigger if the current window is different from the targeted window', function()
set_hook('cursorcolumn')
local new_winnr = get_new_window_number()
diff --git a/test/functional/legacy/breakindent_spec.lua b/test/functional/legacy/breakindent_spec.lua
new file mode 100644
index 0000000000..d7779684a4
--- /dev/null
+++ b/test/functional/legacy/breakindent_spec.lua
@@ -0,0 +1,44 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+
+before_each(clear)
+
+describe('breakindent', function()
+ -- oldtest: Test_cursor_position_with_showbreak()
+ it('cursor shown at correct position with showbreak', function()
+ local screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}, -- SignColumn
+ [2] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ exec([[
+ let &signcolumn = 'yes'
+ let &showbreak = '+'
+ let leftcol = win_getid()->getwininfo()->get(0, {})->get('textoff')
+ eval repeat('x', &columns - leftcol - 1)->setline(1)
+ eval 'second line'->setline(2)
+ ]])
+ screen:expect([[
+ {1: }^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+ {1: }second line |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed('AX')
+ screen:expect([[
+ {1: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxX|
+ {1: }^second line |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT --} |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/buffer_spec.lua b/test/functional/legacy/buffer_spec.lua
new file mode 100644
index 0000000000..acaa9a51f1
--- /dev/null
+++ b/test/functional/legacy/buffer_spec.lua
@@ -0,0 +1,59 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, source = helpers.clear, helpers.source
+local call, eq, meths = helpers.call, helpers.eq, helpers.meths
+
+local function expected_empty()
+ eq({}, meths.get_vvar('errors'))
+end
+
+describe('buffer', function()
+ before_each(function()
+ clear()
+ meths.ui_attach(80, 24, {})
+ meths.set_option('hidden', false)
+ end)
+
+ it('deleting a modified buffer with :confirm', function()
+ source([[
+ func Test_bdel_with_confirm()
+ new
+ call setline(1, 'test')
+ call assert_fails('bdel', 'E89:')
+ call nvim_input('c')
+ confirm bdel
+ call assert_equal(2, winnr('$'))
+ call assert_equal(1, &modified)
+ call nvim_input('n')
+ confirm bdel
+ call assert_equal(1, winnr('$'))
+ endfunc
+ ]])
+ call('Test_bdel_with_confirm')
+ expected_empty()
+ end)
+
+ it('editing another buffer from a modified buffer with :confirm', function()
+ source([[
+ func Test_goto_buf_with_confirm()
+ new Xfile
+ enew
+ call setline(1, 'test')
+ call assert_fails('b Xfile', 'E37:')
+ call nvim_input('c')
+ call assert_fails('confirm b Xfile', 'E37:')
+ call assert_equal(1, &modified)
+ call assert_equal('', @%)
+ call nvim_input('y')
+ call assert_fails('confirm b Xfile', 'E37:')
+ call assert_equal(1, &modified)
+ call assert_equal('', @%)
+ call nvim_input('n')
+ confirm b Xfile
+ call assert_equal('Xfile', @%)
+ close!
+ endfunc
+ ]])
+ call('Test_goto_buf_with_confirm')
+ expected_empty()
+ end)
+end)
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index cf02636890..2fceb6a132 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -1,9 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
+local command = helpers.command
local feed = helpers.feed
local feed_command = helpers.feed_command
local exec = helpers.exec
+local meths = helpers.meths
+local pesc = helpers.pesc
describe('cmdline', function()
before_each(clear)
@@ -18,8 +21,6 @@ describe('cmdline', function()
[3] = {reverse = true};
[4] = {bold = true, foreground = Screen.colors.Blue1};
}
- -- TODO(bfredl): redraw with tabs is severly broken. fix it
- feed_command [[ set display-=msgsep ]]
feed_command([[call setline(1, range(30))]])
screen:expect([[
@@ -60,7 +61,7 @@ describe('cmdline', function()
{4:~ }|
|
|
- :tabnew |
+ |
]]}
feed [[gt]]
@@ -140,4 +141,180 @@ describe('cmdline', function()
:^ |
]])
end)
+
+ -- oldtest: Test_redraw_in_autocmd()
+ it('cmdline cursor position is correct after :redraw with cmdheight=2', function()
+ local screen = Screen.new(30, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ })
+ screen:attach()
+ exec([[
+ set cmdheight=2
+ autocmd CmdlineChanged * redraw
+ ]])
+ feed(':for i in range(3)<CR>')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :for i in range(3) |
+ : ^ |
+ ]])
+ feed(':let i =')
+ -- Note: this may still be considered broken, ref #18140
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ : :let i =^ |
+ |
+ ]])
+ end)
+
+ it("setting 'cmdheight' works after outputting two messages vim-patch:9.0.0665", function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- StatusLine
+ })
+ screen:attach()
+ exec([[
+ set cmdheight=1 laststatus=2
+ func EchoTwo()
+ set laststatus=2
+ set cmdheight=5
+ echo 'foo'
+ echo 'bar'
+ set cmdheight=1
+ endfunc
+ ]])
+ feed(':call EchoTwo()')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ :call EchoTwo()^ |
+ ]])
+ feed('<CR>')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_cmdheight_tabline()
+ it("changing 'cmdheight' when there is a tabline", function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- StatusLine
+ [2] = {bold = true}, -- TabLineSel
+ [3] = {reverse = true}, -- TabLineFill
+ })
+ screen:attach()
+ meths.set_option('laststatus', 2)
+ meths.set_option('showtabline', 2)
+ meths.set_option('cmdheight', 1)
+ screen:expect([[
+ {2: [No Name] }{3: }|
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[No Name] }|
+ |
+ ]])
+ end)
+end)
+
+describe('cmdwin', function()
+ before_each(clear)
+
+ -- oldtest: Test_cmdwin_interrupted()
+ it('still uses a new buffer when interrupting more prompt on open', function()
+ local screen = Screen.new(30, 16)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, reverse = true}, -- StatusLine
+ [2] = {reverse = true}, -- StatusLineNC
+ [3] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [4] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ command('set more')
+ command('autocmd WinNew * highlight')
+ feed('q:')
+ screen:expect({any = pesc('{3:-- More --}^')})
+ feed('q')
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:[No Name] }|
+ {0::}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[Command Line] }|
+ |
+ ]])
+ feed([[aecho 'done']])
+ screen:expect([[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:[No Name] }|
+ {0::}echo 'done'^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:[Command Line] }|
+ {4:-- INSERT --} |
+ ]])
+ feed('<CR>')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ done |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/delete_spec.lua b/test/functional/legacy/delete_spec.lua
index 4ba4c8d356..cefcd6c6c4 100644
--- a/test/functional/legacy/delete_spec.lua
+++ b/test/functional/legacy/delete_spec.lua
@@ -48,7 +48,7 @@ describe('Test for delete()', function()
it('symlink directory delete', function()
command("call mkdir('Xdir1')")
- if helpers.iswin() then
+ if helpers.is_os('win') then
command("silent !mklink /j Xlink Xdir1")
else
command("silent !ln -s Xdir1 Xlink")
diff --git a/test/functional/legacy/digraph_spec.lua b/test/functional/legacy/digraph_spec.lua
new file mode 100644
index 0000000000..0cb0bb84be
--- /dev/null
+++ b/test/functional/legacy/digraph_spec.lua
@@ -0,0 +1,46 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+
+before_each(clear)
+
+describe('digraph', function()
+ -- oldtest: Test_entering_digraph()
+ it('characters displayed on the screen', function()
+ local screen = Screen.new(10, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ [2] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ feed('i<C-K>')
+ screen:expect([[
+ {1:^?} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT -} |
+ ]])
+ feed('1')
+ screen:expect([[
+ {1:^1} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT -} |
+ ]])
+ feed('2')
+ screen:expect([[
+ ½^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT -} |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua
index f0ffaf2c48..f9b78f5dcd 100644
--- a/test/functional/legacy/display_spec.lua
+++ b/test/functional/legacy/display_spec.lua
@@ -9,6 +9,7 @@ local command = helpers.command
describe('display', function()
before_each(clear)
+ -- oldtest: Test_display_scroll_at_topline()
it('scroll when modified at topline vim-patch:8.2.1488', function()
local screen = Screen.new(20, 4)
screen:attach()
@@ -26,6 +27,7 @@ describe('display', function()
]])
end)
+ -- oldtest: Test_display_scroll_update_visual()
it('scrolling when modified at topline in Visual mode vim-patch:8.2.4626', function()
local screen = Screen.new(60, 8)
screen:attach()
@@ -56,8 +58,53 @@ describe('display', function()
]])
end)
- it('@@@ in the last line shows correctly in a narrow window vim-patch:8.2.4718', function()
- local screen = Screen.new(60, 10)
+ -- oldtest: Test_matchparen_clear_highlight()
+ it('matchparen highlight is cleared when switching buffer', function()
+ local screen = Screen.new(20, 5)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue},
+ [1] = {background = Screen.colors.Cyan},
+ })
+ screen:attach()
+
+ local screen1 = [[
+ {1:^()} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]
+ local screen2 = [[
+ ^aa |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]]
+
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set hidden
+ call setline(1, ['()'])
+ normal 0
+ ]])
+ screen:expect(screen1)
+
+ exec([[
+ enew
+ exe "normal iaa\<Esc>0"
+ ]])
+ screen:expect(screen2)
+
+ feed('<C-^>')
+ screen:expect(screen1)
+
+ feed('<C-^>')
+ screen:expect(screen2)
+ end)
+
+ local function run_test_display_lastline(euro)
+ local screen = Screen.new(75, 10)
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
[2] = {bold = true, reverse = true}, -- StatusLine
@@ -65,39 +112,86 @@ describe('display', function()
})
screen:attach()
exec([[
- call setline(1, ['aaa', 'b'->repeat(100)])
+ call setline(1, ['aaa', 'b'->repeat(200)])
set display=truncate
+
vsplit
100wincmd <
]])
- screen:expect([[
- ^a│aaa |
- a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
- a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
- b│{1:~ }|
- b│{1:~ }|
- b│{1:~ }|
- b│{1:~ }|
- {1:@}│{1:~ }|
- {2:< }{3:[No Name] [+] }|
- |
- ]])
+ local fillchar = '@'
+ if euro then
+ command('set fillchars=lastline:€')
+ fillchar = '€'
+ end
+ screen:expect((([[
+ ^a│aaa |
+ a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ a│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ b│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ b│{1:~ }|
+ b│{1:~ }|
+ b│{1:~ }|
+ {1:@}│{1:~ }|
+ {2:< }{3:[No Name] [+] }|
+ |
+ ]]):gsub('@', fillchar)))
+
command('set display=lastline')
screen:expect_unchanged()
+
command('100wincmd >')
- screen:expect([[
- ^aaa │a|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|
- bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │a|
- {1:~ }│b|
- {1:~ }│b|
- {1:~ }│b|
- {1:~ }│b|
- {1:~ }│{1:@}|
- {2:[No Name] [+] }{3:<}|
- |
- ]])
+ screen:expect((([[
+ ^aaa │a|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb│a|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb │b|
+ {1:~ }│b|
+ {1:~ }│b|
+ {1:~ }│b|
+ {1:~ }│{1:@}|
+ {2:[No Name] [+] }{3:<}|
+ |
+ ]]):gsub('@', fillchar)))
+
command('set display=truncate')
screen:expect_unchanged()
+
+ command('close')
+ command('3split')
+ screen:expect((([[
+ ^aaa |
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ {1:@@@ }|
+ {2:[No Name] [+] }|
+ aaa |
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ {3:[No Name] [+] }|
+ |
+ ]]):gsub('@', fillchar)))
+
+ command('close')
+ command('2vsplit')
+ screen:expect((([[
+ ^aa│aaa |
+ a │bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb|
+ bb│bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
+ bb│{1:~ }|
+ bb│{1:~ }|
+ bb│{1:~ }|
+ {1:@@}│{1:~ }|
+ {2:< }{3:[No Name] [+] }|
+ |
+ ]]):gsub('@', fillchar)))
+ end
+
+ -- oldtest: Test_display_lastline()
+ it('display "lastline" works correctly', function()
+ run_test_display_lastline()
+ end)
+ it('display "lastline" works correctly with multibyte fillchar', function()
+ run_test_display_lastline(true)
end)
end)
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
index 7fc5f11a79..362d33a0fd 100644
--- a/test/functional/legacy/edit_spec.lua
+++ b/test/functional/legacy/edit_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local command = helpers.command
local expect = helpers.expect
@@ -7,20 +8,51 @@ local sleep = helpers.sleep
before_each(clear)
--- oldtest: Test_autoindent_remove_indent()
-it('autoindent removes indent when Insert mode is stopped', function()
- command('set autoindent')
- -- leaving insert mode in a new line with indent added by autoindent, should
- -- remove the indent.
- feed('i<Tab>foo<CR><Esc>')
- -- Need to delay for sometime, otherwise the code in getchar.c will not be
- -- exercised.
- sleep(50)
- -- when a line is wrapped and the cursor is at the start of the second line,
- -- leaving insert mode, should move the cursor back to the first line.
- feed('o' .. ('x'):rep(20) .. '<Esc>')
- -- Need to delay for sometime, otherwise the code in getchar.c will not be
- -- exercised.
- sleep(50)
- expect('\tfoo\n\n' .. ('x'):rep(20))
+describe('edit', function()
+ -- oldtest: Test_autoindent_remove_indent()
+ it('autoindent removes indent when Insert mode is stopped', function()
+ command('set autoindent')
+ -- leaving insert mode in a new line with indent added by autoindent, should
+ -- remove the indent.
+ feed('i<Tab>foo<CR><Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ -- when a line is wrapped and the cursor is at the start of the second line,
+ -- leaving insert mode, should move the cursor back to the first line.
+ feed('o' .. ('x'):rep(20) .. '<Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ expect('\tfoo\n\n' .. ('x'):rep(20))
+ end)
+
+ -- oldtest: Test_edit_insert_reg()
+ it('inserting a register using CTRL-R', function()
+ local screen = Screen.new(10, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ [2] = {bold = true}, -- ModeMsg
+ })
+ screen:attach()
+ feed('a<C-R>')
+ screen:expect([[
+ {1:^"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:-- INSERT -} |
+ ]])
+ feed('=')
+ screen:expect([[
+ {1:"} |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ =^ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 05d853622e..b5e45a86c1 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -639,7 +639,7 @@ describe('eval', function()
end)
it('function name includes a colon', function()
- eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()\\nendfunction',
+ eq('Vim(function):E884: Function name cannot contain a colon: b:test()\\nendfunction',
exc_exec(dedent([[
function! b:test()
endfunction]])))
diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua
index ece88d26bd..eb480a6689 100644
--- a/test/functional/legacy/excmd_spec.lua
+++ b/test/functional/legacy/excmd_spec.lua
@@ -7,12 +7,12 @@ local exec_lua = helpers.exec_lua
local expect_exit = helpers.expect_exit
local feed = helpers.feed
local funcs = helpers.funcs
-local iswin = helpers.iswin
local meths = helpers.meths
local read_file = helpers.read_file
local source = helpers.source
local eq = helpers.eq
local write_file = helpers.write_file
+local is_os = helpers.is_os
local function sizeoflong()
if not exec_lua('return pcall(require, "ffi")') then
@@ -376,7 +376,7 @@ describe(':confirm command dialog', function()
{3:(Y)es, [N]o: }^ |
]])
feed('Y')
- if iswin() then
+ if is_os('win') then
screen:expect([[
foobar |
{0:~ }|
@@ -416,7 +416,7 @@ describe(':confirm command dialog', function()
{3:(Y)es, [N]o: }^ |
]])
feed('Y')
- if iswin() then
+ if is_os('win') then
screen:expect([[
foobar |
{1: }|
@@ -493,7 +493,7 @@ describe(':confirm command dialog', function()
{3:(Y)es, [N]o: }^ |
]])
feed('Y')
- if iswin() then
+ if is_os('win') then
screen:expect([[
a |
b |
diff --git a/test/functional/legacy/filechanged_spec.lua b/test/functional/legacy/filechanged_spec.lua
index 1f23528d61..cea1d6ac30 100644
--- a/test/functional/legacy/filechanged_spec.lua
+++ b/test/functional/legacy/filechanged_spec.lua
@@ -1,6 +1,8 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, source = helpers.clear, helpers.source
local call, eq, meths = helpers.call, helpers.eq, helpers.meths
+local is_os = helpers.is_os
+local skip = helpers.skip
local function expected_empty()
eq({}, meths.get_vvar('errors'))
@@ -15,7 +17,7 @@ describe('file changed dialog', function()
end)
it('works', function()
- if helpers.pending_win32(pending) then return end
+ skip(is_os('win'))
source([[
func Test_file_changed_dialog()
au! FileChangedShell
diff --git a/test/functional/legacy/fold_spec.lua b/test/functional/legacy/fold_spec.lua
new file mode 100644
index 0000000000..83513a3f94
--- /dev/null
+++ b/test/functional/legacy/fold_spec.lua
@@ -0,0 +1,335 @@
+-- Tests for folding.
+local Screen = require('test.functional.ui.screen')
+
+local helpers = require('test.functional.helpers')(after_each)
+local feed, insert, feed_command, expect_any =
+ helpers.feed, helpers.insert, helpers.feed_command, helpers.expect_any
+local command = helpers.command
+local exec = helpers.exec
+
+describe('folding', function()
+ local screen
+
+ before_each(function()
+ helpers.clear()
+
+ screen = Screen.new(45, 8)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, -- Folded
+ [3] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Grey}, -- FoldColumn
+ [4] = {foreground = Screen.colors.Brown}, -- LineNr
+ })
+ screen:attach()
+ end)
+
+ it('creation, opening, moving (to the end) and closing', function()
+ insert([[
+ 1 aa
+ 2 bb
+ 3 cc
+ last
+ ]])
+
+ -- Basic test if a fold can be created, opened, moving to the end and
+ -- closed.
+ feed_command('1')
+ feed('zf2j')
+ feed_command('call append("$", "manual " . getline(foldclosed(".")))')
+ feed('zo')
+ feed_command('call append("$", foldclosed("."))')
+ feed(']z')
+ feed_command('call append("$", getline("."))')
+ feed('zc')
+ feed_command('call append("$", getline(foldclosed(".")))')
+
+ expect_any([[
+ manual 1 aa
+ -1
+ 3 cc
+ 1 aa]])
+ end)
+
+ it("foldmethod=marker", function()
+ screen:try_resize(20, 10)
+ insert([[
+ dd {{{
+ ee {{{ }}}
+ ff }}}
+ ]])
+ feed_command('set fdm=marker fdl=1')
+ feed_command('2')
+ feed_command('call append("$", "line 2 foldlevel=" . foldlevel("."))')
+ feed('[z')
+ feed_command('call append("$", foldlevel("."))')
+ feed('jo{{ <esc>r{jj') -- writes '{{{' and moves 2 lines bot
+ feed_command('call append("$", foldlevel("."))')
+ feed('kYpj')
+ feed_command('call append("$", foldlevel("."))')
+
+ helpers.poke_eventloop()
+ screen:expect([[
+ dd {{{ |
+ ee {{{ }}} |
+ {{{ |
+ ff }}} |
+ ff }}} |
+ ^ |
+ line 2 foldlevel=2 |
+ 1 |
+ 1 |
+ |
+ ]])
+
+ end)
+
+ it("foldmethod=indent", function()
+ screen:try_resize(20, 8)
+ feed_command('set fdm=indent sw=2')
+ insert([[
+ aa
+ bb
+ cc
+ last
+ ]])
+ feed_command('call append("$", "foldlevel line3=" . foldlevel(3))')
+ feed_command('call append("$", foldlevel(2))')
+ feed('zR')
+
+ helpers.poke_eventloop()
+ screen:expect([[
+ aa |
+ bb |
+ cc |
+ last |
+ ^ |
+ foldlevel line3=2 |
+ 1 |
+ |
+ ]])
+ end)
+
+ it("foldmethod=syntax", function()
+ screen:try_resize(35, 15)
+ insert([[
+ 1 aa
+ 2 bb
+ 3 cc
+ 4 dd {{{
+ 5 ee {{{ }}}
+ 6 ff }}}
+ 7 gg
+ 8 hh
+ 9 ii
+ a jj
+ b kk
+ last]])
+ feed_command('set fdm=syntax fdl=0')
+ feed_command('syn region Hup start="dd" end="ii" fold contains=Fd1,Fd2,Fd3')
+ feed_command('syn region Fd1 start="ee" end="ff" fold contained')
+ feed_command('syn region Fd2 start="gg" end="hh" fold contained')
+ feed_command('syn region Fd3 start="commentstart" end="commentend" fold contained')
+ feed('Gzk')
+ feed_command('call append("$", "folding " . getline("."))')
+ feed('k')
+ feed_command('call append("$", getline("."))')
+ feed('jAcommentstart <esc>Acommentend<esc>')
+ feed_command('set fdl=1')
+ feed('3j')
+ feed_command('call append("$", getline("."))')
+ feed_command('set fdl=0')
+ feed('zO<C-L>j') -- <C-L> redraws screen
+ feed_command('call append("$", getline("."))')
+ feed_command('set fdl=0')
+ expect_any([[
+ folding 9 ii
+ 3 cc
+ 9 ii
+ a jj]])
+ end)
+
+ it("foldmethod=expression", function()
+ insert([[
+ 1 aa
+ 2 bb
+ 3 cc
+ 4 dd {{{
+ 5 ee {{{ }}}
+ 6 ff }}}
+ 7 gg
+ 8 hh
+ 9 ii
+ a jj
+ b kk
+ last ]])
+
+ feed_command([[
+ fun Flvl()
+ let l = getline(v:lnum)
+ if l =~ "bb$"
+ return 2
+ elseif l =~ "gg$"
+ return "s1"
+ elseif l =~ "ii$"
+ return ">2"
+ elseif l =~ "kk$"
+ return "0"
+ endif
+ return "="
+ endfun
+ ]])
+ feed_command('set fdm=expr fde=Flvl()')
+ feed_command('/bb$')
+ feed_command('call append("$", "expr " . foldlevel("."))')
+ feed_command('/hh$')
+ feed_command('call append("$", foldlevel("."))')
+ feed_command('/ii$')
+ feed_command('call append("$", foldlevel("."))')
+ feed_command('/kk$')
+ feed_command('call append("$", foldlevel("."))')
+
+ expect_any([[
+ expr 2
+ 1
+ 2
+ 0]])
+ end)
+
+ it('can be opened after :move', function()
+ -- luacheck: ignore
+ screen:try_resize(35, 8)
+ insert([[
+ Test fdm=indent and :move bug END
+ line2
+ Test fdm=indent START
+ line3
+ line4]])
+ feed_command('set noai nosta ')
+ feed_command('set fdm=indent')
+ feed_command('1m1')
+ feed('2jzc')
+ feed_command('m0')
+ feed('zR')
+
+ expect_any([[
+ Test fdm=indent START
+ line3
+ line4
+ Test fdm=indent and :move bug END
+ line2]])
+ end)
+
+ -- oldtest: Test_folds_with_rnu()
+ it('with relative line numbers', function()
+ command('set fdm=marker rnu foldcolumn=2')
+ command('call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])')
+
+ screen:expect([[
+ {3:+ }{4: 0 }{2:^+-- 2 lines: ·························}|
+ {3:+ }{4: 1 }{2:+-- 2 lines: ·························}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed("j")
+ screen:expect([[
+ {3:+ }{4: 1 }{2:+-- 2 lines: ·························}|
+ {3:+ }{4: 0 }{2:^+-- 2 lines: ·························}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+
+ -- oldtest: Test_foldclose_opt()
+ it('foldclose=all', function()
+ exec([[
+ set foldmethod=manual foldclose=all foldopen=all
+ call setline(1, ['one', 'two', 'three', 'four'])
+ 2,3fold
+ ]])
+
+ screen:expect([[
+ ^one |
+ {2:+-- 2 lines: two····························}|
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('2G')
+ screen:expect([[
+ one |
+ ^two |
+ three |
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('4G')
+ screen:expect([[
+ one |
+ {2:+-- 2 lines: two····························}|
+ ^four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('3G')
+ screen:expect([[
+ one |
+ two |
+ ^three |
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('1G')
+ screen:expect([[
+ ^one |
+ {2:+-- 2 lines: two····························}|
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('2G')
+ screen:expect([[
+ one |
+ ^two |
+ three |
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('k')
+ screen:expect([[
+ ^one |
+ {2:+-- 2 lines: two····························}|
+ four |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/gf_spec.lua b/test/functional/legacy/gf_spec.lua
index f1b1790ba1..9f725446be 100644
--- a/test/functional/legacy/gf_spec.lua
+++ b/test/functional/legacy/gf_spec.lua
@@ -10,6 +10,7 @@ describe('gf', function()
it('is not allowed when buffer is locked', function()
command('au OptionSet diff norm! gf')
command([[call setline(1, ['Xfile1', 'line2', 'line3', 'line4'])]])
- eq('Vim(normal):E788: Not allowed to edit another buffer now', pcall_err(command, 'diffthis'))
+ eq('OptionSet Autocommands for "diff": Vim(normal):E788: Not allowed to edit another buffer now',
+ pcall_err(command, 'diffthis'))
end)
end)
diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua
index d51f9a2e02..d35f4bdae6 100644
--- a/test/functional/legacy/increment_spec.lua
+++ b/test/functional/legacy/increment_spec.lua
@@ -285,7 +285,7 @@ describe('Ctrl-A/Ctrl-X on visual selections', function()
" 1
" 1
" 1
- " Expexted:
+ " Expected:
" 1) g Ctrl-A on block selected indented lines
" 2
" 1
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua
index f70d55f4a3..d4f11a61c2 100644
--- a/test/functional/legacy/listlbr_spec.lua
+++ b/test/functional/legacy/listlbr_spec.lua
@@ -1,11 +1,12 @@
-- Test for linebreak and list option (non-utf8)
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
describe('listlbr', function()
- setup(clear)
+ before_each(clear)
-- luacheck: ignore 621 (Indentation)
-- luacheck: ignore 611 (Line contains only whitespaces)
@@ -195,4 +196,97 @@ describe('listlbr', function()
aa>-----a-$
~ ]])
end)
+
+ -- oldtest: Test_linebreak_reset_restore()
+ it('cursor position is drawn correctly after operator', function()
+ local screen = Screen.new(60, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.LightGrey}, -- Visual
+ [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+
+ -- f_wincol() calls validate_cursor()
+ source([[
+ set linebreak showcmd noshowmode formatexpr=wincol()-wincol()
+ call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c')
+ ]])
+
+ feed('$v$')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ 2 |
+ ]])
+ feed('zo')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb ^c |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} |
+ ]])
+
+ feed('$v$')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} 2 |
+ ]])
+ feed('gq')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb ^c |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} |
+ ]])
+
+ feed('$<C-V>$')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} 1x2 |
+ ]])
+ feed('I')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb ^c |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} |
+ ]])
+
+ feed('<Esc>$v$')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} 2 |
+ ]])
+ feed('s')
+ screen:expect([[
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ bbbbbbbbbb ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:E490: No fold found} |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/match_spec.lua b/test/functional/legacy/match_spec.lua
new file mode 100644
index 0000000000..b6e45c396c
--- /dev/null
+++ b/test/functional/legacy/match_spec.lua
@@ -0,0 +1,126 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+
+before_each(clear)
+
+describe('matchaddpos()', function()
+ -- oldtest: Test_matchaddpos_dump()
+ it('can add more than 8 match positions vim-patch:9.0.0620', function()
+ local screen = Screen.new(60, 14)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Yellow}, -- Search
+ })
+ screen:attach()
+ exec([[
+ call setline(1, ['1234567890123']->repeat(14))
+ call matchaddpos('Search', range(1, 12)->map({i, v -> [v, v]}))
+ ]])
+ screen:expect([[
+ {1:^1}234567890123 |
+ 1{1:2}34567890123 |
+ 12{1:3}4567890123 |
+ 123{1:4}567890123 |
+ 1234{1:5}67890123 |
+ 12345{1:6}7890123 |
+ 123456{1:7}890123 |
+ 1234567{1:8}90123 |
+ 12345678{1:9}0123 |
+ 123456789{1:0}123 |
+ 1234567890{1:1}23 |
+ 12345678901{1:2}3 |
+ 1234567890123 |
+ |
+ ]])
+ end)
+end)
+
+describe('match highlighting', function()
+ -- oldtest: Test_match_in_linebreak()
+ it('does not continue in linebreak vim-patch:8.2.3698', function()
+ local screen = Screen.new(75, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+ exec([=[
+ set breakindent linebreak breakat+=]
+ call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
+ call matchaddpos('ErrorMsg', [[1, 51]])
+ ]=])
+ screen:expect([[
+ ^xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{1:]} |
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ it('is shown with incsearch vim-patch:8.2.3940', function()
+ local screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Yellow}, -- Search
+ [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+ exec([[
+ set incsearch
+ call setline(1, range(20))
+ call matchaddpos('ErrorMsg', [3])
+ ]])
+ screen:expect([[
+ ^0 |
+ 1 |
+ {2:2} |
+ 3 |
+ 4 |
+ |
+ ]])
+ feed(':s/0')
+ screen:expect([[
+ {1:0} |
+ 1 |
+ {2:2} |
+ 3 |
+ 4 |
+ :s/0^ |
+ ]])
+ end)
+
+ it('on a Tab vim-patch:8.2.4062', function()
+ local screen = Screen.new(75, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+ exec([[
+ set linebreak
+ call setline(1, "\tix")
+ call matchadd('ErrorMsg', '\t')
+ ]])
+ screen:expect([[
+ {1: ^ }ix |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/memory_usage_spec.lua b/test/functional/legacy/memory_usage_spec.lua
index eec89aa919..59839157ea 100644
--- a/test/functional/legacy/memory_usage_spec.lua
+++ b/test/functional/legacy/memory_usage_spec.lua
@@ -3,15 +3,14 @@ local clear = helpers.clear
local eval = helpers.eval
local eq = helpers.eq
local feed_command = helpers.feed_command
-local iswin = helpers.iswin
local retry = helpers.retry
local ok = helpers.ok
local source = helpers.source
local poke_eventloop = helpers.poke_eventloop
-local uname = helpers.uname
local load_adjust = helpers.load_adjust
local write_file = helpers.write_file
-local isCI = helpers.isCI
+local is_os = helpers.is_os
+local is_ci = helpers.is_ci
local function isasan()
local version = eval('execute("version")')
@@ -22,8 +21,8 @@ clear()
if isasan() then
pending('ASAN build is difficult to estimate memory usage', function() end)
return
-elseif iswin() then
- if isCI('github') then
+elseif is_os('win') then
+ if is_ci('github') then
pending('Windows runners in Github Actions do not have a stable environment to estimate memory usage', function() end)
return
elseif eval("executable('wmic')") == 0 then
@@ -38,7 +37,7 @@ end
local monitor_memory_usage = {
memory_usage = function(self)
local handle
- if iswin() then
+ if is_os('win') then
handle = io.popen('wmic process where processid=' ..self.pid..' get WorkingSetSize')
else
handle = io.popen('ps -o rss= -p '..self.pid)
@@ -167,9 +166,9 @@ describe('memory usage', function()
local last = monitor_memory_usage(pid)
-- The usage may be a bit less than the last value, use 80%.
-- Allow for 20% tolerance at the upper limit. That's very permissive, but
- -- otherwise the test fails sometimes. On Sourcehut CI with FreeBSD we need to
- -- be even much more permissive.
- local upper_multiplier = uname() == 'freebsd' and 19 or 12
+ -- otherwise the test fails sometimes. On FreeBSD we need to be even much
+ -- more permissive.
+ local upper_multiplier = is_os('freebsd') and 19 or 12
local lower = before.last * 8 / 10
local upper = load_adjust((after.max + (after.last - before.last)) * upper_multiplier / 10)
check_result({before=before, after=after, last=last},
@@ -179,7 +178,7 @@ describe('memory usage', function()
end)
it('releases memory when closing windows when folds exist', function()
- if helpers.is_os('mac') then
+ if is_os('mac') then
pending('macOS memory compression causes flakiness')
end
local pid = eval('getpid()')
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index 159cf7a551..71a53c8381 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -4,27 +4,65 @@ local clear = helpers.clear
local command = helpers.command
local exec = helpers.exec
local feed = helpers.feed
+local meths = helpers.meths
+local nvim_dir = helpers.nvim_dir
before_each(clear)
describe('messages', function()
local screen
+ -- oldtest: Test_warning_scroll()
+ it('a warning causes scrolling if and only if it has a stacktrace', function()
+ screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [2] = {bold = true, reverse = true}, -- MsgSeparator
+ [3] = {foreground = Screen.colors.Red}, -- WarningMsg
+ })
+ screen:attach()
+
+ -- When the warning comes from a script, messages are scrolled so that the
+ -- stacktrace is visible.
+ -- It is a bit hard to assert the screen when sourcing a script, so skip this part.
+
+ -- When the warning does not come from a script, messages are not scrolled.
+ command('enew')
+ command('set readonly')
+ feed('u')
+ screen:expect({grid = [[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:W10: Warning: Changing a readonly file}^ |
+ ]], timeout = 500})
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ Already at oldest change |
+ ]])
+ end)
+
describe('more prompt', function()
before_each(function()
+ command('set more')
+ end)
+
+ -- oldtest: Test_message_more()
+ it('works', function()
screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
[1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
[2] = {foreground = Screen.colors.Brown}, -- LineNr
- [3] = {foreground = Screen.colors.Blue}, -- SpecialKey
})
screen:attach()
- command('set more')
- end)
- -- oldtest: Test_message_more()
- it('works', function()
command('call setline(1, range(1, 100))')
feed(':%pfoo<C-H><C-H><C-H>#')
@@ -313,16 +351,139 @@ describe('messages', function()
]])
end)
+ -- oldtest: Test_echo_verbose_system()
+ it('verbose message before echo command', function()
+ screen = Screen.new(60, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ })
+ screen:attach()
+
+ command('cd '..nvim_dir)
+ meths.set_option('shell', './shell-test')
+ meths.set_option('shellcmdflag', 'REP 20')
+ meths.set_option('shellxquote', '') -- win: avoid extra quotes
+
+ -- display a page and go back, results in exactly the same view
+ feed([[:4 verbose echo system('foo')<CR>]])
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('<Space>')
+ screen:expect([[
+ 7: foo |
+ 8: foo |
+ 9: foo |
+ 10: foo |
+ 11: foo |
+ 12: foo |
+ 13: foo |
+ 14: foo |
+ 15: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+
+ -- do the same with 'cmdheight' set to 2
+ feed('q')
+ command('set ch=2')
+ command('mode') -- FIXME: bottom is invalid after scrolling
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ |
+ ]])
+ feed([[:4 verbose echo system('foo')<CR>]])
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('<Space>')
+ screen:expect([[
+ 7: foo |
+ 8: foo |
+ 9: foo |
+ 10: foo |
+ 11: foo |
+ 12: foo |
+ 13: foo |
+ 14: foo |
+ 15: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ end)
+
-- oldtest: Test_quit_long_message()
it('with control characters can be quit vim-patch:8.2.1844', function()
- screen:try_resize(40, 6)
+ screen = Screen.new(40, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [2] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ })
+ screen:attach()
+
feed([[:echom range(9999)->join("\x01")<CR>]])
screen:expect([[
- 0{3:^A}1{3:^A}2{3:^A}3{3:^A}4{3:^A}5{3:^A}6{3:^A}7{3:^A}8{3:^A}9{3:^A}10{3:^A}11{3:^A}12|
- {3:^A}13{3:^A}14{3:^A}15{3:^A}16{3:^A}17{3:^A}18{3:^A}19{3:^A}20{3:^A}21{3:^A}22|
- {3:^A}23{3:^A}24{3:^A}25{3:^A}26{3:^A}27{3:^A}28{3:^A}29{3:^A}30{3:^A}31{3:^A}32|
- {3:^A}33{3:^A}34{3:^A}35{3:^A}36{3:^A}37{3:^A}38{3:^A}39{3:^A}40{3:^A}41{3:^A}42|
- {3:^A}43{3:^A}44{3:^A}45{3:^A}46{3:^A}47{3:^A}48{3:^A}49{3:^A}50{3:^A}51{3:^A}52|
+ 0{2:^A}1{2:^A}2{2:^A}3{2:^A}4{2:^A}5{2:^A}6{2:^A}7{2:^A}8{2:^A}9{2:^A}10{2:^A}11{2:^A}12|
+ {2:^A}13{2:^A}14{2:^A}15{2:^A}16{2:^A}17{2:^A}18{2:^A}19{2:^A}20{2:^A}21{2:^A}22|
+ {2:^A}23{2:^A}24{2:^A}25{2:^A}26{2:^A}27{2:^A}28{2:^A}29{2:^A}30{2:^A}31{2:^A}32|
+ {2:^A}33{2:^A}34{2:^A}35{2:^A}36{2:^A}37{2:^A}38{2:^A}39{2:^A}40{2:^A}41{2:^A}42|
+ {2:^A}43{2:^A}44{2:^A}45{2:^A}46{2:^A}47{2:^A}48{2:^A}49{2:^A}50{2:^A}51{2:^A}52|
+ {2:^A}53{2:^A}54{2:^A}55{2:^A}56{2:^A}57{2:^A}58{2:^A}59{2:^A}60{2:^A}61{2:^A}62|
+ {2:^A}63{2:^A}64{2:^A}65{2:^A}66{2:^A}67{2:^A}68{2:^A}69{2:^A}70{2:^A}71{2:^A}72|
+ {2:^A}73{2:^A}74{2:^A}75{2:^A}76{2:^A}77{2:^A}78{2:^A}79{2:^A}80{2:^A}81{2:^A}82|
+ {2:^A}83{2:^A}84{2:^A}85{2:^A}86{2:^A}87{2:^A}88{2:^A}89{2:^A}90{2:^A}91{2:^A}92|
{1:-- More --}^ |
]])
feed('q')
@@ -332,6 +493,10 @@ describe('messages', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
]])
end)
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 67991f5d48..3f1f85cf28 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -14,7 +14,7 @@ describe('search cmdline', function()
before_each(function()
clear()
- command('set nohlsearch')
+ command('set nohlsearch inccommand=')
screen = Screen.new(20, 3)
screen:attach()
screen:set_default_attr_ids({
@@ -472,8 +472,8 @@ describe('search cmdline', function()
funcs.winsaveview())
end)
+ -- oldtest: Test_search_cmdline4().
it("CTRL-G with 'incsearch' and ? goes in the right direction", function()
- -- oldtest: Test_search_cmdline4().
screen:try_resize(40, 4)
command('enew!')
funcs.setline(1, {' 1 the first', ' 2 the second', ' 3 the third'})
@@ -573,8 +573,8 @@ describe('search cmdline', function()
]])
end)
+ -- oldtest: Test_incsearch_sort_dump().
it('incsearch works with :sort', function()
- -- oldtest: Test_incsearch_sort_dump().
screen:try_resize(20, 4)
command('set incsearch hlsearch scrolloff=0')
funcs.setline(1, {'another one 2', 'that one 3', 'the one 1'})
@@ -589,8 +589,8 @@ describe('search cmdline', function()
feed('<esc>')
end)
+ -- oldtest: Test_incsearch_vimgrep_dump().
it('incsearch works with :vimgrep family', function()
- -- oldtest: Test_incsearch_vimgrep_dump().
screen:try_resize(30, 4)
command('set incsearch hlsearch scrolloff=0')
funcs.setline(1, {'another one 2', 'that one 3', 'the one 1'})
@@ -640,11 +640,74 @@ describe('search cmdline', function()
]])
feed('<esc>')
end)
+
+ -- oldtest: Test_incsearch_substitute_dump2()
+ it('detects empty pattern properly vim-patch:8.2.2295', function()
+ screen:try_resize(70, 6)
+ exec([[
+ set incsearch hlsearch scrolloff=0
+ for n in range(1, 4)
+ call setline(n, "foo " . n)
+ endfor
+ call setline(5, "abc|def")
+ 3
+ ]])
+
+ feed([[:%s/\vabc|]])
+ screen:expect([[
+ foo 1 |
+ foo 2 |
+ foo 3 |
+ foo 4 |
+ abc|def |
+ :%s/\vabc|^ |
+ ]])
+ feed('<Esc>')
+
+ -- The following should not be highlighted
+ feed([[:1,5s/\v|]])
+ screen:expect([[
+ foo 1 |
+ foo 2 |
+ foo 3 |
+ foo 4 |
+ abc|def |
+ :1,5s/\v|^ |
+ ]])
+ end)
end)
describe('Search highlight', function()
before_each(clear)
- it('Search highlight is combined with Visual highlight vim-patch:8.2.2797', function()
+
+ -- oldtest: Test_hlsearch_dump()
+ it('beyond line end vim-patch:8.2.2542', function()
+ local screen = Screen.new(50, 6)
+ screen:set_default_attr_ids({
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [2] = {background = Screen.colors.Yellow}, -- Search
+ [3] = {background = Screen.colors.Grey90}, -- CursorLine
+ })
+ screen:attach()
+ exec([[
+ set hlsearch noincsearch cursorline
+ call setline(1, ["xxx", "xxx", "xxx"])
+ /.*
+ 2
+ ]])
+ feed([[/\_.*<CR>]])
+ screen:expect([[
+ {2:xxx } |
+ {2:xxx } |
+ {2:^xxx }{3: }|
+ {1:~ }|
+ {1:~ }|
+ /\_.* |
+ ]])
+ end)
+
+ -- oldtest: Test_hlsearch_and_visual()
+ it('is combined with Visual highlight vim-patch:8.2.2797', function()
local screen = Screen.new(40, 6)
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
diff --git a/test/functional/legacy/search_stat_spec.lua b/test/functional/legacy/search_stat_spec.lua
index c2ca393a56..9fcf798836 100644
--- a/test/functional/legacy/search_stat_spec.lua
+++ b/test/functional/legacy/search_stat_spec.lua
@@ -17,6 +17,7 @@ describe('search stat', function()
screen:attach()
end)
+ -- oldtest: Test_search_stat_screendump()
it('right spacing with silent mapping vim-patch:8.1.1970', function()
exec([[
set shortmess-=S
@@ -57,6 +58,7 @@ describe('search stat', function()
]])
end)
+ -- oldtest: Test_search_stat_foldopen()
it('when only match is in fold vim-patch:8.2.0840', function()
exec([[
set shortmess-=S
@@ -86,6 +88,7 @@ describe('search stat', function()
screen:expect_unchanged()
end)
+ -- oldtest: Test_search_stat_then_gd()
it('is cleared by gd and gD vim-patch:8.2.3583', function()
exec([[
call setline(1, ['int cat;', 'int dog;', 'cat = dog;'])
@@ -120,6 +123,7 @@ describe('search stat', function()
]])
end)
+ -- oldtest: Test_search_stat_and_incsearch()
it('is not broken by calling searchcount() in tabline vim-patch:8.2.4378', function()
exec([[
call setline(1, ['abc--c', '--------abc', '--abc'])
diff --git a/test/functional/legacy/source_spec.lua b/test/functional/legacy/source_spec.lua
new file mode 100644
index 0000000000..f31521607d
--- /dev/null
+++ b/test/functional/legacy/source_spec.lua
@@ -0,0 +1,32 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local feed = helpers.feed
+local write_file = helpers.write_file
+
+before_each(clear)
+
+describe(':source!', function()
+ -- oldtest: Test_nested_script()
+ it('gives E22 when scripts nested too deep', function()
+ write_file('Xscript.vim', [[
+ :source! Xscript.vim
+ ]])
+ local screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+ feed(':source! Xscript.vim\n')
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {1:E22: Scripts nested too deep} |
+ ]])
+ os.remove('Xscript.vim')
+ end)
+end)
diff --git a/test/functional/legacy/statusline_spec.lua b/test/functional/legacy/statusline_spec.lua
index e2b30a7c82..c5b17f8749 100644
--- a/test/functional/legacy/statusline_spec.lua
+++ b/test/functional/legacy/statusline_spec.lua
@@ -68,4 +68,87 @@ describe('statusline', function()
|
]])
end)
+
+ -- oldtest: Test_statusline_showcmd()
+ it('showcmdloc=statusline works', function()
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.LightGrey}, -- Visual
+ [2] = {bold = true}, -- MoreMsg
+ [3] = {bold = true, reverse = true}, -- StatusLine
+ [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded
+ })
+ exec([[
+ func MyStatusLine()
+ return '%S'
+ endfunc
+
+ set showcmd
+ set laststatus=2
+ set statusline=%S
+ set showcmdloc=statusline
+ call setline(1, ['a', 'b', 'c'])
+ set foldopen+=jump
+ 1,2fold
+ 3
+ ]])
+
+ feed('g')
+ screen:expect([[
+ {5:+-- 2 lines: a···································}|
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {3:g }|
+ |
+ ]])
+
+ -- typing "gg" should open the fold
+ feed('g')
+ screen:expect([[
+ ^a |
+ b |
+ c |
+ {0:~ }|
+ {0:~ }|
+ {3: }|
+ |
+ ]])
+
+ feed('<C-V>Gl')
+ screen:expect([[
+ {1:a} |
+ {1:b} |
+ {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {3:3x2 }|
+ {2:-- VISUAL BLOCK --} |
+ ]])
+
+ feed('<Esc>1234')
+ screen:expect([[
+ a |
+ b |
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ {3:1234 }|
+ |
+ ]])
+
+ feed('<Esc>:set statusline=<CR>')
+ feed(':<CR>')
+ feed('1234')
+ screen:expect([[
+ a |
+ b |
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ {3:[No Name] [+] 1234 }|
+ : |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/080_substitute_spec.lua b/test/functional/legacy/substitute_spec.lua
index faeb61e3af..f3ce343680 100644
--- a/test/functional/legacy/080_substitute_spec.lua
+++ b/test/functional/legacy/substitute_spec.lua
@@ -3,11 +3,13 @@
-- Test for *:s%* on :substitute.
local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
local feed, insert = helpers.feed, helpers.insert
+local exec = helpers.exec
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
local eq, eval = helpers.eq, helpers.eval
-describe('substitue()', function()
+describe('substitute()', function()
before_each(clear)
-- The original test contained several TEST_X lines to delimit different
@@ -132,7 +134,7 @@ describe('substitue()', function()
end)
end)
-describe(':substitue', function()
+describe(':substitute', function()
before_each(clear)
it('with \\ze and \\zs and confirmation dialog (TEST_8)', function()
@@ -159,4 +161,29 @@ describe(':substitue', function()
feed('yyq') -- For the dialog of the previous :s command.
expect('XXx')
end)
+
+ it('first char is highlighted with confirmation dialog and empty match', function()
+ local screen = Screen.new(60, 8)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {reverse = true}, -- IncSearch
+ [2] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ })
+ screen:attach()
+ exec([[
+ set nohlsearch noincsearch
+ call setline(1, ['one', 'two', 'three'])
+ ]])
+ feed(':%s/^/ /c<CR>')
+ screen:expect([[
+ {1:o}ne |
+ two |
+ three |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2:replace with (y/n/a/q/l/^E/^Y)?}^ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua
index 06e8427e27..e6573da5d3 100644
--- a/test/functional/legacy/syn_attr_spec.lua
+++ b/test/functional/legacy/syn_attr_spec.lua
@@ -4,10 +4,10 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
-before_each(clear)
-
-- oldtest: Test_missing_attr()
-it('synIDattr() works', function()
+describe('synIDattr()', function()
+ setup(clear)
+
local bool_attrs = {
'bold',
'italic',
@@ -22,39 +22,55 @@ it('synIDattr() works', function()
'nocombine',
}
- command('hi Mine cterm=NONE gui=NONE')
- eq('Mine', eval([[synIDattr(hlID("Mine"), "name")]]))
- for _, mode in ipairs({'cterm', 'gui'}) do
- eq('', eval(([[synIDattr("Mine"->hlID(), "bg", '%s')]]):format(mode)))
- eq('', eval(([[synIDattr("Mine"->hlID(), "fg", '%s')]]):format(mode)))
- eq('', eval(([[synIDattr("Mine"->hlID(), "sp", '%s')]]):format(mode)))
- for _, attr in ipairs(bool_attrs) do
- eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
- eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
- eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
+ describe(':hi Mine cterm=NONE gui=NONE', function()
+ setup(function()
+ command(':hi Mine cterm=NONE gui=NONE')
+ end)
+
+ it('"name"', function()
+ eq('Mine', eval([[synIDattr(hlID("Mine"), "name")]]))
+ end)
+
+ local function none_test(attr, mode)
+ it(('"%s"'):format(attr), function()
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode)))
+ end)
end
- eq('', eval(([[synIDattr(hlID("Mine"), "inverse", '%s')]]):format(mode)))
+
+ for _, mode in ipairs({'cterm', 'gui'}) do
+ describe(('"%s"'):format(mode), function()
+ for _, attr in ipairs(bool_attrs) do
+ none_test(attr, mode)
+ end
+ for _, attr in ipairs({'inverse', 'bg', 'fg', 'sp'}) do
+ none_test(attr, mode)
+ end
+ end)
+ end
+ end)
+
+ local function attr_test(attr1, attr2)
+ local cmd = (':hi Mine cterm=%s gui=%s'):format(attr1, attr2)
+ it(cmd, function()
+ command(cmd)
+ eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr1)))
+ eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr2)))
+ eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr1)))
+ eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr2)))
+ end)
end
for i, attr1 in ipairs(bool_attrs) do
local attr2 = bool_attrs[i - 1] or bool_attrs[#bool_attrs]
-
- command(('hi Mine cterm=%s gui=%s'):format(attr1, attr2))
- eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr1)))
- eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr2)))
- eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr1)))
- eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr2)))
-
- command(('hi Mine cterm=%s gui=%s'):format(attr2, attr1))
- eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr1)))
- eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr2)))
- eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr1)))
- eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr2)))
+ attr_test(attr1, attr2)
+ attr_test(attr2, attr1)
end
- command('hi Mine cterm=reverse gui=inverse')
- eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'cterm')]]))
- eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'cterm')]]))
- eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'gui')]]))
- eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'gui')]]))
+ it(':hi Mine cterm=reverse gui=inverse', function()
+ command(':hi Mine cterm=reverse gui=inverse')
+ eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'cterm')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'cterm')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'gui')]]))
+ eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'gui')]]))
+ end)
end)
diff --git a/test/functional/legacy/tabline_spec.lua b/test/functional/legacy/tabline_spec.lua
new file mode 100644
index 0000000000..6b368d1857
--- /dev/null
+++ b/test/functional/legacy/tabline_spec.lua
@@ -0,0 +1,100 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+
+before_each(clear)
+
+describe('tabline', function()
+ local screen
+
+ before_each(function()
+ screen = Screen.new(50, 7)
+ screen:attach()
+ end)
+
+ -- oldtest: Test_tabline_showcmd()
+ it('showcmdloc=tabline works', function()
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {background = Screen.colors.LightGrey}, -- Visual
+ [2] = {bold = true}, -- MoreMsg, TabLineSel
+ [3] = {reverse = true}, -- TabLineFill
+ [4] = {background = Screen.colors.LightGrey, underline = true}, -- TabLine
+ [5] = {background = Screen.colors.LightGrey, foreground = Screen.colors.DarkBlue}, -- Folded
+ })
+ exec([[
+ func MyTabLine()
+ return '%S'
+ endfunc
+
+ set showcmd
+ set showtabline=2
+ set tabline=%!MyTabLine()
+ set showcmdloc=tabline
+ call setline(1, ['a', 'b', 'c'])
+ set foldopen+=jump
+ 1,2fold
+ 3
+ ]])
+
+ feed('g')
+ screen:expect([[
+ {3:g }|
+ {5:+-- 2 lines: a···································}|
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ -- typing "gg" should open the fold
+ feed('g')
+ screen:expect([[
+ {3: }|
+ ^a |
+ b |
+ c |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ feed('<C-V>Gl')
+ screen:expect([[
+ {3:3x2 }|
+ {1:a} |
+ {1:b} |
+ {1:c}^ |
+ {0:~ }|
+ {0:~ }|
+ {2:-- VISUAL BLOCK --} |
+ ]])
+
+ feed('<Esc>1234')
+ screen:expect([[
+ {3:1234 }|
+ a |
+ b |
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+
+ feed('<Esc>:set tabline=<CR>')
+ feed(':<CR>')
+ feed('1234')
+ screen:expect([[
+ {2: + [No Name] }{3: }{4:1234}{3: }|
+ a |
+ b |
+ ^c |
+ {0:~ }|
+ {0:~ }|
+ : |
+ ]])
+ end)
+end)
diff --git a/test/functional/legacy/vimscript_spec.lua b/test/functional/legacy/vimscript_spec.lua
new file mode 100644
index 0000000000..f59a87f824
--- /dev/null
+++ b/test/functional/legacy/vimscript_spec.lua
@@ -0,0 +1,90 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+local meths = helpers.meths
+
+before_each(clear)
+
+describe('Vim script', function()
+ -- oldtest: Test_deep_nest()
+ it('Error when if/for/while/try/function is nested too deep',function()
+ local screen = Screen.new(80, 24)
+ screen:attach()
+ meths.set_option('laststatus', 2)
+ exec([[
+ " Deep nesting of if ... endif
+ func Test1()
+ let @a = join(repeat(['if v:true'], 51), "\n")
+ let @a ..= "\n"
+ let @a ..= join(repeat(['endif'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
+
+ " Deep nesting of for ... endfor
+ func Test2()
+ let @a = join(repeat(['for i in [1]'], 51), "\n")
+ let @a ..= "\n"
+ let @a ..= join(repeat(['endfor'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
+
+ " Deep nesting of while ... endwhile
+ func Test3()
+ let @a = join(repeat(['while v:true'], 51), "\n")
+ let @a ..= "\n"
+ let @a ..= join(repeat(['endwhile'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
+
+ " Deep nesting of try ... endtry
+ func Test4()
+ let @a = join(repeat(['try'], 51), "\n")
+ let @a ..= "\necho v:true\n"
+ let @a ..= join(repeat(['endtry'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
+
+ " Deep nesting of function ... endfunction
+ func Test5()
+ let @a = join(repeat(['function X()'], 51), "\n")
+ let @a ..= "\necho v:true\n"
+ let @a ..= join(repeat(['endfunction'], 51), "\n")
+ @a
+ let @a = ''
+ endfunc
+ ]])
+ screen:expect({any = '%[No Name%]'})
+ feed(':call Test1()<CR>')
+ screen:expect({any = 'E579: '})
+ feed('<C-C>')
+ screen:expect({any = '%[No Name%]'})
+ feed(':call Test2()<CR>')
+ screen:expect({any = 'E585: '})
+ feed('<C-C>')
+ screen:expect({any = '%[No Name%]'})
+ feed(':call Test3()<CR>')
+ screen:expect({any = 'E585: '})
+ feed('<C-C>')
+ screen:expect({any = '%[No Name%]'})
+ feed(':call Test4()<CR>')
+ screen:expect({any = 'E601: '})
+ feed('<C-C>')
+ screen:expect({any = '%[No Name%]'})
+ feed(':call Test5()<CR>')
+ screen:expect({any = 'E1058: '})
+ end)
+
+ -- oldtest: Test_typed_script_var()
+ it('using s: with a typed command', function()
+ local screen = Screen.new(80, 24)
+ screen:attach()
+ feed(":echo get(s:, 'foo', 'x')\n")
+ screen:expect({any = 'E116: '})
+ end)
+end)
diff --git a/test/functional/legacy/visual_mode_spec.lua b/test/functional/legacy/visual_mode_spec.lua
index 8b5dd0c2dc..1a08fb4c0e 100644
--- a/test/functional/legacy/visual_mode_spec.lua
+++ b/test/functional/legacy/visual_mode_spec.lua
@@ -1,31 +1,28 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local call = helpers.call
local clear = helpers.clear
local feed = helpers.feed
-local feed_command = helpers.feed_command
-local funcs = helpers.funcs
-local meths = helpers.meths
-local eq = helpers.eq
local exec = helpers.exec
-describe('visual line mode', function()
- local screen
+before_each(clear)
+describe('visual line mode', function()
+ -- oldtest: Test_visual_block_scroll()
it('redraws properly after scrolling with matchparen loaded and scrolloff=1', function()
- clear{args={'-u', 'NORC'}}
- screen = Screen.new(30, 7)
+ local screen = Screen.new(30, 7)
screen:attach()
screen:set_default_attr_ids({
[1] = {bold = true},
[2] = {background = Screen.colors.LightGrey},
})
- eq(1, meths.get_var('loaded_matchparen'))
- feed_command('set scrolloff=1')
- funcs.setline(1, {'a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'})
- call('cursor', 5, 1)
+ exec([[
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set scrolloff=1
+ call setline(1, ['a', 'b', 'c', 'd', 'e', '', '{', '}', '{', 'f', 'g', '}'])
+ call cursor(5, 1)
+ ]])
feed('V<c-d><c-d>')
screen:expect([[
@@ -41,8 +38,8 @@ describe('visual line mode', function()
end)
describe('visual block mode', function()
+ -- oldtest: Test_visual_block_with_virtualedit()
it('shows selection correctly with virtualedit=block', function()
- clear()
local screen = Screen.new(30, 7)
screen:set_default_attr_ids({
[1] = {bold = true}, -- ModeMsg
diff --git a/test/functional/legacy/window_cmd_spec.lua b/test/functional/legacy/window_cmd_spec.lua
new file mode 100644
index 0000000000..0e9775060d
--- /dev/null
+++ b/test/functional/legacy/window_cmd_spec.lua
@@ -0,0 +1,227 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local exec_lua = helpers.exec_lua
+local feed = helpers.feed
+
+describe('splitkeep', function()
+ local screen
+
+ before_each(function()
+ clear('--cmd', 'set splitkeep=screen')
+ screen = Screen.new()
+ screen:attach()
+ end)
+
+ -- oldtest: Test_splitkeep_callback()
+ it('does not scroll when split in callback', function()
+ exec([[
+ call setline(1, range(&lines))
+ function C1(a, b, c)
+ split | wincmd p
+ endfunction
+ function C2(a, b, c)
+ close | split
+ endfunction
+ ]])
+ exec_lua([[
+ vim.api.nvim_set_keymap("n", "j", "", { callback = function()
+ vim.cmd("call jobstart([&sh, &shcf, 'true'], { 'on_exit': 'C1' })")
+ end
+ })]])
+ exec_lua([[
+ vim.api.nvim_set_keymap("n", "t", "", { callback = function()
+ vim.api.nvim_set_current_win(
+ vim.api.nvim_open_win(vim.api.nvim_create_buf(false, {}), false, {
+ width = 10,
+ relative = "cursor",
+ height = 4,
+ row = 0,
+ col = 0,
+ }))
+ vim.cmd("call termopen([&sh, &shcf, 'true'], { 'on_exit': 'C2' })")
+ end
+ })]])
+ feed('j')
+ screen:expect([[
+ 0 |
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+ 5 |
+ [No Name] [+] |
+ ^7 |
+ 8 |
+ 9 |
+ 10 |
+ 11 |
+ [No Name] [+] |
+ |
+ ]])
+ feed(':quit<CR>Ht')
+ screen:expect([[
+ ^0 |
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+ 5 |
+ [No Name] [+] |
+ 7 |
+ 8 |
+ 9 |
+ 10 |
+ 11 |
+ [No Name] [+] |
+ :quit |
+ ]])
+ feed(':set sb<CR>:quit<CR>Gj')
+ screen:expect([[
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+ ^5 |
+ [No Name] [+] |
+ 7 |
+ 8 |
+ 9 |
+ 10 |
+ 11 |
+ 12 |
+ [No Name] [+] |
+ :quit |
+ ]])
+ feed(':quit<CR>Gt')
+ screen:expect([[
+ 1 |
+ 2 |
+ 3 |
+ 4 |
+ 5 |
+ [No Name] [+] |
+ 7 |
+ 8 |
+ 9 |
+ 10 |
+ 11 |
+ ^12 |
+ [No Name] [+] |
+ :quit |
+ ]])
+ end)
+
+ -- oldtest: Test_splitkeep_fold()
+ it('does not scroll when window has closed folds', function()
+ exec([[
+ set splitkeep=screen
+ set foldmethod=marker
+ set number
+ let line = 1
+ for n in range(1, &lines)
+ call setline(line, ['int FuncName() {/*{{{*/', 1, 2, 3, 4, 5, '}/*}}}*/',
+ \ 'after fold'])
+ let line += 8
+ endfor
+ ]])
+ feed('L:wincmd s<CR>')
+ screen:expect([[
+ 1 +-- 7 lines: int FuncName() {···················|
+ 8 after fold |
+ 9 +-- 7 lines: int FuncName() {···················|
+ 16 after fold |
+ 17 +-- 7 lines: int FuncName() {···················|
+ 24 ^after fold |
+ [No Name] [+] |
+ 32 after fold |
+ 33 +-- 7 lines: int FuncName() {···················|
+ 40 after fold |
+ 41 +-- 7 lines: int FuncName() {···················|
+ 48 after fold |
+ [No Name] [+] |
+ :wincmd s |
+ ]])
+ feed(':quit<CR>')
+ screen:expect([[
+ 1 +-- 7 lines: int FuncName() {···················|
+ 8 after fold |
+ 9 +-- 7 lines: int FuncName() {···················|
+ 16 after fold |
+ 17 +-- 7 lines: int FuncName() {···················|
+ 24 after fold |
+ 25 +-- 7 lines: int FuncName() {···················|
+ 32 after fold |
+ 33 +-- 7 lines: int FuncName() {···················|
+ 40 after fold |
+ 41 +-- 7 lines: int FuncName() {···················|
+ 48 after fold |
+ 49 ^+-- 7 lines: int FuncName() {···················|
+ :quit |
+ ]])
+ feed('H:below split<CR>')
+ screen:expect([[
+ 1 +-- 7 lines: int FuncName() {···················|
+ 8 after fold |
+ 9 +-- 7 lines: int FuncName() {···················|
+ 16 after fold |
+ 17 +-- 7 lines: int FuncName() {···················|
+ [No Name] [+] |
+ 25 ^+-- 7 lines: int FuncName() {···················|
+ 32 after fold |
+ 33 +-- 7 lines: int FuncName() {···················|
+ 40 after fold |
+ 41 +-- 7 lines: int FuncName() {···················|
+ 48 after fold |
+ [No Name] [+] |
+ :below split |
+ ]])
+ feed(':wincmd k<CR>:quit<CR>')
+ screen:expect([[
+ 1 +-- 7 lines: int FuncName() {···················|
+ 8 after fold |
+ 9 +-- 7 lines: int FuncName() {···················|
+ 16 after fold |
+ 17 +-- 7 lines: int FuncName() {···················|
+ 24 after fold |
+ 25 ^+-- 7 lines: int FuncName() {···················|
+ 32 after fold |
+ 33 +-- 7 lines: int FuncName() {···················|
+ 40 after fold |
+ 41 +-- 7 lines: int FuncName() {···················|
+ 48 after fold |
+ 49 +-- 7 lines: int FuncName() {···················|
+ :quit |
+ ]])
+ end)
+
+ -- oldtest: Test_splitkeep_status()
+ it('does not scroll when split in callback', function()
+ exec([[
+ call setline(1, ['a', 'b', 'c'])
+ set nomodified
+ set splitkeep=screen
+ let win = winnr()
+ wincmd s
+ wincmd j
+ ]])
+ feed(':call win_move_statusline(win, 1)<CR>')
+ screen:expect([[
+ a |
+ b |
+ c |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ [No Name] |
+ ^a |
+ b |
+ c |
+ ~ |
+ [No Name] |
+ |
+ ]])
+ end)
+end)