aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/keymap_spec.lua45
-rw-r--r--test/functional/plugin/lsp_spec.lua10
-rw-r--r--test/functional/ui/float_spec.lua63
-rw-r--r--test/functional/ui/screen_basic_spec.lua121
-rw-r--r--test/functional/ui/title_spec.lua138
-rw-r--r--test/old/testdir/test_exit.vim12
-rw-r--r--test/old/testdir/test_filetype.vim33
7 files changed, 275 insertions, 147 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index f2817ff627..e239717d3a 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -813,19 +813,18 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('can make lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
feed('asdf\n')
eq(1, exec_lua[[return GlobalCount]])
-
end)
it (':map command shows lua mapping correctly', function()
exec_lua [[
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() print('jkl;') end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() print('jkl;') end })
]]
assert.truthy(
string.match(
@@ -837,7 +836,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it ('mapcheck() returns lua mapping correctly', function()
exec_lua [[
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() print('jkl;') end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() print('jkl;') end })
]]
assert.truthy(string.match(funcs.mapcheck('asdf', 'n'),
"^<Lua %d+>"))
@@ -871,7 +870,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('can make lua expr mappings replacing keycodes', function()
exec_lua [[
- vim.api.nvim_set_keymap ('n', 'aa', '', {callback = function() return '<Insert>π<C-V><M-π>foo<lt><Esc>' end, expr = true, replace_keycodes = true })
+ vim.api.nvim_set_keymap('n', 'aa', '', {callback = function() return '<Insert>π<C-V><M-π>foo<lt><Esc>' end, expr = true, replace_keycodes = true })
]]
feed('aa')
@@ -881,7 +880,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('can make lua expr mappings without replacing keycodes', function()
exec_lua [[
- vim.api.nvim_set_keymap ('i', 'aa', '', {callback = function() return '<space>' end, expr = true })
+ vim.api.nvim_set_keymap('i', 'aa', '', {callback = function() return '<space>' end, expr = true })
]]
feed('iaa<esc>')
@@ -891,7 +890,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('lua expr mapping returning nil is equivalent to returning an empty string', function()
exec_lua [[
- vim.api.nvim_set_keymap ('i', 'aa', '', {callback = function() return nil end, expr = true })
+ vim.api.nvim_set_keymap('i', 'aa', '', {callback = function() return nil end, expr = true })
]]
feed('iaa<esc>')
@@ -902,17 +901,29 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('does not reset pum in lua mapping', function()
eq(0, exec_lua [[
VisibleCount = 0
- vim.api.nvim_set_keymap ('i', '<F2>', '', {callback = function() VisibleCount = VisibleCount + vim.fn.pumvisible() end})
+ vim.api.nvim_set_keymap('i', '<F2>', '', {callback = function() VisibleCount = VisibleCount + vim.fn.pumvisible() end})
return VisibleCount
]])
feed('i<C-X><C-V><F2><F2><esc>')
eq(2, exec_lua[[return VisibleCount]])
end)
+ it('redo of lua mappings in op-pending mode work', function()
+ eq(0, exec_lua [[
+ OpCount = 0
+ vim.api.nvim_set_keymap('o', '<F2>', '', {callback = function() OpCount = OpCount + 1 end})
+ return OpCount
+ ]])
+ feed('d<F2>')
+ eq(1, exec_lua[[return OpCount]])
+ feed('.')
+ eq(2, exec_lua[[return OpCount]])
+ end)
+
it('can overwrite lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
@@ -921,7 +932,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
eq(1, exec_lua[[return GlobalCount]])
exec_lua [[
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount - 1 end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount - 1 end })
]]
feed('asdf\n')
@@ -932,7 +943,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
it('can unmap lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_set_keymap ('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_set_keymap('n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
@@ -1078,7 +1089,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('can make lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_buf_set_keymap (0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_buf_set_keymap(0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
@@ -1089,7 +1100,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('can make lua expr mappings replacing keycodes', function()
exec_lua [[
- vim.api.nvim_buf_set_keymap (0, 'n', 'aa', '', {callback = function() return '<Insert>π<C-V><M-π>foo<lt><Esc>' end, expr = true, replace_keycodes = true })
+ vim.api.nvim_buf_set_keymap(0, 'n', 'aa', '', {callback = function() return '<Insert>π<C-V><M-π>foo<lt><Esc>' end, expr = true, replace_keycodes = true })
]]
feed('aa')
@@ -1099,7 +1110,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('can make lua expr mappings without replacing keycodes', function()
exec_lua [[
- vim.api.nvim_buf_set_keymap (0, 'i', 'aa', '', {callback = function() return '<space>' end, expr = true })
+ vim.api.nvim_buf_set_keymap(0, 'i', 'aa', '', {callback = function() return '<space>' end, expr = true })
]]
feed('iaa<esc>')
@@ -1111,7 +1122,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('can overwrite lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_buf_set_keymap (0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_buf_set_keymap(0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
@@ -1120,7 +1131,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
eq(1, exec_lua[[return GlobalCount]])
exec_lua [[
- vim.api.nvim_buf_set_keymap (0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount - 1 end })
+ vim.api.nvim_buf_set_keymap(0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount - 1 end })
]]
feed('asdf\n')
@@ -1131,7 +1142,7 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
it('can unmap lua mappings', function()
eq(0, exec_lua [[
GlobalCount = 0
- vim.api.nvim_buf_set_keymap (0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
+ vim.api.nvim_buf_set_keymap(0, 'n', 'asdf', '', {callback = function() GlobalCount = GlobalCount + 1 end })
return GlobalCount
]])
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 5ba0706208..fc7b2dafb8 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -3855,7 +3855,7 @@ describe('LSP', function()
end)
it('correctly registers and unregisters', function()
- local root_dir = 'some_dir'
+ local root_dir = '/some_dir'
exec_lua(create_server_definition)
local result = exec_lua([[
local root_dir = ...
@@ -4009,10 +4009,9 @@ describe('LSP', function()
local watchers = {}
local max_kind = protocol.WatchKind.Create + protocol.WatchKind.Change + protocol.WatchKind.Delete
for i = 0, max_kind do
- local j = i
table.insert(watchers, {
globPattern = {
- baseUri = vim.uri_from_fname('/dir'..tostring(i)),
+ baseUri = vim.uri_from_fname('/dir'),
pattern = 'watch'..tostring(i),
},
kind = i,
@@ -4031,7 +4030,7 @@ describe('LSP', function()
}, { client_id = client_id })
for i = 0, max_kind do
- local filename = 'watch'..tostring(i)
+ local filename = '/dir/watch' .. tostring(i)
send_event(filename, vim._watch.FileChangeType.Created)
send_event(filename, vim._watch.FileChangeType.Changed)
send_event(filename, vim._watch.FileChangeType.Deleted)
@@ -4045,7 +4044,8 @@ describe('LSP', function()
local function watched_uri(fname)
return exec_lua([[
- return vim.uri_from_fname(...)
+ local fname = ...
+ return vim.uri_from_fname('/dir/' .. fname)
]], fname)
end
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 28c16642f1..46a079d9ff 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -8079,10 +8079,13 @@ describe('float window', function()
[6] = {foreground = tonumber('0x332533'), background = tonumber('0xfff1ff')},
[7] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0x0000d8')},
[8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1},
- [9] = {background = Screen.colors.LightMagenta, blend=30},
- [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=0},
- [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=80},
- [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend=30},
+ [9] = {background = Screen.colors.LightMagenta, blend = 30},
+ [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 0},
+ [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend = 80},
+ [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend = 30},
+ [13] = {background = Screen.colors.LightGray, blend = 30},
+ [14] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey88},
+ [15] = {foreground = tonumber('0x939393'), background = Screen.colors.Grey88},
})
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -8184,6 +8187,58 @@ describe('float window', function()
]])
end
+ -- Check that 'winblend' works with NormalNC highlight
+ meths.set_option_value('winhighlight', 'NormalNC:Visual', {win = win})
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [3:--------------------------------------------------]|
+ ## grid 2
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ ## grid 3
+ |
+ ## grid 5
+ {13:test }|
+ {13: }|
+ {13:popup text }|
+ ]], float_pos={
+ [5] = {{id = 1002}, "NW", 1, 2, 5, true, 50};
+ }}
+ else
+ screen:expect([[
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea co{14:test}{15:o consequat}. Duis aute irure dolor in |
+ repre{15:henderit in vol}uptate velit esse cillum |
+ dolor{14:popup}{15:fugi}{14:text}{15:ul}la pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ |
+ ]])
+ end
+
+ -- Also test with global NormalNC highlight
+ meths.set_option_value('winhighlight', '', {win = win})
+ command('hi link NormalNC Visual')
+ screen:expect_unchanged(true)
+ command('hi clear NormalNC')
+
command('hi SpecialRegion guifg=Red blend=0')
meths.buf_add_highlight(buf, -1, "SpecialRegion", 2, 0, -1)
if multigrid then
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 6b05bd01c2..e1ae76badf 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -2,12 +2,10 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local spawn, set_session, clear = helpers.spawn, helpers.set_session, helpers.clear
local feed, command = helpers.feed, helpers.command
-local curwin = helpers.curwin
local insert = helpers.insert
local eq = helpers.eq
local eval = helpers.eval
-local funcs, meths, exec_lua = helpers.funcs, helpers.meths, helpers.exec_lua
-local is_os = helpers.is_os
+local funcs, meths = helpers.funcs, helpers.meths
describe('screen', function()
local screen
@@ -120,123 +118,6 @@ local function screen_tests(linegrid)
eq(expected, screen.title)
end)
end)
-
- it('has correct default title with unnamed file', function()
- local expected = '[No Name] - NVIM'
- command('set title')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('has correct default title with named file', function()
- local expected = (is_os('win') and 'myfile (C:\\mydir) - NVIM' or 'myfile (/mydir) - NVIM')
- command('set title')
- command(is_os('win') and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- describe('is not changed by', function()
- local file1 = is_os('win') and 'C:\\mydir\\myfile1' or '/mydir/myfile1'
- local file2 = is_os('win') and 'C:\\mydir\\myfile2' or '/mydir/myfile2'
- local expected = (is_os('win') and 'myfile1 (C:\\mydir) - NVIM' or 'myfile1 (/mydir) - NVIM')
- local buf2
-
- before_each(function()
- command('edit '..file1)
- buf2 = funcs.bufadd(file2)
- command('set title')
- end)
-
- it('calling setbufvar() to set an option in a hidden buffer from i_CTRL-R', function()
- command([[inoremap <F2> <C-R>=setbufvar(]]..buf2..[[, '&autoindent', 1) ? '' : ''<CR>]])
- feed('i<F2><Esc>')
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('an RPC call to nvim_buf_set_option in a hidden buffer', function()
- meths.buf_set_option(buf2, 'autoindent', true)
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('a Lua callback calling nvim_buf_set_option in a hidden buffer', function()
- exec_lua(string.format([[
- vim.schedule(function()
- vim.api.nvim_buf_set_option(%d, 'autoindent', true)
- end)
- ]], buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('a Lua callback calling nvim_buf_call in a hidden buffer', function()
- exec_lua(string.format([[
- vim.schedule(function()
- vim.api.nvim_buf_call(%d, function() end)
- end)
- ]], buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('setting the buffer of another window using RPC', function()
- local oldwin = curwin().id
- command('split')
- meths.win_set_buf(oldwin, buf2)
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('setting the buffer of another window using Lua callback', function()
- local oldwin = curwin().id
- command('split')
- exec_lua(string.format([[
- vim.schedule(function()
- vim.api.nvim_win_set_buf(%d, %d)
- end)
- ]], oldwin, buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('creating a floating window using RPC', function()
- meths.open_win(buf2, false, {
- relative = 'editor', width = 5, height = 5, row = 0, col = 0,
- })
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
-
- it('creating a floating window using Lua callback', function()
- exec_lua(string.format([[
- vim.api.nvim_open_win(%d, false, {
- relative = 'editor', width = 5, height = 5, row = 0, col = 0,
- })
- ]], buf2))
- command('redraw!')
- screen:expect(function()
- eq(expected, screen.title)
- end)
- end)
- end)
end)
describe(':set icon', function()
diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua
new file mode 100644
index 0000000000..75ead49f74
--- /dev/null
+++ b/test/functional/ui/title_spec.lua
@@ -0,0 +1,138 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local command = helpers.command
+local curwin = helpers.curwin
+local eq = helpers.eq
+local exec_lua = helpers.exec_lua
+local feed = helpers.feed
+local funcs = helpers.funcs
+local meths = helpers.meths
+local is_os = helpers.is_os
+
+describe('title', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new()
+ screen:attach()
+ end)
+
+ it('has correct default title with unnamed file', function()
+ local expected = '[No Name] - NVIM'
+ command('set title')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('has correct default title with named file', function()
+ local expected = (is_os('win') and 'myfile (C:\\mydir) - NVIM' or 'myfile (/mydir) - NVIM')
+ command('set title')
+ command(is_os('win') and 'file C:\\mydir\\myfile' or 'file /mydir/myfile')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ describe('is not changed by', function()
+ local file1 = is_os('win') and 'C:\\mydir\\myfile1' or '/mydir/myfile1'
+ local file2 = is_os('win') and 'C:\\mydir\\myfile2' or '/mydir/myfile2'
+ local expected = (is_os('win') and 'myfile1 (C:\\mydir) - NVIM' or 'myfile1 (/mydir) - NVIM')
+ local buf2
+
+ before_each(function()
+ command('edit '..file1)
+ buf2 = funcs.bufadd(file2)
+ command('set title')
+ end)
+
+ it('calling setbufvar() to set an option in a hidden buffer from i_CTRL-R', function()
+ command([[inoremap <F2> <C-R>=setbufvar(]]..buf2..[[, '&autoindent', 1) ? '' : ''<CR>]])
+ feed('i<F2><Esc>')
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('an RPC call to nvim_buf_set_option in a hidden buffer', function()
+ meths.buf_set_option(buf2, 'autoindent', true)
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('a Lua callback calling nvim_buf_set_option in a hidden buffer', function()
+ exec_lua(string.format([[
+ vim.schedule(function()
+ vim.api.nvim_buf_set_option(%d, 'autoindent', true)
+ end)
+ ]], buf2))
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('a Lua callback calling nvim_buf_call in a hidden buffer', function()
+ exec_lua(string.format([[
+ vim.schedule(function()
+ vim.api.nvim_buf_call(%d, function() end)
+ end)
+ ]], buf2))
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('setting the buffer of another window using RPC', function()
+ local oldwin = curwin().id
+ command('split')
+ meths.win_set_buf(oldwin, buf2)
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('setting the buffer of another window using Lua callback', function()
+ local oldwin = curwin().id
+ command('split')
+ exec_lua(string.format([[
+ vim.schedule(function()
+ vim.api.nvim_win_set_buf(%d, %d)
+ end)
+ ]], oldwin, buf2))
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('creating a floating window using RPC', function()
+ meths.open_win(buf2, false, {
+ relative = 'editor', width = 5, height = 5, row = 0, col = 0,
+ })
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+
+ it('creating a floating window using Lua callback', function()
+ exec_lua(string.format([[
+ vim.api.nvim_open_win(%d, false, {
+ relative = 'editor', width = 5, height = 5, row = 0, col = 0,
+ })
+ ]], buf2))
+ command('redraw!')
+ screen:expect(function()
+ eq(expected, screen.title)
+ end)
+ end)
+ end)
+end)
diff --git a/test/old/testdir/test_exit.vim b/test/old/testdir/test_exit.vim
index 6dbfb7047c..93e55ce575 100644
--- a/test/old/testdir/test_exit.vim
+++ b/test/old/testdir/test_exit.vim
@@ -81,6 +81,18 @@ func Test_exiting()
\ readfile('Xtestout'))
endif
call delete('Xtestout')
+
+ " ExitPre autocommand also executed on :wqall
+ let after =<< trim [CODE]
+ au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
+ au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
+ wqall
+ [CODE]
+
+ if RunVim([], after, '')
+ call assert_equal(['QuitPre', 'ExitPre'], readfile('Xtestout'))
+ endif
+ call delete('Xtestout')
endfunc
" Test for getting the Vim exit code from v:exiting
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index 2d7a24090f..177a8247ac 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -564,7 +564,7 @@ let s:filename_checks = {
\ 'spice': ['file.sp', 'file.spice'],
\ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
\ 'spyce': ['file.spy', 'file.spi'],
- \ 'sql': ['file.tyb', 'file.typ', 'file.tyc', 'file.pkb', 'file.pks'],
+ \ 'sql': ['file.tyb', 'file.tyc', 'file.pkb', 'file.pks'],
\ 'sqlj': ['file.sqlj'],
\ 'prql': ['file.prql'],
\ 'sqr': ['file.sqr', 'file.sqi'],
@@ -2047,4 +2047,35 @@ func Test_lsl_file()
filetype off
endfunc
+func Test_typ_file()
+ filetype on
+
+ " SQL type file
+
+ call writefile(['CASE = LOWER'], 'Xfile.typ', 'D')
+ split Xfile.typ
+ call assert_equal('sql', &filetype)
+ bwipe!
+
+ call writefile(['TYPE foo'], 'Xfile.typ')
+ split Xfile.typ
+ call assert_equal('sql', &filetype)
+ bwipe!
+
+ " typst document
+
+ call writefile(['this is a fallback'], 'Xfile.typ')
+ split Xfile.typ
+ call assert_equal('typst', &filetype)
+ bwipe!
+
+ let g:filetype_typ = 'typst'
+ split test.typ
+ call assert_equal('typst', &filetype)
+ bwipe!
+ unlet g:filetype_typ
+
+ filetype off
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab