Files
vim-lsp-mirror/test/lsp/utils/buffer.vimspec
Bryan Forbes e40175d972 If the user has "fixendofline" set, append a blank line to preserve the EOF newline (#302)
* If the user has "fixendofline" set, append a blank line to preserve the EOF newline
* Break utility function out into its own file and add tests
* Improve EOL detection based on docs and improve tests
2019-02-15 21:05:46 -08:00

89 lines
2.9 KiB
Plaintext

Describe lsp#utils#buffer
Before each
% delete _
0put ='foo'
1put ='bar'
3delete _
End
After all
% delete _
End
Describe lsp#utils#buffer#_get_lines
It adds a blank line when nobinary and fixendofline are set
if !exists('+fixendofline')
Skip This test requires 'fixendofline'
endif
setl nobinary
setl fixendofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar', ''])
End
It adds a blank line when nobinary, nofixendofline, and endofline are set
if !exists('+fixendofline')
Skip This test requires 'fixendofline'
endif
setl nobinary
setl nofixendofline
setl endofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar', ''])
End
It adds a blank line when binary and endofline are set
if !exists('+fixendofline')
Skip This test requires 'fixendofline'
endif
setl binary
setl endofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar', ''])
End
It does not add a blank line when nobinary, nofixendofline, and noendofline are set
if !exists('+fixendofline')
Skip This test requires 'fixendofline'
endif
setl nobinary
setl nofixendofline
setl noendofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar'])
End
It does not add a blank line when binary and noendofline are set
if !exists('+fixendofline')
Skip This test requires 'fixendofline'
endif
setl binary
setl noendofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar'])
End
It adds a blank line when nobinary is set
if exists('+fixendofline')
Skip This test is not for 'fixendofline'
endif
setl nobinary
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar', ''])
End
It adds a blank line when binary and endofline are set
if exists('+fixendofline')
Skip This test is not for 'fixendofline'
endif
setl binary
setl endofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar', ''])
End
It does not add a blank line when binary and noendofline are set
if exists('+fixendofline')
Skip This test is not for 'fixendofline'
endif
setl binary
setl noendofline
Assert Equals(lsp#utils#buffer#_get_lines(bufnr('$')), ['foo', 'bar'])
End
End
End