aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy')
-rw-r--r--test/functional/legacy/003_cindent_spec.lua17
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua45
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua8
-rw-r--r--test/functional/legacy/packadd_spec.lua25
-rw-r--r--test/functional/legacy/search_spec.lua21
5 files changed, 77 insertions, 39 deletions
diff --git a/test/functional/legacy/003_cindent_spec.lua b/test/functional/legacy/003_cindent_spec.lua
index 1cede8a7d7..061904c42f 100644
--- a/test/functional/legacy/003_cindent_spec.lua
+++ b/test/functional/legacy/003_cindent_spec.lua
@@ -4754,4 +4754,21 @@ describe('cindent', function()
4
/* end of define */]=])
end)
+
+ it('* immediately follows comment / vim-patch 8.0.1291', function()
+ insert_([=[
+ {
+ a = second/*bug*/*line;
+ }]=])
+
+ feed_command('set cin cino&')
+ feed_command('/a = second')
+ feed('ox')
+
+ expect([=[
+ {
+ a = second/*bug*/*line;
+ x
+ }]=])
+ end)
end)
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 453638ce45..939404cb5e 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -2,9 +2,9 @@
-- Test for BufUnload autocommand that unloads all other buffers.
local helpers = require('test.functional.helpers')(after_each)
-local feed, source = helpers.feed, helpers.source
-local clear, feed_command, expect, eq, eval = helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
-local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
+local source = helpers.source
+local clear, command, expect, eq, eval = helpers.clear, helpers.command, helpers.expect, helpers.eq, helpers.eval
+local write_file, dedent = helpers.write_file, helpers.dedent
local read_file = helpers.read_file
describe('autocommands that delete and unload buffers:', function()
@@ -26,29 +26,25 @@ describe('autocommands that delete and unload buffers:', function()
before_each(clear)
it('BufWritePre, BufUnload', function()
- feed_command('au BufWritePre Xxx1 bunload')
- feed_command('au BufWritePre Xxx2 bwipe')
- feed_command('e Xxx2')
+ command('au BufWritePre Xxx1 bunload')
+ command('au BufWritePre Xxx2 bwipe')
+ command('e Xxx2')
eq('Xxx2', eval('bufname("%")'))
- feed_command('e Xxx1')
+ command('e Xxx1')
eq('Xxx1', eval('bufname("%")'))
-- The legacy test file did not check the error message.
- feed_command('let v:errmsg = "no error"')
- feed_command('write')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
+ command('let v:errmsg = "no error"')
+ command('silent! write')
eq('E203: Autocommands deleted or unloaded buffer to be written',
eval('v:errmsg'))
eq('Xxx2', eval('bufname("%")'))
expect(text2)
-- Start editing Xxx2.
- feed_command('e! Xxx2')
+ command('e! Xxx2')
-- The legacy test file did not check the error message.
- feed_command('let v:errmsg = "no error"')
+ command('let v:errmsg = "no error"')
-- Write Xxx2, will delete the buffer and give an error msg.
- feed_command('w')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
+ command('silent! write')
eq('E203: Autocommands deleted or unloaded buffer to be written',
eval('v:errmsg'))
eq('Xxx1', eval('bufname("%")'))
@@ -75,18 +71,11 @@ describe('autocommands that delete and unload buffers:', function()
au BufUnload * call CloseAll()
au VimLeave * call WriteToOut()
]])
- feed_command('e Xxx2')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
- feed_command('e Xxx1')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
- feed_command('e Makefile') -- an existing file
- feed('<C-L>')
- feed_command('sp new2')
- feed('<C-L>')
- feed_command('q')
- wait()
+ command('silent! edit Xxx2')
+ command('silent! edit Xxx1')
+ command('silent! edit Makefile') -- an existing file
+ command('silent! split new2')
+ command('silent! quit')
eq('VimLeave done',
string.match(read_file(test_file), "^%s*(.-)%s*$"))
end)
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 379646b2ba..7cc31dc787 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -18,6 +18,7 @@ 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 iswin = helpers.iswin
+local read_file = helpers.read_file
local function has_gzip()
local null = iswin() and 'nul' or '/dev/null'
@@ -60,7 +61,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
os.remove('test.out')
end)
- if iswin() or not has_gzip() then
+ if not has_gzip() then
pending('skipped (missing `gzip` utility)', function() end)
else
@@ -77,7 +78,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
it('BufReadPre, BufReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
- local gzip_data = io.open('Xtestfile.gz'):read('*all')
+ local gzip_data = read_file('Xtestfile.gz')
feed_command('let $GZIP = ""')
-- Setup autocommands to decompress before reading and re-compress afterwards.
feed_command("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
@@ -91,7 +92,7 @@ describe('file reading, writing and bufnew and filter autocommands', function()
-- 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'))
+ eq(gzip_data, read_file('Xtestfile.gz'))
end)
-- luacheck: ignore 621 (Indentation)
@@ -142,7 +143,6 @@ describe('file reading, writing and bufnew and filter autocommands', function()
end)
it('FilterReadPre, FilterReadPost', function()
- if helpers.pending_win32(pending) then return end
-- Write a special input file for this test block.
write_file('test.out', dedent([[
startstart
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index fb308475c0..7c3d48317b 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -15,7 +15,7 @@ describe('packadd', function()
source([=[
func SetUp()
- let s:topdir = expand(expand('%:p:h') . '/Xdir')
+ let s:topdir = expand(getcwd() . '/Xdir')
exe 'set packpath=' . s:topdir
let s:plugdir = expand(s:topdir . '/pack/mine/opt/mytest')
endfunc
@@ -58,6 +58,24 @@ describe('packadd', function()
call assert_fails("packadd", 'E471:')
endfunc
+ func Test_packadd_start()
+ let plugdir = expand(s:topdir . '/pack/mine/start/other')
+ call mkdir(plugdir . '/plugin', 'p')
+ set rtp&
+ let rtp = &rtp
+ filetype on
+
+ exe 'split ' . plugdir . '/plugin/test.vim'
+ call setline(1, 'let g:plugin_works = 24')
+ wq
+
+ packadd other
+
+ call assert_equal(24, g:plugin_works)
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_true(&rtp =~ (escape(plugdir, '\') . '\($\|,\)'))
+ endfunc
+
func Test_packadd_noload()
call mkdir(s:plugdir . '/plugin', 'p')
call mkdir(s:plugdir . '/syntax', 'p')
@@ -286,6 +304,11 @@ describe('packadd', function()
expected_empty()
end)
+ it('loads packages from "start" directory', function()
+ call('Test_packadd_start')
+ expected_empty()
+ end)
+
describe('command line completion', function()
local Screen = require('test.functional.ui.screen')
local screen
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 277d8d6c7f..3ed06a22e7 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -92,6 +92,7 @@ describe('search cmdline', function()
9 {inc:the}se |
/the^ |
]])
+ screen.bell = false
feed('<C-G>')
if wrapscan == 'wrapscan' then
screen:expect([[
@@ -100,11 +101,13 @@ describe('search cmdline', function()
/the^ |
]])
else
- screen:expect([[
+ screen:expect{grid=[[
8 them |
9 {inc:the}se |
/the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
feed('<CR>')
eq({0, 0, 0, 0}, funcs.getpos('"'))
end
@@ -120,6 +123,7 @@ describe('search cmdline', function()
10 foobar |
?the^ |
]])
+ screen.bell = false
if wrapscan == 'wrapscan' then
feed('<C-G>')
screen:expect([[
@@ -135,11 +139,13 @@ describe('search cmdline', function()
]])
else
feed('<C-G>')
- screen:expect([[
+ screen:expect{grid=[[
9 {inc:the}se |
10 foobar |
?the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
feed('<CR>')
screen:expect([[
9 ^these |
@@ -173,6 +179,7 @@ describe('search cmdline', function()
3 the |
?the^ |
]])
+ screen.bell = false
feed('<C-T>')
if wrapscan == 'wrapscan' then
screen:expect([[
@@ -181,11 +188,13 @@ describe('search cmdline', function()
?the^ |
]])
else
- screen:expect([[
+ screen:expect{grid=[[
2 {inc:the}se |
3 the |
?the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
end
end