Merge pull request #6600 from jamessan/post-sourcing-filetype

Test handling of "filetype ... off"/"syntax off" after startup scripts
This commit is contained in:
James McCoy 2017-04-27 11:10:57 -04:00 committed by GitHub
commit ce245c2c61

View File

@ -23,7 +23,7 @@ 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([[
@ -63,6 +63,24 @@ describe('startup defaults', function()
expect_filetype( expect_filetype(
'filetype detection:ON plugin:OFF indent:ON |') 'filetype detection:ON plugin:OFF indent:ON |')
end) 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)
describe('syntax', function() describe('syntax', function()
@ -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()