aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/helpers.lua24
-rw-r--r--test/functional/legacy/004_bufenter_with_modelines_spec.lua72
-rw-r--r--test/functional/legacy/006_argument_list_spec.lua81
-rw-r--r--test/functional/legacy/007_ball_buffer_list_spec.lua77
-rw-r--r--test/functional/legacy/009_bufleave_autocommand_spec.lua22
-rw-r--r--test/functional/legacy/018_unset_smart_indenting_spec.lua28
-rw-r--r--test/functional/legacy/020_blockwise_visual_spec.lua49
-rw-r--r--test/functional/legacy/021_control_wi_spec.lua41
-rw-r--r--test/functional/legacy/022_line_ending_spec.lua25
-rw-r--r--test/functional/legacy/023_edit_arguments_spec.lua52
-rw-r--r--test/functional/legacy/027_expand_file_names_spec.lua38
-rw-r--r--test/functional/legacy/028_source_ctrl_v_spec.lua40
-rw-r--r--test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua40
-rw-r--r--test/functional/legacy/046_multi_line_regexps_spec.lua52
-rw-r--r--test/functional/legacy/054_buffer_local_autocommands_spec.lua33
-rw-r--r--test/functional/legacy/056_script_local_function_spec.lua31
-rw-r--r--test/functional/legacy/081_coptions_movement_spec.lua39
-rw-r--r--test/functional/legacy/097_glob_path_spec.lua50
-rw-r--r--test/functional/legacy/102_fnameescape_spec.lua26
-rw-r--r--test/functional/legacy/106_errorformat_spec.lua25
-rw-r--r--test/functional/legacy/autoformat_join_spec.lua41
-rw-r--r--test/functional/legacy/changelist_spec.lua26
-rw-r--r--test/functional/legacy/insertcount_spec.lua24
-rw-r--r--test/functional/legacy/options_spec.lua20
-rw-r--r--test/functional/legacy/utf8_spec.lua31
25 files changed, 986 insertions, 1 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index d9107543ea..70f4fcf9e5 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -67,6 +67,25 @@ local function restart()
mapclear!
abclear
comclear
+ let regs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/-"'
+ let i = 0
+ while i < strlen(regs)
+ call setreg(regs[i], '')
+ let i = i+1
+ endwhile
+ redir => funcs
+ silent! function
+ redir END
+ for fname in split(funcs, '\n')
+ let matches = matchlist(fname, '\v^function ([^()<>]+)')
+ if type([]) == type(matches) && matches[1] !~ 'BeforeEachTest'
+ exe 'silent! delfunc '.matches[1]
+ endif
+ endfor
+ let options = ['shell', 'fileignorecase']
+ for option in options
+ exe 'set '.option.'&'
+ endfor
endfunction
]])
end
@@ -83,6 +102,9 @@ local function request(method, ...)
error(rv[2])
end
end
+ -- Make sure this will only return after all buffered characters have been
+ -- processed
+ session:request('vim_eval', '1')
return rv
end
@@ -201,7 +223,6 @@ local function expect(contents, first, last, buffer_index)
return eq(dedent(contents), buffer_slice(first, last, buffer_index))
end
-
local function ok(expr)
assert.is_true(expr)
end
@@ -254,6 +275,7 @@ restart()
return {
clear = clear,
+ dedent = dedent,
restart = restart,
rawfeed = rawfeed,
insert = insert,
diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
new file mode 100644
index 0000000000..f1222700a7
--- /dev/null
+++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua
@@ -0,0 +1,72 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Test for autocommand that changes current buffer on BufEnter event.
+-- Check if modelines are interpreted for the correct buffer.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('BufEnter with modelines', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ startstart
+ start of test file Xxx
+ vim: set noai :
+ this is a test
+ this is a test
+ this is a test
+ this is a test
+ end of test file Xxx]])
+
+ execute('au BufEnter Xxx brew')
+
+ -- Write test file Xxx
+ execute('/start of')
+ execute('.,/end of/w! Xxx')
+ execute('set ai modeline modelines=3')
+
+ -- Split to Xxx, autocmd will do :brew
+ execute('sp Xxx')
+
+ -- Append text with autoindent to this file
+ feed('G?this is a<Esc>')
+ feed('othis should be auto-indented<Esc>')
+
+ -- Go to Xxx, no autocmd anymore
+ execute('au! BufEnter Xxx')
+ execute('buf Xxx')
+
+ -- Append text without autoindent to Xxx
+ feed('G?this is a<Esc>')
+ feed('othis should be in column 1<Esc>')
+ execute('wq')
+
+ -- Include Xxx in the current file
+ feed('G:r Xxx<CR>')
+
+ expect([[
+ startstart
+ start of test file Xxx
+ vim: set noai :
+ this is a test
+ this is a test
+ this is a test
+ this is a test
+ this should be auto-indented
+ end of test file Xxx
+ start of test file Xxx
+ vim: set noai :
+ this is a test
+ this is a test
+ this is a test
+ this is a test
+ this should be in column 1
+ end of test file Xxx]])
+ end)
+
+ teardown(function()
+ os.remove('Xxx')
+ end)
+end)
diff --git a/test/functional/legacy/006_argument_list_spec.lua b/test/functional/legacy/006_argument_list_spec.lua
new file mode 100644
index 0000000000..30fb9a55ff
--- /dev/null
+++ b/test/functional/legacy/006_argument_list_spec.lua
@@ -0,0 +1,81 @@
+-- Test for autocommand that redefines the argument list, when doing ":all".
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, dedent, eq = helpers.execute, helpers.dedent, helpers.eq
+local curbuf_contents = helpers.curbuf_contents
+
+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]])
+
+ execute('au BufReadPost Xxx2 next Xxx2 Xxx1')
+ execute('/^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>')
+
+ -- Redefine arglist; go to Xxx1
+ execute('next! Xxx1 Xxx2 Xxx3')
+
+ -- Open window for all args
+ execute('all')
+
+ -- Write contents of Xxx1
+ execute('%yank A')
+
+ -- Append contents of last window (Xxx1)
+ feed('')
+ execute('%yank A')
+
+ -- should now be in Xxx2
+ execute('rew')
+
+ -- Append contents of Xxx2
+ execute('%yank A')
+
+ execute('%d')
+ execute('0put=@a')
+ execute('1d | $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/007_ball_buffer_list_spec.lua b/test/functional/legacy/007_ball_buffer_list_spec.lua
new file mode 100644
index 0000000000..6d89323215
--- /dev/null
+++ b/test/functional/legacy/007_ball_buffer_list_spec.lua
@@ -0,0 +1,77 @@
+-- Test for autocommand that changes the buffer list, when doing ":ball".
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe(':ball', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ start of test file Xxx
+ this is a test
+ this is a test
+ end of test file Xxx]])
+
+ execute('w! Xxx0')
+ feed('gg')
+
+ -- Write test file Xxx1
+ feed('A1:.,/end of/w! Xxx1<cr>')
+ execute('sp Xxx1')
+ execute('close')
+
+ -- Write test file Xxx2
+ feed('$r2:.,/end of/w! Xxx2<cr>')
+ execute('sp Xxx2')
+ execute('close')
+
+ -- Write test file Xxx3
+ feed('$r3:.,/end of/w! Xxx3<cr>')
+ execute('sp Xxx3')
+ execute('close')
+
+ execute('au BufReadPost Xxx2 bwipe')
+
+ -- Open window for all args, close Xxx2
+ feed('$r4:ball<cr>')
+
+ -- Write contents of this file
+ execute('%yank A')
+
+ -- Append contents of second window (Xxx1)
+ feed('')
+ execute('%yank A')
+
+ -- Append contents of last window (this file)
+ feed('')
+ execute('%yank A')
+
+ execute('bf')
+ execute('%d')
+ execute('0put=@a')
+ execute('1d | $d')
+
+ expect([[
+ start of test file Xxx4
+ 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
+ end of test file Xxx
+ start of test file Xxx4
+ this is a test
+ this is a test
+ end of test file Xxx]])
+ end)
+
+ teardown(function()
+ os.remove('Xxx0')
+ os.remove('Xxx1')
+ os.remove('Xxx2')
+ os.remove('Xxx3')
+ end)
+end)
diff --git a/test/functional/legacy/009_bufleave_autocommand_spec.lua b/test/functional/legacy/009_bufleave_autocommand_spec.lua
new file mode 100644
index 0000000000..0fc1b5b657
--- /dev/null
+++ b/test/functional/legacy/009_bufleave_autocommand_spec.lua
@@ -0,0 +1,22 @@
+-- Test for Bufleave autocommand that deletes the buffer we are about to edit.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('BufLeave autocommand', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ start of test file xx
+ end of test file xx]])
+
+ execute('au BufLeave * bwipe yy')
+ execute('e yy')
+
+ expect([[
+ start of test file xx
+ end of test file xx]])
+ end)
+end)
diff --git a/test/functional/legacy/018_unset_smart_indenting_spec.lua b/test/functional/legacy/018_unset_smart_indenting_spec.lua
new file mode 100644
index 0000000000..6975cb7f26
--- /dev/null
+++ b/test/functional/legacy/018_unset_smart_indenting_spec.lua
@@ -0,0 +1,28 @@
+-- Tests for not doing smart indenting when it isn't set.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('unset smart indenting', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ start text
+ some test text
+ test text
+ test text
+ test text]])
+
+ execute('set nocin nosi ai')
+ execute('/some')
+ feed('2cc#test<Esc>')
+
+ expect([[
+ start text
+ #test
+ test text
+ test text]])
+ end)
+end)
diff --git a/test/functional/legacy/020_blockwise_visual_spec.lua b/test/functional/legacy/020_blockwise_visual_spec.lua
new file mode 100644
index 0000000000..95574a0957
--- /dev/null
+++ b/test/functional/legacy/020_blockwise_visual_spec.lua
@@ -0,0 +1,49 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Tests Blockwise Visual when there are TABs before the text.
+-- First test for undo working properly when executing commands from a register.
+-- Also test this in an empty buffer.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('blockwise visual', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+123456
+234567
+345678
+
+test text test tex start here
+ some text
+ test text
+test text
+
+x jAy kdd
+Ox jAy kdd]])
+
+ feed(":let @a = 'Ox<C-v><Esc>jAy<C-v><Esc>kdd'<cr>")
+ feed('G0k@au')
+ execute('new')
+ feed('@auY')
+ execute('quit')
+ feed('GP')
+ execute('/start here')
+ feed('"by$<C-v>jjlld')
+ execute('/456')
+ feed('<C-v>jj"bP')
+ execute('$-3,$d')
+
+ expect([[
+123start here56
+234start here67
+345start here78
+
+test text test tex rt here
+ somext
+ tesext
+test text]])
+ end)
+end)
diff --git a/test/functional/legacy/021_control_wi_spec.lua b/test/functional/legacy/021_control_wi_spec.lua
new file mode 100644
index 0000000000..f1f529e9a8
--- /dev/null
+++ b/test/functional/legacy/021_control_wi_spec.lua
@@ -0,0 +1,41 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('CTRL-W CTRL-I', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ #include test21.in
+
+ /* test text test tex start here
+ some text
+ test text
+ start OK if found this line
+ start found wrong line
+ test text]])
+
+ -- Search for the second occurence of start and append to register
+ execute('/start')
+ feed('2[<C-i>')
+ execute('yank A')
+
+ -- Same as above but using different keystrokes.
+ feed('?start<cr>')
+ feed('2<C-w><Tab>')
+ execute('yank A')
+
+ -- Clean buffer and put register
+ feed('ggdG"ap')
+ execute('1,2d')
+
+ -- The buffer should now contain:
+ expect([[
+ start OK if found this line
+ start OK if found this line]])
+ end)
+end)
diff --git a/test/functional/legacy/022_line_ending_spec.lua b/test/functional/legacy/022_line_ending_spec.lua
new file mode 100644
index 0000000000..4b897a7c95
--- /dev/null
+++ b/test/functional/legacy/022_line_ending_spec.lua
@@ -0,0 +1,25 @@
+-- Tests for file with some lines ending in CTRL-M, some not
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('line ending', function()
+ setup(clear)
+
+ it('is working', function()
+ feed('i', [[
+ this lines ends in a<C-V><C-M>
+ this one doesn't
+ this one does<C-V><C-M>
+ and the last one doesn't]], '<ESC>')
+
+ execute('set ta tx')
+ execute('e!')
+
+ expect("this lines ends in a\r\n"..
+ "this one doesn't\n"..
+ "this one does\r\n"..
+ "and the last one doesn't")
+ end)
+end)
diff --git a/test/functional/legacy/023_edit_arguments_spec.lua b/test/functional/legacy/023_edit_arguments_spec.lua
new file mode 100644
index 0000000000..b5955c5987
--- /dev/null
+++ b/test/functional/legacy/023_edit_arguments_spec.lua
@@ -0,0 +1,52 @@
+-- Tests for complicated + argument to :edit command
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe(':edit', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
+ foo|bar
+ foo/bar]])
+
+ -- Prepare some test files
+ execute('$-1w! Xfile1')
+ execute('$w! Xfile2')
+ execute('w! Xfile0')
+
+ -- Open Xfile using '+' range
+ execute('edit +1 Xfile1')
+ execute('s/|/PIPE/')
+ execute('yank A')
+ execute('w! Xfile1')
+
+ -- Open Xfile2 using '|' range
+ execute('edit Xfile2|1')
+ execute("s/\\//SLASH/")
+ execute('yank A')
+ execute('w! Xfile2')
+
+ -- Clean first buffer and put @a
+ execute('bf')
+ execute('%d')
+ execute('0put a')
+
+ -- Remove empty lines
+ execute('1d | $d')
+
+ -- The buffer should now contain
+ expect([[
+ fooPIPEbar
+ fooSLASHbar]])
+ end)
+
+ teardown(function()
+ os.remove('Xfile0')
+ os.remove('Xfile1')
+ os.remove('Xfile2')
+ end)
+end)
diff --git a/test/functional/legacy/027_expand_file_names_spec.lua b/test/functional/legacy/027_expand_file_names_spec.lua
new file mode 100644
index 0000000000..bff61c1516
--- /dev/null
+++ b/test/functional/legacy/027_expand_file_names_spec.lua
@@ -0,0 +1,38 @@
+-- Test for expanding file names
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+local curbuf_contents = helpers.curbuf_contents
+local eq, eval = helpers.eq, helpers.eval
+
+describe('expand file name', function()
+ setup(clear)
+
+ it('is working', function()
+ execute('set nocp')
+ execute('!mkdir Xdir1')
+ execute('!mkdir Xdir2')
+ execute('!mkdir Xdir3')
+ execute('cd Xdir3')
+ execute('!mkdir Xdir4')
+ execute('cd ..')
+ execute('w Xdir1/file')
+ execute('w Xdir3/Xdir4/file')
+ execute('n Xdir?/*/file')
+
+ -- Yank current file path to @a register
+ feed('i<C-R>%<Esc>V"ad')
+
+ -- Put @a and current file path in the current buffer
+ execute('n! Xdir?/*/nofile')
+ feed('V"ap')
+ feed('o<C-R>%<Esc>')
+
+ eq("Xdir3/Xdir4/file\nXdir?/*/nofile", curbuf_contents())
+ end)
+
+ teardown(function()
+ os.execute('rm -rf Xdir1 Xdir2 Xdir3')
+ end)
+end)
diff --git a/test/functional/legacy/028_source_ctrl_v_spec.lua b/test/functional/legacy/028_source_ctrl_v_spec.lua
new file mode 100644
index 0000000000..fc36b436ef
--- /dev/null
+++ b/test/functional/legacy/028_source_ctrl_v_spec.lua
@@ -0,0 +1,40 @@
+-- Test for sourcing a file with CTRL-V's at the end of the line
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('CTRL-V at the end of the line', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ firstline
+ map __1 afirst
+ map __2 asecond
+ map __3 athird
+ map __4 afourth
+ map __5 afifth
+ map __1 asdX
+ map __2 asdXX
+ map __3 asdXX
+ map __4 asdXXX
+ map __5 asdXXX
+ lastline]])
+
+ feed(':%s/X/<C-v><C-v>/g<cr>')
+ feed(':/firstline/+1,/lastline/-1w! Xtestfile<cr>')
+ execute('so Xtestfile')
+ execute('%d')
+ feed('Gmm__1<Esc><Esc>__2<Esc>__3<Esc><Esc>__4<Esc>__5<Esc>')
+ feed(":'m,$s/<C-v><C-@>/0/g<cr>")
+
+ expect([[
+ sd
+ map __2 asdsecondsdsd0map __5 asd0fifth]])
+ end)
+
+ teardown(function()
+ os.remove('Xtestfile')
+ end)
+end)
diff --git a/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua
new file mode 100644
index 0000000000..ed1a914c0f
--- /dev/null
+++ b/test/functional/legacy/041_writing_and_reading_hundred_kbyte_spec.lua
@@ -0,0 +1,40 @@
+-- Test for writing and reading a file of over 100 Kbyte
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('writing and reading a file of over 100 Kbyte', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ This is the start
+ This is the leader
+ This is the middle
+ This is the trailer
+ This is the end]])
+
+ feed('kY3000p2GY3000p')
+
+ execute('w! test.out')
+ execute('%d')
+ execute('e! test.out')
+ execute('yank A')
+ execute('3003yank A')
+ execute('6005yank A')
+ execute('%d')
+ execute('0put a')
+ execute('1d | $d')
+ execute('w!')
+
+ expect([[
+ This is the start
+ This is the middle
+ This is the end]])
+ end)
+
+ teardown(function()
+ os.remove('test.out')
+ end)
+end)
diff --git a/test/functional/legacy/046_multi_line_regexps_spec.lua b/test/functional/legacy/046_multi_line_regexps_spec.lua
new file mode 100644
index 0000000000..f8a6143b18
--- /dev/null
+++ b/test/functional/legacy/046_multi_line_regexps_spec.lua
@@ -0,0 +1,52 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Tests for multi-line regexps with ":s"
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('multi-line regexp', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ 1 aa
+ bb
+ cc
+ 2 dd
+ ee
+ 3 ef
+ gh
+ 4 ij
+ 5 a8
+ 8b c9
+ 9d
+ 6 e7
+ 77f
+ xxxxx]])
+
+ -- Test if replacing a line break works with a back reference
+ feed([[:/^1/,/^2/s/\n\(.\)/ \1/<cr>]])
+
+ -- Test if inserting a line break works with a back reference
+ feed([[:/^3/,/^4/s/\(.\)$/\r\1/<cr>]])
+
+ -- Test if replacing a line break with another line break works
+ feed([[:/^5/,/^6/s/\(\_d\{3}\)/x\1x/<cr>]])
+
+ expect([[
+ 1 aa bb cc 2 dd ee
+ 3 e
+ f
+ g
+ h
+ 4 i
+ j
+ 5 ax8
+ 8xb cx9
+ 9xd
+ 6 ex7
+ 7x7f
+ xxxxx]])
+ end)
+end)
diff --git a/test/functional/legacy/054_buffer_local_autocommands_spec.lua b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
new file mode 100644
index 0000000000..bcedb26b7e
--- /dev/null
+++ b/test/functional/legacy/054_buffer_local_autocommands_spec.lua
@@ -0,0 +1,33 @@
+-- Some tests for buffer-local autocommands
+
+local helpers = require('test.functional.helpers')
+local clear, execute, eq = helpers.clear, helpers.execute, helpers.eq
+local curbuf_contents = helpers.curbuf_contents
+
+describe('BufLeave <buffer>', function()
+ setup(clear)
+
+ it('is working', function()
+ execute('w! xx')
+ execute('au BufLeave <buffer> norm Ibuffer-local autocommand')
+ execute('au BufLeave <buffer> update')
+
+ -- Here, autocommand for xx shall append a line
+ -- But autocommand shall not apply to buffer named <buffer>
+ execute('e somefile')
+
+ -- Here, autocommand shall be auto-deleted
+ execute('bwipe xx')
+
+ -- Nothing shall be written
+ execute('e xx')
+ execute('e somefile')
+ execute('e xx')
+
+ eq('buffer-local autocommand', curbuf_contents())
+ end)
+
+ teardown(function()
+ os.remove('xx')
+ end)
+end)
diff --git a/test/functional/legacy/056_script_local_function_spec.lua b/test/functional/legacy/056_script_local_function_spec.lua
new file mode 100644
index 0000000000..147391ceb1
--- /dev/null
+++ b/test/functional/legacy/056_script_local_function_spec.lua
@@ -0,0 +1,31 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Test for script-local function.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('source function', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ fun DoLast()
+ call append(line('$'), "last line")
+ endfun
+ fun DoNothing()
+ call append(line('$'), "nothing line")
+ endfun
+ nnoremap <buffer> _x :call DoNothing()<bar>call DoLast()<cr>]])
+
+ feed(':<C-R>=getline(1,3)<cr><cr>')
+ feed(':<C-R>=getline(4,6)<cr><cr>')
+ feed(':<C-R>=getline(7)<cr><cr>')
+ feed('ggdG')
+ feed('_xggdd')
+
+ expect([[
+ nothing line
+ last line]])
+ end)
+end)
diff --git a/test/functional/legacy/081_coptions_movement_spec.lua b/test/functional/legacy/081_coptions_movement_spec.lua
new file mode 100644
index 0000000000..f27667b976
--- /dev/null
+++ b/test/functional/legacy/081_coptions_movement_spec.lua
@@ -0,0 +1,39 @@
+-- Test for t movement command and 'cpo-;' setting
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('coptions', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ aaa two three four
+ zzz
+ yyy
+ bbb yee yoo four
+ ccc two three four
+ ddd yee yoo four]])
+
+ execute('set cpo-=;')
+
+ feed('gg0tt;D')
+ feed('j0fz;D')
+ feed('j$Fy;D')
+ feed('j$Ty;D')
+
+ execute('set cpo+=;')
+
+ feed('j0tt;;D')
+ feed('j$Ty;;D')
+
+ expect([[
+ aaa two
+ z
+ y
+ bbb y
+ ccc
+ ddd yee y]])
+ end)
+end)
diff --git a/test/functional/legacy/097_glob_path_spec.lua b/test/functional/legacy/097_glob_path_spec.lua
new file mode 100644
index 0000000000..84f26478ac
--- /dev/null
+++ b/test/functional/legacy/097_glob_path_spec.lua
@@ -0,0 +1,50 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Test whether glob()/globpath() return correct results with certain escaped
+-- characters.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('glob() and globpath()', function()
+ setup(clear)
+
+ setup(function()
+ os.execute("mkdir -p sautest/autoload")
+ os.execute("touch sautest/autoload/Test104.vim")
+ os.execute("touch sautest/autoload/footest.vim")
+ end)
+
+ it('is working', function()
+ -- Make sure glob() doesn't use the shell
+ execute('set shell=doesnotexist')
+
+ -- Consistent sorting of file names
+ execute('set nofileignorecase')
+
+ execute([[$put =glob('Xxx\{')]])
+ execute([[$put =glob('Xxx\$')]])
+
+ execute('w! Xxx{')
+ execute([[w! Xxx\$]])
+ execute([[$put =glob('Xxx\{')]])
+ execute([[$put =glob('Xxx\$')]])
+
+ execute("$put =string(globpath('sautest/autoload', '*.vim'))")
+ execute("$put =string(globpath('sautest/autoload', '*.vim', 0, 1))")
+
+ expect([=[
+
+
+
+ Xxx{
+ Xxx$
+ 'sautest/autoload/Test104.vim
+ sautest/autoload/footest.vim'
+ ['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim']]=])
+ end)
+
+ teardown(function()
+ os.execute("rm -rf sautest Xxx{ Xxx$")
+ end)
+end)
diff --git a/test/functional/legacy/102_fnameescape_spec.lua b/test/functional/legacy/102_fnameescape_spec.lua
new file mode 100644
index 0000000000..251ce68430
--- /dev/null
+++ b/test/functional/legacy/102_fnameescape_spec.lua
@@ -0,0 +1,26 @@
+-- Test if fnameescape is correct for special chars like!
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('fnameescape', function()
+ setup(clear)
+
+ it('is working', function()
+ execute('let fname = "Xspa ce"')
+ execute('try', 'exe "w! " . fnameescape(fname)', "put='Space'", 'endtry')
+ execute('let fname = "Xemark!"')
+ execute('try', 'exe "w! " . fnameescape(fname)', "put='ExclamationMark'", 'endtry')
+
+ expect([[
+
+ Space
+ ExclamationMark]])
+ end)
+
+ teardown(function()
+ os.remove("Xspa ce")
+ os.remove("Xemark!")
+ end)
+end)
diff --git a/test/functional/legacy/106_errorformat_spec.lua b/test/functional/legacy/106_errorformat_spec.lua
new file mode 100644
index 0000000000..5b6037f928
--- /dev/null
+++ b/test/functional/legacy/106_errorformat_spec.lua
@@ -0,0 +1,25 @@
+-- Tests for errorformat.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('errorformat', function()
+ setup(clear)
+
+ it('is working', function()
+ execute("set efm=%EEEE%m,%WWWW%m,%+CCCC%.%#,%-GGGG%.%#")
+ execute("cgetexpr ['WWWW', 'EEEE', 'CCCC']")
+ execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+ execute("cgetexpr ['WWWW', 'GGGG', 'EEEE', 'CCCC']")
+ execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+ execute("cgetexpr ['WWWW', 'GGGG', 'ZZZZ', 'EEEE', 'CCCC', 'YYYY']")
+ execute("$put =strtrans(string(map(getqflist(), '[v:val.text, v:val.valid]')))")
+
+ expect([=[
+
+ [['W', 1], ['E^@CCCC', 1]]
+ [['W', 1], ['E^@CCCC', 1]]
+ [['W', 1], ['ZZZZ', 0], ['E^@CCCC', 1], ['YYYY', 0]]]=])
+ end)
+end)
diff --git a/test/functional/legacy/autoformat_join_spec.lua b/test/functional/legacy/autoformat_join_spec.lua
new file mode 100644
index 0000000000..a99cabca24
--- /dev/null
+++ b/test/functional/legacy/autoformat_join_spec.lua
@@ -0,0 +1,41 @@
+-- vim: set foldmethod=marker foldmarker=[[,]] :
+-- Tests for setting the '[,'] marks when joining lines.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('autoformat join', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ O sodales, ludite, vos qui
+attamen consulite per voster honur. Tua pulchra facies me fay planszer milies
+
+This line.
+Should be joined with the next line
+and with this line
+
+Results:]])
+
+ feed('gg')
+ feed('0gqj<cr>')
+
+ execute([[let a=string(getpos("'[")).'/'.string(getpos("']"))]])
+ execute("g/^This line/;'}-join")
+ execute([[let b=string(getpos("'[")).'/'.string(getpos("']"))]])
+ execute("$put ='First test: Start/End '.string(a)")
+ execute("$put ='Second test: Start/End '.string(b)")
+
+ expect([[
+ O sodales, ludite, vos qui attamen consulite per voster honur.
+Tua pulchra facies me fay planszer milies
+
+This line. Should be joined with the next line and with this line
+
+Results:
+First test: Start/End '[0, 1, 1, 0]/[0, 2, 1, 0]'
+Second test: Start/End '[0, 4, 11, 0]/[0, 4, 67, 0]']])
+ end)
+end)
diff --git a/test/functional/legacy/changelist_spec.lua b/test/functional/legacy/changelist_spec.lua
new file mode 100644
index 0000000000..7c696369d4
--- /dev/null
+++ b/test/functional/legacy/changelist_spec.lua
@@ -0,0 +1,26 @@
+-- Test changelist position after splitting window
+-- Set 'undolevels' to make changelist for sourced file
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('changelist', function()
+ setup(clear)
+
+ it('is working', function()
+ insert("1\n2")
+
+ feed('Gkylp')
+ execute('set ul=100')
+
+ feed('Gylp')
+ execute('set ul=100')
+
+ feed('gg')
+ execute('vsplit')
+ execute('try', 'normal g;', 'normal ggVGcpass', 'catch', 'normal ggVGcfail', 'endtry')
+
+ expect('pass')
+ end)
+end)
diff --git a/test/functional/legacy/insertcount_spec.lua b/test/functional/legacy/insertcount_spec.lua
new file mode 100644
index 0000000000..01236e1afe
--- /dev/null
+++ b/test/functional/legacy/insertcount_spec.lua
@@ -0,0 +1,24 @@
+-- Tests for repeating insert and replace.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('insertcount', function()
+ setup(clear)
+
+ it('is working', function()
+ insert([[
+ First line
+ Second line
+ Last line]])
+
+ execute('/Second')
+ feed('4gro')
+
+ expect([[
+ First line
+ oooond line
+ Last line]])
+ end)
+end)
diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua
new file mode 100644
index 0000000000..fcc39434ff
--- /dev/null
+++ b/test/functional/legacy/options_spec.lua
@@ -0,0 +1,20 @@
+-- Test for ":options".
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('options', function()
+ setup(clear)
+
+ it('is working', function()
+ insert('result')
+
+ execute("let caught = 'ok'")
+ execute('try', 'options', 'catch', 'let caught = v:throwpoint . "\n" . v:exception', 'endtry')
+ execute('buf 1')
+ execute('$put =caught')
+
+ expect("result\nok")
+ end)
+end)
diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua
new file mode 100644
index 0000000000..d26f436057
--- /dev/null
+++ b/test/functional/legacy/utf8_spec.lua
@@ -0,0 +1,31 @@
+-- Tests for Unicode manipulations
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('utf8', function()
+ setup(clear)
+
+ it('is working', function()
+ insert('start:')
+
+ execute('set encoding=utf-8')
+ execute('new')
+ execute('call setline(1, ["aaa", "あああ", "bbb"])')
+
+ -- Visual block Insert adjusts for multi-byte char
+ feed('gg0l<C-V>jjIx<Esc>')
+
+ execute('let r = getline(1, "$")')
+ execute('bwipeout!')
+ execute('$put=r')
+ execute('call garbagecollect(1)')
+
+ expect([[
+ start:
+ axaa
+ xあああ
+ bxbb]])
+ end)
+end)