install.fairie/dotfiles/.vim/plugged/ale/test/handler/test_vulture_handler.vader
Git E2E Dev Test Username e149692cc9 git subrepo clone https://github.com/dense-analysis/ale.git ./dotfiles/.vim/plugged/ale
subrepo:
  subdir:   "dotfiles/.vim/plugged/ale"
  merged:   "e4b205440"
upstream:
  origin:   "https://github.com/dense-analysis/ale.git"
  branch:   "master"
  commit:   "e4b205440"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:09 -04:00

92 lines
2.8 KiB
Text

Before:
runtime ale_linters/python/vulture.vim
call ale#test#SetDirectory('/testplugin/test/handler')
After:
Restore
call ale#test#RestoreDirectory()
call ale#linter#Reset()
silent file something_else.py
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(''), [])