]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/handler/test_gitlint_handler.vader

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 '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_gitlint_handler.vader
diff --git a/.vim/bundle/ale/test/handler/test_gitlint_handler.vader b/.vim/bundle/ale/test/handler/test_gitlint_handler.vader
new file mode 100644 (file)
index 0000000..5c53166
--- /dev/null
@@ -0,0 +1,89 @@
+Before:
+  Save g:ale_warn_about_trailing_whitespace
+
+  let g:ale_warn_about_trailing_whitespace = 1
+
+  runtime ale_linters/gitcommit/gitlint.vim
+
+After:
+  Restore
+
+  unlet! b:ale_warn_about_trailing_whitespace
+
+  call ale#linter#Reset()
+
+Execute(The gitlint handler should handle basic warnings and syntax errors):
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 1,
+  \     'type': 'E',
+  \     'text': 'Body message is missing',
+  \     'code': 'B6',
+  \   },
+  \   {
+  \     'lnum': 2,
+  \     'type': 'E',
+  \     'text': 'Second line is not empty: "to send to upstream"',
+  \     'code': 'B4',
+  \   },
+  \   {
+  \     'lnum': 3,
+  \     'type': 'E',
+  \     'text': 'Body message is too short (19<20): "to send to upstream"',
+  \     'code': 'B5',
+  \   },
+  \   {
+  \     'lnum': 8,
+  \     'type': 'E',
+  \     'text': 'Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"',
+  \     'code': 'T1',
+  \   },
+  \ ],
+  \ ale_linters#gitcommit#gitlint#Handle(1, [
+  \   '1: B6 Body message is missing',
+  \   '2: B4 Second line is not empty: "to send to upstream"',
+  \   '3: B5 Body message is too short (19<20): "to send to upstream"',
+  \   '8: T1 Title exceeds max length (92>72): "some very long commit subject line where the author can''t wait to explain what he just fixed"'
+  \ ])
+
+Execute(Disabling trailing whitespace warnings should work):
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 8,
+  \     'type': 'E',
+  \     'text': 'Trailing whitespace',
+  \     'code': 'T2',
+  \   },
+  \ ],
+  \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+  \   '8: T2 Trailing whitespace',
+  \])
+
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 8,
+  \     'type': 'E',
+  \     'text': 'Trailing whitespace',
+  \     'code': 'B2',
+  \   },
+  \ ],
+  \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+  \   '8: B2 Trailing whitespace',
+  \])
+
+  let b:ale_warn_about_trailing_whitespace = 0
+
+  AssertEqual
+  \ [],
+  \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+  \   '8: T2 Trailing whitespace',
+  \ ])
+
+  AssertEqual
+  \ [],
+  \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+  \   '8: B2 Trailing whitespace',
+  \ ])