]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/handler/test_vulture_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_vulture_handler.vader
diff --git a/.vim/bundle/ale/test/handler/test_vulture_handler.vader b/.vim/bundle/ale/test/handler/test_vulture_handler.vader
new file mode 100644 (file)
index 0000000..0756c3b
--- /dev/null
@@ -0,0 +1,90 @@
+Before:
+  runtime ale_linters/python/vulture.vim
+
+  call ale#test#SetDirectory('/testplugin/test/handler')
+
+After:
+  Restore
+
+  call ale#test#RestoreDirectory()
+  call ale#linter#Reset()
+
+Execute(Basic vulture check with relative path in result should be handled):
+  call ale#test#SetFilename('something_else.py')
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 34,
+  \     'text': 'unused variable ''foo'' (60% confidence)',
+  \     'type': 'W',
+  \     'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+  \   },
+  \ ],
+  \ ale_linters#python#vulture#Handle(bufnr(''), [
+  \   './something_else.py:34: unused variable ''foo'' (60% confidence)',
+  \ ])
+
+Execute(Basic vulture check with absolute path in result should be handled):
+  call ale#test#SetFilename('something_else.py')
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 34,
+  \     'text': 'unused variable ''foo'' (60% confidence)',
+  \     'type': 'W',
+  \     'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+  \   },
+  \ ],
+  \ ale_linters#python#vulture#Handle(bufnr(''), [
+  \   ale#path#Simplify(g:dir . '/something_else.py') . ':34: unused variable ''foo'' (60% confidence)',
+  \ ])
+
+Execute(Vulture check for two files should be handled):
+  call ale#test#SetFilename('something_else.py')
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 34,
+  \     'text': 'unused variable ''foo'' (60% confidence)',
+  \     'type': 'W',
+  \     'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+  \   },
+  \   {
+  \     'lnum': 12,
+  \     'text': 'unused variable ''bar'' (60% confidence)',
+  \     'type': 'W',
+  \     'filename': ale#path#Simplify(g:dir . '/second_one.py'),
+  \   },
+  \ ],
+  \ ale_linters#python#vulture#Handle(bufnr(''), [
+  \   './something_else.py:34: unused variable ''foo'' (60% confidence)',
+  \   './second_one.py:12: unused variable ''bar'' (60% confidence)',
+  \ ])
+
+
+Execute(Vulture exception should be handled):
+  call ale#test#SetFilename('something_else.py')
+  AssertEqual
+  \ [
+  \   {
+  \     'lnum': 1,
+  \     'text': 'BaddestException: Everything gone wrong (See :ALEDetail)',
+  \     'detail': join([
+  \       'Traceback (most recent call last):',
+  \       '  File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
+  \       '    from .core import stuff',
+  \       'BaddestException: Everything gone wrong',
+  \     ], "\n"),
+  \   }
+  \ ],
+  \ ale_linters#python#vulture#Handle(bufnr(''), [
+  \   'Traceback (most recent call last):',
+  \   '  File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
+  \   '    from .core import stuff',
+  \   'BaddestException: Everything gone wrong',
+  \ ])
+
+Execute(The vulture handler should handle empty output):
+  AssertEqual
+  \ [],
+  \ ale_linters#python#vulture#Handle(bufnr(''), [])