X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5a4872f466ebd76ddd532bdf2798554421c53df4..fe3919e725e156d751069662d11e38f7b4791de1:/.vim/bundle/vim-lsp/test/lsp/utils/buffer.vimspec diff --git a/.vim/bundle/vim-lsp/test/lsp/utils/buffer.vimspec b/.vim/bundle/vim-lsp/test/lsp/utils/buffer.vimspec new file mode 100644 index 00000000..b6986fa1 --- /dev/null +++ b/.vim/bundle/vim-lsp/test/lsp/utils/buffer.vimspec @@ -0,0 +1,101 @@ +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