mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-17 08:35:10 +08:00
Merge pull request #1675 from nicopauss/master
Improve pyrex cython linter.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
Before:
|
||||
Save g:ale_pyrex_cython_executable
|
||||
Save g:ale_pyrex_cython_options
|
||||
|
||||
unlet! g:ale_pyrex_cython_executable
|
||||
unlet! b:ale_pyrex_cython_executable
|
||||
unlet! g:ale_pyrex_cython_options
|
||||
unlet! b:ale_pyrex_cython_options
|
||||
|
||||
runtime ale_linters/pyrex/cython.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:ale_pyrex_cython_options
|
||||
unlet! b:ale_pyrex_cython_executable
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The default cython command should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape('cython')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --warning-extra'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t',
|
||||
\ ale_linters#pyrex#cython#GetCommand(bufnr(''))
|
||||
|
||||
Execute(The cython executable should be configurable):
|
||||
let b:ale_pyrex_cython_executable = 'cython_foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('cython_foobar')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --warning-extra'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t',
|
||||
\ ale_linters#pyrex#cython#GetCommand(bufnr(''))
|
||||
|
||||
Execute(Additional cython options should be configurable):
|
||||
let b:ale_pyrex_cython_options = '--foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('cython')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --foobar'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t',
|
||||
\ ale_linters#pyrex#cython#GetCommand(bufnr(''))
|
||||
26
test/handler/test_pyrex_cython_handler.vader
Normal file
26
test/handler/test_pyrex_cython_handler.vader
Normal file
@@ -0,0 +1,26 @@
|
||||
Before:
|
||||
runtime ale_linters/pyrex/cython.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The cython handler should handle warnings and errors):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 42,
|
||||
\ 'col': 7,
|
||||
\ 'text': 'some warning',
|
||||
\ 'type': 'W',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 777,
|
||||
\ 'col': 21,
|
||||
\ 'text': 'some error',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#pyrex#cython#Handle(347, [
|
||||
\ 'warning: file:42:7: some warning',
|
||||
\ 'file:777:21: some error',
|
||||
\ ])
|
||||
Reference in New Issue
Block a user