mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #6600 from jamessan/post-sourcing-filetype
Test handling of "filetype ... off"/"syntax off" after startup scripts
This commit is contained in:
commit
ce245c2c61
@ -23,13 +23,13 @@ describe('startup defaults', function()
|
|||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
|
|
||||||
local function expect_filetype(expected)
|
local function expect_filetype(expected)
|
||||||
local screen = Screen.new(48, 4)
|
local screen = Screen.new(50, 4)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
command('filetype')
|
command('filetype')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
]]..expected
|
]]..expected
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -37,31 +37,49 @@ describe('startup defaults', function()
|
|||||||
it('enabled by `-u NORC`', function()
|
it('enabled by `-u NORC`', function()
|
||||||
init_session('-u', 'NORC')
|
init_session('-u', 'NORC')
|
||||||
expect_filetype(
|
expect_filetype(
|
||||||
'filetype detection:ON plugin:ON indent:ON |')
|
'filetype detection:ON plugin:ON indent:ON |')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('disabled by `-u NONE`', function()
|
it('disabled by `-u NONE`', function()
|
||||||
init_session('-u', 'NONE')
|
init_session('-u', 'NONE')
|
||||||
expect_filetype(
|
expect_filetype(
|
||||||
'filetype detection:OFF plugin:OFF indent:OFF |')
|
'filetype detection:OFF plugin:OFF indent:OFF |')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('overridden by early `filetype on`', function()
|
it('overridden by early `filetype on`', function()
|
||||||
init_session('-u', 'NORC', '--cmd', 'filetype on')
|
init_session('-u', 'NORC', '--cmd', 'filetype on')
|
||||||
expect_filetype(
|
expect_filetype(
|
||||||
'filetype detection:ON plugin:OFF indent:OFF |')
|
'filetype detection:ON plugin:OFF indent:OFF |')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('overridden by early `filetype plugin on`', function()
|
it('overridden by early `filetype plugin on`', function()
|
||||||
init_session('-u', 'NORC', '--cmd', 'filetype plugin on')
|
init_session('-u', 'NORC', '--cmd', 'filetype plugin on')
|
||||||
expect_filetype(
|
expect_filetype(
|
||||||
'filetype detection:ON plugin:ON indent:OFF |')
|
'filetype detection:ON plugin:ON indent:OFF |')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('overridden by early `filetype indent on`', function()
|
it('overridden by early `filetype indent on`', function()
|
||||||
init_session('-u', 'NORC', '--cmd', 'filetype indent on')
|
init_session('-u', 'NORC', '--cmd', 'filetype indent on')
|
||||||
expect_filetype(
|
expect_filetype(
|
||||||
'filetype detection:ON plugin:OFF indent:ON |')
|
'filetype detection:ON plugin:OFF indent:ON |')
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('adjusted by late `filetype off`', function()
|
||||||
|
init_session('-u', 'NORC', '-c', 'filetype off')
|
||||||
|
expect_filetype(
|
||||||
|
'filetype detection:OFF plugin:(on) indent:(on) |')
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('adjusted by late `filetype plugin off`', function()
|
||||||
|
init_session('-u', 'NORC', '-c', 'filetype plugin off')
|
||||||
|
expect_filetype(
|
||||||
|
'filetype detection:ON plugin:OFF indent:ON |')
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('adjusted by late `filetype indent off`', function()
|
||||||
|
init_session('-u', 'NORC', '-c', 'filetype indent off')
|
||||||
|
expect_filetype(
|
||||||
|
'filetype detection:ON plugin:ON indent:OFF |')
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -80,6 +98,11 @@ describe('startup defaults', function()
|
|||||||
init_session('-u', 'NORC', '--cmd', 'syntax off')
|
init_session('-u', 'NORC', '--cmd', 'syntax off')
|
||||||
eq(0, eval('exists("g:syntax_on")'))
|
eq(0, eval('exists("g:syntax_on")'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('adjusted by late `syntax off`', function()
|
||||||
|
init_session('-u', 'NORC', '-c', 'syntax off')
|
||||||
|
eq(0, eval('exists("g:syntax_on")'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('packpath', function()
|
describe('packpath', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user