]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/vim-lsp/test/lsp/utils/buffer.vimspec

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit 'a39f715c13be3352193ffd9c5b7536b8786eff64' as '.vim/bundle/vim-lsp'
[etc/vim.git] / .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 (file)
index 0000000..b6986fa
--- /dev/null
@@ -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