Files
vim-lsp-mirror/test/lsp/utils/buffer.vimspec
2020-12-23 11:48:46 -08:00

102 lines
3.3 KiB
VimL

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
Describe lsp#utils#buffer#get_indent_size
It gets shiftwidth if set
setl shiftwidth=4
setl tabstop=8
Assert Equals(lsp#utils#buffer#get_indent_size(bufnr('$')), 4)
End
It gets tabstop if shiftwidth not set
setl shiftwidth=0
setl tabstop=12
Assert Equals(lsp#utils#buffer#get_indent_size(bufnr('$')), 12)
End
End
End