aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/autocmd/termclose_spec.lua16
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua230
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua272
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua43
-rw-r--r--test/functional/legacy/charsearch_spec.lua42
-rw-r--r--test/functional/legacy/command_count_spec.lua243
-rw-r--r--test/functional/legacy/comparators_spec.lua14
-rw-r--r--test/functional/legacy/match_conceal_spec.lua228
-rw-r--r--test/functional/legacy/search_mbyte_spec.lua26
9 files changed, 1113 insertions, 1 deletions
diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua
index 0961340e61..4de3f039c1 100644
--- a/test/functional/autocmd/termclose_spec.lua
+++ b/test/functional/autocmd/termclose_spec.lua
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, execute, feed, nvim, nvim_dir = helpers.clear,
helpers.execute, helpers.feed, helpers.nvim, helpers.nvim_dir
+local eval, eq = helpers.eval, helpers.eq
describe('TermClose event', function()
local screen
@@ -25,4 +26,19 @@ describe('TermClose event', function()
TermClose works! |
]])
end)
+
+ it('reports the correct <abuf>', function()
+ execute('set hidden')
+ execute('autocmd TermClose * let g:abuf = expand("<abuf>")')
+ execute('edit foo')
+ execute('edit bar')
+ eq(2, eval('bufnr("%")'))
+ execute('terminal')
+ feed('<c-\\><c-n>')
+ eq(3, eval('bufnr("%")'))
+ execute('buffer 1')
+ eq(1, eval('bufnr("%")'))
+ execute('3bdelete!')
+ eq('3', eval('g:abuf'))
+ end)
end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
new file mode 100644
index 0000000000..483e465cee
--- /dev/null
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -0,0 +1,230 @@
+-- Tests for autocommands
+-- - FileWritePre writing a compressed file
+-- - FileReadPost reading a compressed file
+-- - BufNewFile reading a file template
+-- - BufReadPre decompressing the file to be read
+-- - FilterReadPre substituting characters in the temp file
+-- - FilterReadPost substituting characters after filtering
+-- - FileReadPre set options for decompression
+-- - FileReadPost decompress the file
+-- Note: This test is skipped if "gzip" is not available.
+-- $GZIP is made empty, "-v" would cause trouble.
+-- Use a FileChangedShell autocommand to avoid a prompt for "Xtestfile.gz"
+-- being modified outside of Vim (noticed on Solaris).
+
+local helpers, lfs = require('test.functional.helpers'), require('lfs')
+local clear, execute, expect, eq, neq, dedent, write_file, feed =
+ helpers.clear, helpers.execute, helpers.expect, helpers.eq, helpers.neq,
+ helpers.dedent, helpers.write_file, helpers.feed
+
+local function has_gzip()
+ return os.execute('gzip --help >/dev/null 2>&1') == 0
+end
+
+local function prepare_gz_file(name, text)
+ write_file(name, text..'\n')
+ -- Compress the file with gzip.
+ os.execute('gzip --force '..name)
+ -- This should create the .gz file and delete the original.
+ neq(nil, lfs.attributes(name..'.gz'))
+ eq(nil, lfs.attributes(name))
+end
+
+describe('file reading, writing and bufnew and filter autocommands', function()
+ local text1 = dedent([[
+ start of testfile
+ line 2 Abcdefghijklmnopqrstuvwxyz
+ line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 4 Abcdefghijklmnopqrstuvwxyz
+ line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 6 Abcdefghijklmnopqrstuvwxyz
+ line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 8 Abcdefghijklmnopqrstuvwxyz
+ line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 10 Abcdefghijklmnopqrstuvwxyz
+ end of testfile]])
+ setup(function()
+ write_file('Xtest.c', [[
+ /*
+ * Here is a new .c file
+ */
+ ]])
+ end)
+ before_each(clear)
+ teardown(function()
+ os.remove('Xtestfile.gz')
+ os.remove('Xtest.c')
+ os.remove('test.out')
+ end)
+
+ if not has_gzip() then
+ pending('skipped (missing `gzip` utility)', function() end)
+ else
+
+ it('FileReadPost (using gzip)', function()
+ prepare_gz_file('Xtestfile', text1)
+ execute('let $GZIP = ""')
+ --execute('au FileChangedShell * echo "caught FileChangedShell"')
+ execute('set bin')
+ execute("au FileReadPost *.gz '[,']!gzip -d")
+ -- Read and decompress the testfile.
+ execute('$r Xtestfile.gz')
+ expect('\n'..text1)
+ end)
+
+ it('BufReadPre, BufReadPost (using gzip)', function()
+ prepare_gz_file('Xtestfile', text1)
+ local gzip_data = io.open('Xtestfile.gz'):read('*all')
+ execute('let $GZIP = ""')
+ -- Setup autocommands to decompress before reading and re-compress afterwards.
+ execute("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
+ execute("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")
+ execute("au BufReadPost *.gz call rename(expand('<afile>'), expand('<afile>:r'))")
+ execute("au BufReadPost *.gz exe '!gzip ' . shellescape(expand('<afile>:r'))")
+ -- Edit compressed file.
+ execute('e! Xtestfile.gz')
+ -- Discard all prompts and messages.
+ feed('<C-L>')
+ -- Expect the decompressed file in the buffer.
+ expect(text1)
+ -- Expect the original file to be unchanged.
+ eq(gzip_data, io.open('Xtestfile.gz'):read('*all'))
+ end)
+
+ it('FileReadPre, FileReadPost', function()
+ prepare_gz_file('Xtestfile', text1)
+ execute('au! FileReadPre *.gz exe "silent !gzip -d " . shellescape(expand("<afile>"))')
+ execute('au FileReadPre *.gz call rename(expand("<afile>:r"), expand("<afile>"))')
+ execute("au! FileReadPost *.gz '[,']s/l/L/")
+ -- Read compressed file.
+ execute('$r Xtestfile.gz')
+ -- Discard all prompts and messages.
+ feed('<C-L>')
+ expect([[
+
+ start of testfiLe
+ Line 2 Abcdefghijklmnopqrstuvwxyz
+ Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ Line 4 Abcdefghijklmnopqrstuvwxyz
+ Line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ Line 6 Abcdefghijklmnopqrstuvwxyz
+ Line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ Line 8 Abcdefghijklmnopqrstuvwxyz
+ Line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ Line 10 Abcdefghijklmnopqrstuvwxyz
+ end of testfiLe]])
+ end)
+
+ end
+
+ it('FileAppendPre, FileAppendPost', function()
+ execute('au BufNewFile *.c read Xtest.c')
+ -- Will load Xtest.c.
+ execute('e! foo.c')
+ execute("au FileAppendPre *.out '[,']s/new/NEW/")
+ execute('au FileAppendPost *.out !cat Xtest.c >>test.out')
+ -- Append it to the output file.
+ execute('w>>test.out')
+ -- Discard all prompts and messages.
+ feed('<C-L>')
+ -- Expect the decompressed file in the buffer.
+ execute('e test.out')
+ expect([[
+
+ /*
+ * Here is a NEW .c file
+ */]])
+ end)
+
+ it('FilterReadPre, FilterReadPost', function()
+ -- Write a special input file for this test block.
+ write_file('test.out', dedent([[
+ startstart
+ ]]) .. text1 .. dedent([[
+
+
+ start of test.c
+ /*
+ * Here is a new .c file
+ */
+ end of test.c
+ ]]) .. text1 .. dedent([[
+
+
+ /*
+ * Here is a NEW .c file
+ */
+ /*
+ * Here is a new .c file
+ */
+ ]]) .. text1 .. dedent([[
+
+ /*
+ * Here is a new .c file
+ */]]))
+ -- Need temp files here.
+ execute('set shelltemp')
+ execute('au FilterReadPre *.out call rename(expand("<afile>"), expand("<afile>") . ".t")')
+ execute('au FilterReadPre *.out exe "silent !sed s/e/E/ " . shellescape(expand("<afile>")) . ".t >" . shellescape(expand("<afile>"))')
+ execute('au FilterReadPre *.out exe "silent !rm " . shellescape(expand("<afile>")) . ".t"')
+ execute("au FilterReadPost *.out '[,']s/x/X/g")
+ -- Edit the output file.
+ execute('e! test.out')
+ execute('23,$!cat')
+ -- Discard all prompts and messages.
+ feed('<C-L>')
+ -- Remove CR for when sed adds them.
+ execute([[23,$s/\r$//]])
+ expect([[
+ startstart
+ start of testfile
+ line 2 Abcdefghijklmnopqrstuvwxyz
+ line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 4 Abcdefghijklmnopqrstuvwxyz
+ line 5 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 6 Abcdefghijklmnopqrstuvwxyz
+ line 7 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 8 Abcdefghijklmnopqrstuvwxyz
+ line 9 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 10 Abcdefghijklmnopqrstuvwxyz
+ end of testfile
+
+ start of test.c
+ /*
+ * Here is a new .c file
+ */
+ end of test.c
+ start of testfile
+ line 2 Abcdefghijklmnopqrstuvwxyz
+ line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ line 4 Abcdefghijklmnopqrstuvwxyz
+ linE 5 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 6 AbcdefghijklmnopqrstuvwXyz
+ linE 7 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 8 AbcdefghijklmnopqrstuvwXyz
+ linE 9 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 10 AbcdefghijklmnopqrstuvwXyz
+ End of testfile
+
+ /*
+ * HEre is a NEW .c file
+ */
+ /*
+ * HEre is a new .c file
+ */
+ start of tEstfile
+ linE 2 AbcdefghijklmnopqrstuvwXyz
+ linE 3 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 4 AbcdefghijklmnopqrstuvwXyz
+ linE 5 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 6 AbcdefghijklmnopqrstuvwXyz
+ linE 7 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 8 AbcdefghijklmnopqrstuvwXyz
+ linE 9 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ linE 10 AbcdefghijklmnopqrstuvwXyz
+ End of testfile
+ /*
+ * HEre is a new .c file
+ */]])
+ end)
+end)
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
new file mode 100644
index 0000000000..205922eac2
--- /dev/null
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -0,0 +1,272 @@
+-- Test character classes in regexp using regexpengine 0, 1, 2.
+
+local helpers = require('test.functional.helpers')
+local ffi = require('ffi')
+local feed, insert, source = helpers.feed, helpers.insert, helpers.source
+local clear, execute, expect, eq, eval = helpers.clear, helpers.execute, helpers.expect, helpers.eq, helpers.eval
+local write_file = helpers.write_file
+
+local function sixlines(text)
+ local result = ''
+ for i = 1, 6 do
+ result = result .. text .. '\n'
+ end
+ return result
+end
+
+local function diff(text, nodedent)
+ local tmpname = os.tmpname()
+ if ffi.os == 'OSX' and string.match(tmpname, '^/tmp') then
+ tmpname = '/private'..tmpname
+ end
+ execute('w! '..tmpname)
+ helpers.wait()
+ local data = io.open(tmpname):read('*all')
+ if nodedent then
+ helpers.eq(text, data)
+ else
+ helpers.eq(helpers.dedent(text), data)
+ end
+ os.remove(tmpname)
+end
+
+describe('character classes in regexp', function()
+ local ctrl1 = '\t\x0c\r'
+ local punct1 = " !\"#$%&'()#+'-./"
+ local digits = '0123456789'
+ local punct2 = ':;<=>?@'
+ local upper = 'ABCDEFGHIXYZ'
+ local punct3 = '[\\]^_`'
+ local lower = 'abcdefghiwxyz'
+ local punct4 = '{|}~'
+ local ctrl2 = '\x7f\x80\x82\x90\x9b'
+ local iso_text = '\xa6\xb1\xbc\xc7\xd3\xe9' -- "¦±¼ÇÓé" in utf-8
+ setup(function()
+ -- The original test32.in file was not in utf-8 encoding and did also
+ -- contain some control characters. We use lua escape sequences to write
+ -- them to the test file.
+ local line = ctrl1..punct1..digits..punct2..upper..punct3..lower..punct4..ctrl2..iso_text
+ write_file('test36.in', sixlines(line))
+ end)
+ before_each(function()
+ clear()
+ execute('e test36.in')
+ end)
+ teardown(function()
+ os.remove('test36.in')
+ end)
+
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\d//g
+ 2 s/\%#=1\d//g
+ 3 s/\%#=2\d//g
+ 4 s/\%#=0[0-9]//g
+ 5 s/\%#=1[0-9]//g
+ 6 s/\%#=2[0-9]//g]])
+ diff(sixlines(ctrl1..punct1..punct2..upper..punct3..lower..punct4..
+ ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\D//g
+ 2 s/\%#=1\D//g
+ 3 s/\%#=2\D//g
+ 4 s/\%#=0[^0-9]//g
+ 5 s/\%#=1[^0-9]//g
+ 6 s/\%#=2[^0-9]//g]])
+ expect([[
+ 0123456789
+ 0123456789
+ 0123456789
+ 0123456789
+ 0123456789
+ 0123456789]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\o//g
+ 2 s/\%#=1\o//g
+ 3 s/\%#=2\o//g
+ 4 s/\%#=0[0-7]//g
+ 5 s/\%#=1[0-7]//g
+ 6 s/\%#=2[0-7]//g]])
+ diff(sixlines(ctrl1..punct1..'89'..punct2..upper..punct3..lower..punct4..ctrl2..
+ iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\O//g
+ 2 s/\%#=1\O//g
+ 3 s/\%#=2\O//g
+ 4 s/\%#=0[^0-7]//g
+ 5 s/\%#=1[^0-7]//g
+ 6 s/\%#=2[^0-7]//g]])
+ expect([[
+ 01234567
+ 01234567
+ 01234567
+ 01234567
+ 01234567
+ 01234567]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\x//g
+ 2 s/\%#=1\x//g
+ 3 s/\%#=2\x//g
+ 4 s/\%#=0[0-9A-Fa-f]//g
+ 5 s/\%#=1[0-9A-Fa-f]//g
+ 6 s/\%#=2[0-9A-Fa-f]//g]])
+ diff(sixlines(ctrl1..punct1..punct2..'GHIXYZ'..punct3..'ghiwxyz'..punct4..ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\X//g
+ 2 s/\%#=1\X//g
+ 3 s/\%#=2\X//g
+ 4 s/\%#=0[^0-9A-Fa-f]//g
+ 5 s/\%#=1[^0-9A-Fa-f]//g
+ 6 s/\%#=2[^0-9A-Fa-f]//g]])
+ expect([[
+ 0123456789ABCDEFabcdef
+ 0123456789ABCDEFabcdef
+ 0123456789ABCDEFabcdef
+ 0123456789ABCDEFabcdef
+ 0123456789ABCDEFabcdef
+ 0123456789ABCDEFabcdef]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\w//g
+ 2 s/\%#=1\w//g
+ 3 s/\%#=2\w//g
+ 4 s/\%#=0[0-9A-Za-z_]//g
+ 5 s/\%#=1[0-9A-Za-z_]//g
+ 6 s/\%#=2[0-9A-Za-z_]//g]])
+ diff(sixlines(ctrl1..punct1..punct2..'[\\]^`'..punct4..ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\W//g
+ 2 s/\%#=1\W//g
+ 3 s/\%#=2\W//g
+ 4 s/\%#=0[^0-9A-Za-z_]//g
+ 5 s/\%#=1[^0-9A-Za-z_]//g
+ 6 s/\%#=2[^0-9A-Za-z_]//g]])
+ expect([[
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz
+ 0123456789ABCDEFGHIXYZ_abcdefghiwxyz]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\h//g
+ 2 s/\%#=1\h//g
+ 3 s/\%#=2\h//g
+ 4 s/\%#=0[A-Za-z_]//g
+ 5 s/\%#=1[A-Za-z_]//g
+ 6 s/\%#=2[A-Za-z_]//g]])
+ diff(sixlines(ctrl1..punct1..digits..punct2..'[\\]^`'..punct4..ctrl2..
+ iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\H//g
+ 2 s/\%#=1\H//g
+ 3 s/\%#=2\H//g
+ 4 s/\%#=0[^A-Za-z_]//g
+ 5 s/\%#=1[^A-Za-z_]//g
+ 6 s/\%#=2[^A-Za-z_]//g]])
+ expect([[
+ ABCDEFGHIXYZ_abcdefghiwxyz
+ ABCDEFGHIXYZ_abcdefghiwxyz
+ ABCDEFGHIXYZ_abcdefghiwxyz
+ ABCDEFGHIXYZ_abcdefghiwxyz
+ ABCDEFGHIXYZ_abcdefghiwxyz
+ ABCDEFGHIXYZ_abcdefghiwxyz]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\a//g
+ 2 s/\%#=1\a//g
+ 3 s/\%#=2\a//g
+ 4 s/\%#=0[A-Za-z]//g
+ 5 s/\%#=1[A-Za-z]//g
+ 6 s/\%#=2[A-Za-z]//g]])
+ diff(sixlines(ctrl1..punct1..digits..punct2..punct3..punct4..ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\A//g
+ 2 s/\%#=1\A//g
+ 3 s/\%#=2\A//g
+ 4 s/\%#=0[^A-Za-z]//g
+ 5 s/\%#=1[^A-Za-z]//g
+ 6 s/\%#=2[^A-Za-z]//g]])
+ expect([[
+ ABCDEFGHIXYZabcdefghiwxyz
+ ABCDEFGHIXYZabcdefghiwxyz
+ ABCDEFGHIXYZabcdefghiwxyz
+ ABCDEFGHIXYZabcdefghiwxyz
+ ABCDEFGHIXYZabcdefghiwxyz
+ ABCDEFGHIXYZabcdefghiwxyz]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\l//g
+ 2 s/\%#=1\l//g
+ 3 s/\%#=2\l//g
+ 4 s/\%#=0[a-z]//g
+ 5 s/\%#=1[a-z]//g
+ 6 s/\%#=2[a-z]//g]])
+ diff(sixlines(ctrl1..punct1..digits..punct2..upper..punct3..punct4..
+ ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\L//g
+ 2 s/\%#=1\L//g
+ 3 s/\%#=2\L//g
+ 4 s/\%#=0[^a-z]//g
+ 5 s/\%#=1[^a-z]//g
+ 6 s/\%#=2[^a-z]//g]])
+ expect([[
+ abcdefghiwxyz
+ abcdefghiwxyz
+ abcdefghiwxyz
+ abcdefghiwxyz
+ abcdefghiwxyz
+ abcdefghiwxyz]])
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\u//g
+ 2 s/\%#=1\u//g
+ 3 s/\%#=2\u//g
+ 4 s/\%#=0[A-Z]//g
+ 5 s/\%#=1[A-Z]//g
+ 6 s/\%#=2[A-Z]//g]])
+ diff(sixlines(ctrl1..punct1..digits..punct2..punct3..lower..punct4..
+ ctrl2..iso_text))
+ end)
+ it('is working', function()
+ source([[
+ 1 s/\%#=0\U//g
+ 2 s/\%#=1\U//g
+ 3 s/\%#=2\U//g
+ 4 s/\%#=0[^A-Z]//g
+ 5 s/\%#=1[^A-Z]//g
+ 6 s/\%#=2[^A-Z]//g]])
+ expect([[
+ ABCDEFGHIXYZ
+ ABCDEFGHIXYZ
+ ABCDEFGHIXYZ
+ ABCDEFGHIXYZ
+ ABCDEFGHIXYZ
+ ABCDEFGHIXYZ]])
+ end)
+end)
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 855e9c6271..6349371808 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -2,6 +2,8 @@ local helpers = require('test.functional.helpers')
local nvim = helpers.meths
local clear, eq, neq = helpers.clear, helpers.eq, helpers.neq
local curbuf, buf = helpers.curbuf, helpers.bufmeths
+local curwin = helpers.curwin
+local redir_exec = helpers.redir_exec
local source, execute = helpers.source, helpers.execute
local function declare_hook_function()
@@ -86,7 +88,7 @@ end
local function make_buffer()
local old_buf = curbuf()
- execute('new')
+ execute('botright new')
local new_buf = curbuf()
execute('wincmd p') -- move previous window
@@ -96,6 +98,19 @@ local function make_buffer()
return new_buf
end
+local function get_new_window_number()
+ local old_win = curwin()
+ execute('botright new')
+ local new_win = curwin()
+ local new_winnr = redir_exec('echo winnr()')
+ execute('wincmd p') -- move previous window
+
+ neq(old_win, new_win)
+ eq(old_win, curwin())
+
+ return new_winnr:gsub('\n', '')
+end
+
describe('au OptionSet', function()
describe('with any opton (*)', function()
@@ -248,6 +263,32 @@ describe('au OptionSet', function()
end)
end)
+ describe('being set by setwinvar()', function()
+ it('should not trigger because option name does not match with backup', function()
+ set_hook('backup')
+
+ execute('call setwinvar(1, "&l:bk", 1)')
+ expected_empty()
+ end)
+
+ it('should trigger, use correct option name backup', function()
+ set_hook('backup')
+
+ execute('call setwinvar(1, "&backup", 1)')
+ expected_combination({'backup', 0, 1, 'local'})
+ end)
+
+ it('should not trigger if the current window is different from the targetted window', function()
+ set_hook('cursorcolumn')
+
+ local new_winnr = get_new_window_number()
+
+ execute('call setwinvar(' .. new_winnr .. ', "&cursorcolumn", 1)')
+ -- expected_combination({'cursorcolumn', 0, 1, 'local', {winnr = new_winnr}})
+ expected_empty()
+ end)
+ end)
+
describe('being set by neovim api', function()
it('should trigger if a boolean option be set globally', function()
set_hook('autochdir')
diff --git a/test/functional/legacy/charsearch_spec.lua b/test/functional/legacy/charsearch_spec.lua
new file mode 100644
index 0000000000..4a83801cfc
--- /dev/null
+++ b/test/functional/legacy/charsearch_spec.lua
@@ -0,0 +1,42 @@
+-- Test for character searches
+
+local helpers = require('test.functional.helpers')
+local feed, insert = helpers.feed, helpers.insert
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('charsearch', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ Xabcdefghijkemnopqretuvwxyz
+ Yabcdefghijkemnopqretuvwxyz
+ Zabcdefghijkemnokqretkvwxyz]])
+
+ -- Check that "fe" and ";" work.
+ execute('/^X')
+ feed('ylfep;;p,,p')
+ -- Check that save/restore works.
+ execute('/^Y')
+ feed('ylfep')
+ execute('let csave = getcharsearch()')
+ feed('fip')
+ execute('call setcharsearch(csave)')
+ feed(';p;p')
+ -- Check that setcharsearch() changes the settings.
+ execute('/^Z')
+ feed('ylfep')
+ execute("call setcharsearch({'char': 'k'})")
+ feed(';p')
+ execute("call setcharsearch({'forward': 0})")
+ feed('$;p')
+ execute("call setcharsearch({'until': 1})")
+ feed(';;p')
+
+ -- Assert buffer contents.
+ expect([[
+ XabcdeXfghijkeXmnopqreXtuvwxyz
+ YabcdeYfghiYjkeYmnopqreYtuvwxyz
+ ZabcdeZfghijkZZemnokqretkZvwxyz]])
+ end)
+end)
diff --git a/test/functional/legacy/command_count_spec.lua b/test/functional/legacy/command_count_spec.lua
new file mode 100644
index 0000000000..d9b4f09263
--- /dev/null
+++ b/test/functional/legacy/command_count_spec.lua
@@ -0,0 +1,243 @@
+-- Test for user command counts
+
+local helpers = require('test.functional.helpers')
+local clear, source, expect = helpers.clear, helpers.source, helpers.expect
+local execute, spawn = helpers.execute, helpers.spawn
+local nvim_prog = helpers.nvim_prog
+
+describe('command_count', function()
+ setup(clear)
+ teardown(function()
+ os.remove('test.out')
+ end)
+
+ it('is working', function()
+ -- It is relevant for the test to load a file initially. If this is
+ -- emulated with :arg the buffer count is wrong as nvim creates an empty
+ -- buffer if it was started without a filename.
+ local nvim2 = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
+ 'test_command_count.in'})
+ helpers.set_session(nvim2)
+
+ source([[
+ lang C
+ let g:lines = []
+ com -range=% RangeLines
+ \ :call add(g:lines, 'RangeLines '.<line1>.' '.<line2>)
+ com -range -addr=arguments RangeArguments
+ \ :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
+ com -range=% -addr=arguments RangeArgumentsAll
+ \ :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
+ com -range -addr=loaded_buffers RangeLoadedBuffers
+ \ :call add(g:lines, 'RangeLoadedBuffers '.<line1>.' '.<line2>)
+ com -range=% -addr=loaded_buffers RangeLoadedBuffersAll
+ \ :call add(g:lines, 'RangeLoadedBuffersAll '.<line1>.' '.<line2>)
+ com -range -addr=buffers RangeBuffers
+ \ :call add(g:lines, 'RangeBuffers '.<line1>.' '.<line2>)
+ com -range=% -addr=buffers RangeBuffersAll
+ \ :call add(g:lines, 'RangeBuffersAll '.<line1>.' '.<line2>)
+ com -range -addr=windows RangeWindows
+ \ :call add(g:lines, 'RangeWindows '.<line1>.' '.<line2>)
+ com -range=% -addr=windows RangeWindowsAll
+ \ :call add(g:lines, 'RangeWindowsAll '.<line1>.' '.<line2>)
+ com -range -addr=tabs RangeTabs
+ \ :call add(g:lines, 'RangeTabs '.<line1>.' '.<line2>)
+ com -range=% -addr=tabs RangeTabsAll
+ \ :call add(g:lines, 'RangeTabsAll '.<line1>.' '.<line2>)
+ set hidden
+ arga a b c d
+ argdo echo "loading buffers"
+ argu 3
+ .-,$-RangeArguments
+ %RangeArguments
+ RangeArgumentsAll
+ N
+ .RangeArguments
+ split
+ split
+ split
+ split
+ 3wincmd w
+ .,$RangeWindows
+ %RangeWindows
+ RangeWindowsAll
+ only
+ blast
+ bd
+ .,$RangeLoadedBuffers
+ %RangeLoadedBuffers
+ RangeLoadedBuffersAll
+ .,$RangeBuffers
+ %RangeBuffers
+ RangeBuffersAll
+ tabe
+ tabe
+ tabe
+ tabe
+ normal 2gt
+ .,$RangeTabs
+ %RangeTabs
+ RangeTabsAll
+ 1tabonly
+ s/\n/\r\r\r\r\r/
+ 2ma<
+ $-ma>
+ '<,'>RangeLines
+ com -range=% -buffer LocalRangeLines
+ \ :call add(g:lines, 'LocalRangeLines '.<line1>.' '.<line2>)
+ '<,'>LocalRangeLines
+ b1
+ call add(g:lines, '')
+ %argd
+ arga a b c d
+ ]])
+ -- This can not be in the source() call as it will produce errors.
+ execute([[let v:errmsg = '']])
+ execute('5argu')
+ execute([[call add(g:lines, '5argu ' . v:errmsg)]])
+ execute('$argu')
+ execute([[call add(g:lines, '4argu ' . expand('%:t'))]])
+ execute([[let v:errmsg = '']])
+ execute('1argu')
+ execute([[call add(g:lines, '1argu ' . expand('%:t'))]])
+ execute([[let v:errmsg = '']])
+ execute('100b')
+ execute([[call add(g:lines, '100b ' . v:errmsg)]])
+ execute('split')
+ execute('split')
+ execute('split')
+ execute('split')
+ execute([[let v:errmsg = '']])
+ execute('0close')
+ execute([[call add(g:lines, '0close ' . v:errmsg)]])
+ execute('$wincmd w')
+ execute('$close')
+ execute([[call add(g:lines, '$close ' . winnr())]])
+ execute([[let v:errmsg = '']])
+ execute('$+close')
+ execute([[call add(g:lines, '$+close ' . v:errmsg)]])
+ execute('$tabe')
+ execute([[call add(g:lines, '$tabe ' . tabpagenr())]])
+ execute([[let v:errmsg = '']])
+ execute('$+tabe')
+ execute([[call add(g:lines, '$+tabe ' . v:errmsg)]])
+ source([[
+ only!
+ e x
+ 0tabm
+ normal 1gt
+ call add(g:lines, '0tabm ' . expand('%:t'))
+ tabonly!
+ only!
+ e! test.out
+ call append(0, g:lines)
+ unlet g:lines
+ w
+ bd
+ b1
+ let g:lines = []
+ func BufStatus()
+ call add(g:lines,
+ \ 'aaa: ' . buflisted(g:buf_aaa) .
+ \ ' bbb: ' . buflisted(g:buf_bbb) .
+ \ ' ccc: ' . buflisted(g:buf_ccc))
+ endfunc
+ se nohidden
+ e aaa
+ let buf_aaa = bufnr('%')
+ e bbb
+ let buf_bbb = bufnr('%')
+ e ccc
+ let buf_ccc = bufnr('%')
+ b1
+ call BufStatus()
+ exe buf_bbb . "," . buf_ccc . "bdelete"
+ call BufStatus()
+ exe buf_aaa . "bdelete"
+ call BufStatus()
+ e! test.out
+ call append('$', g:lines)
+ unlet g:lines
+ delfunc BufStatus
+ w
+ bd
+ b1
+ se hidden
+ only!
+ let g:lines = []
+ %argd
+ arga a b c d e f
+ 3argu
+ let args = ''
+ .,$-argdo let args .= ' '.expand('%')
+ call add(g:lines, 'argdo:' . args)
+ split
+ split
+ split
+ split
+ 2wincmd w
+ let windows = ''
+ .,$-windo let windows .= ' '.winnr()
+ call add(g:lines, 'windo:'. windows)
+ b2
+ let buffers = ''
+ .,$-bufdo let buffers .= ' '.bufnr('%')
+ call add(g:lines, 'bufdo:' . buffers)
+ 3bd
+ let buffers = ''
+ 3,7bufdo let buffers .= ' '.bufnr('%')
+ call add(g:lines, 'bufdo:' . buffers)
+ tabe
+ tabe
+ tabe
+ tabe
+ normal! 2gt
+ let tabpages = ''
+ .,$-tabdo let tabpages .= ' '.tabpagenr()
+ call add(g:lines, 'tabdo:' . tabpages)
+ e! test.out
+ call append('$', g:lines)
+ ]])
+
+ -- Assert buffer contents.
+ expect([[
+ RangeArguments 2 4
+ RangeArguments 1 5
+ RangeArgumentsAll 1 5
+ RangeArguments 2 2
+ RangeWindows 3 5
+ RangeWindows 1 5
+ RangeWindowsAll 1 5
+ RangeLoadedBuffers 2 4
+ RangeLoadedBuffers 1 4
+ RangeLoadedBuffersAll 1 4
+ RangeBuffers 2 5
+ RangeBuffers 1 5
+ RangeBuffersAll 1 5
+ RangeTabs 2 5
+ RangeTabs 1 5
+ RangeTabsAll 1 5
+ RangeLines 2 5
+ LocalRangeLines 2 5
+
+ 5argu E16: Invalid range
+ 4argu d
+ 1argu a
+ 100b E16: Invalid range
+ 0close
+ $close 3
+ $+close E16: Invalid range
+ $tabe 2
+ $+tabe E16: Invalid range
+ 0tabm x
+
+ aaa: 1 bbb: 1 ccc: 1
+ aaa: 1 bbb: 0 ccc: 0
+ aaa: 0 bbb: 0 ccc: 0
+ argdo: c d e
+ windo: 2 3 4
+ bufdo: 2 3 4 5 6 7 8 9 10 15
+ bufdo: 4 5 6 7
+ tabdo: 2 3 4]])
+ end)
+end)
diff --git a/test/functional/legacy/comparators_spec.lua b/test/functional/legacy/comparators_spec.lua
new file mode 100644
index 0000000000..e3fa3eea23
--- /dev/null
+++ b/test/functional/legacy/comparators_spec.lua
@@ -0,0 +1,14 @@
+-- " Test for expression comparators.
+
+local helpers = require('test.functional.helpers')
+local clear, eq = helpers.clear, helpers.eq
+local eval, execute = helpers.eval, helpers.execute
+
+describe('comparators', function()
+ before_each(clear)
+
+ it('is working', function()
+ execute('set isident+=#')
+ eq(1, eval('1 is#1'))
+ end)
+end)
diff --git a/test/functional/legacy/match_conceal_spec.lua b/test/functional/legacy/match_conceal_spec.lua
new file mode 100644
index 0000000000..0ffa3cae7a
--- /dev/null
+++ b/test/functional/legacy/match_conceal_spec.lua
@@ -0,0 +1,228 @@
+-- Test for matchadd() and conceal feature
+
+local helpers = require('test.functional.helpers')
+local clear = helpers.clear
+local expect = helpers.expect
+local source = helpers.source
+
+describe('match_conceal', function()
+ before_each(function()
+ clear()
+
+ source([[
+ set wildchar=^E
+ 10new
+ vsp
+ vert resize 20
+ put =\"\#\ This\ is\ a\ Test\"
+ norm! mazt
+
+ fu! ScreenChar(width, lines)
+ let c=''
+ for j in range(1,a:lines)
+ for i in range(1,a:width)
+ let c.=nr2char(screenchar(j, i))
+ endfor
+ let c.="\n"
+ endfor
+ return c
+ endfu
+
+ fu! ScreenAttr(line, pos, eval)
+ let g:attr=[]
+ for col in a:pos
+ call add(g:attr, screenattr(a:line,col))
+ endfor
+ " In case all values are zero, probably the terminal
+ " isn't set correctly, so catch that case
+ let null = (eval(join(g:attr, '+')) == 0)
+ let str=substitute(a:eval, '\d\+', 'g:attr[&]', 'g')
+ if null || eval(str)
+ let g:attr_test="OK: ". str
+ else
+ let g:attr_test="FAILED: ".str
+ let g:attr_test.="\n". join(g:attr, ' ')
+ let g:attr_test.="\n TERM: ". &term
+ endif
+ endfu
+
+ fu! DoRecordScreen()
+ wincmd l
+ $put =printf(\"\n%s\", g:test)
+ $put =g:line
+ $put =g:attr_test
+ wincmd p
+ endfu
+ ]])
+ end)
+
+ it('is working', function()
+ source([=[
+ let g:test ="Test 1: simple addmatch()"
+ call matchadd('Conceal', '\%2l ')
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+
+ let g:test ="Test 2: simple addmatch() and conceal (should be: #XThisXisXaXTest)"
+ norm! 'azt
+ call clearmatches()
+ syntax on
+ set concealcursor=n conceallevel=1
+ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+
+ let g:test ="Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)"
+ norm! 'azt
+ set conceallevel=3
+ call clearmatches()
+ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 1==3 && 1==4 && 0!=5")
+ call DoRecordScreen()
+
+ let g:test ="Test 4: more match() (should be: #Thisisa Test)"
+ norm! 'azt
+ call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'})
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 0!=3 && 3==4 && 0!=5 && 3!=5")
+ call DoRecordScreen()
+
+ let g:test ="Test 5/1: default conceal char (should be: # This is a Test)"
+ norm! 'azt
+ call clearmatches()
+ set conceallevel=1
+ call matchadd('Conceal', '\%2l ', 10, -1, {})
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+ let g:test ="Test 5/2: default conceal char (should be: #+This+is+a+Test)"
+ norm! 'azt
+ set listchars=conceal:+
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+ set listchars&vi
+
+ let g:test ="Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)"
+ norm! 'azt
+ call clearmatches()
+ set conceallevel=1
+ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
+ syn match MyConceal /\%2l / conceal containedin=ALL cchar=*
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+ let g:test ="Test 6/2: syn and match conceal (should be: #*This*is*a*Test)"
+ norm! 'azt
+ call clearmatches()
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+
+ let g:test ="Test 7/1: clear matches"
+ norm! 'azt
+ syn on
+ call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
+ let a=getmatches()
+ call clearmatches()
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 0==2 && 0==3 && 0==4 && 0==5")
+ call DoRecordScreen()
+ $put =a
+ call setmatches(a)
+ norm! 'azt
+ let g:test ="Test 7/2: reset match using setmatches()"
+ norm! 'azt
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+
+ let g:test ="Test 8: using matchaddpos() (should be #Pis a Test"
+ norm! 'azt
+ call clearmatches()
+ call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'})
+ let a=getmatches()
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1!=2 && 0==2 && 0==3 && 0!=4 && 0!=5 && 4==5")
+ call DoRecordScreen()
+ $put =a
+
+ let g:test ="Test 9: match using multibyte conceal char (should be: #ˑThisˑisˑaˑTest)"
+ norm! 'azt
+ call clearmatches()
+ call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
+ redraw!
+ let line=ScreenChar(winwidth(0),1)
+ call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
+ call DoRecordScreen()
+ ]=])
+
+ expect([=[
+
+ # This is a Test
+
+ Test 1: simple addmatch()
+ # This is a Test
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 2: simple addmatch() and conceal (should be: #XThisXisXaXTest)
+ #XThisXisXaXTest
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)
+ #ThisisaTest
+ OK: g:attr[0]==g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]!=g:attr[5]
+
+ Test 4: more match() (should be: #Thisisa Test)
+ #Thisisa Test
+ OK: g:attr[0]==g:attr[1] && g:attr[1]==g:attr[2] && g:attr[0]!=g:attr[3] && g:attr[3]==g:attr[4] && g:attr[0]!=g:attr[5] && g:attr[3]!=g:attr[5]
+
+ Test 5/1: default conceal char (should be: # This is a Test)
+ # This is a Test
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 5/2: default conceal char (should be: #+This+is+a+Test)
+ #+This+is+a+Test
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)
+ #ZThisZisZaZTest
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 6/2: syn and match conceal (should be: #*This*is*a*Test)
+ #*This*is*a*Test
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 7/1: clear matches
+ # This is a Test
+ OK: g:attr[0]==g:attr[1] && g:attr[0]==g:attr[2] && g:attr[0]==g:attr[3] && g:attr[0]==g:attr[4] && g:attr[0]==g:attr[5]
+ {'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': 10, 'conceal': 'Z'}
+
+ Test 7/2: reset match using setmatches()
+ #ZThisZisZaZTest
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
+
+ Test 8: using matchaddpos() (should be #Pis a Test
+ #Pis a Test
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]!=g:attr[2] && g:attr[0]==g:attr[2] && g:attr[0]==g:attr[3] && g:attr[0]!=g:attr[4] && g:attr[0]!=g:attr[5] && g:attr[4]==g:attr[5]
+ {'group': 'Conceal', 'id': 11, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}
+
+ Test 9: match using multibyte conceal char (should be: #ˑThisˑisˑaˑTest)
+ #ˑThisˑisˑaˑTest
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]]=])
+ end)
+end)
diff --git a/test/functional/legacy/search_mbyte_spec.lua b/test/functional/legacy/search_mbyte_spec.lua
new file mode 100644
index 0000000000..075b24b897
--- /dev/null
+++ b/test/functional/legacy/search_mbyte_spec.lua
@@ -0,0 +1,26 @@
+local helpers = require('test.functional.helpers')
+local insert = helpers.insert
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('search_mbyte', function()
+ before_each(clear)
+
+ it("search('multi-byte char', 'bce')", function()
+ insert([=[
+ Results:
+
+ Test bce:
+ A]=])
+
+ execute('/^Test bce:/+1')
+ execute([[$put =search('A', 'bce', line('.'))]])
+
+ -- Assert buffer contents.
+ expect([=[
+ Results:
+
+ Test bce:
+ A
+ 4]=])
+ end)
+end)