2018-03-26 08:55:18 +00:00
|
|
|
" Author: januswel, w0rp
|
|
|
|
|
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
" This is just one language for the linter.
|
|
|
|
call ale#assert#SetUpLinterTest('markdown', 'textlint')
|
|
|
|
|
|
|
|
" The configuration is shared between many languages.
|
2018-03-26 08:55:18 +00:00
|
|
|
Save g:ale_textlint_executable
|
|
|
|
Save g:ale_textlint_use_global
|
|
|
|
Save g:ale_textlint_options
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
let g:ale_textlint_executable = 'textlint'
|
|
|
|
let g:ale_textlint_use_global = 0
|
|
|
|
let g:ale_textlint_options = ''
|
|
|
|
|
2018-03-26 08:55:18 +00:00
|
|
|
unlet! b:ale_textlint_executable
|
|
|
|
unlet! b:ale_textlint_use_global
|
|
|
|
unlet! b:ale_textlint_options
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! b:command_tail
|
|
|
|
unlet! b:ale_textlint_executable
|
|
|
|
unlet! b:ale_textlint_use_global
|
|
|
|
unlet! b:ale_textlint_options
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2018-03-26 08:55:18 +00:00
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
Execute(The default command should be correct):
|
|
|
|
AssertLinter 'textlint',
|
|
|
|
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
Execute(The executable should be configurable):
|
2018-03-26 08:55:18 +00:00
|
|
|
let b:ale_textlint_executable = 'foobar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'foobar',
|
|
|
|
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
|
|
|
|
Execute(The options should be configurable):
|
|
|
|
let b:ale_textlint_options = '--something'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'textlint',
|
|
|
|
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
|
|
|
|
Execute(The local executable from .bin should be used if available):
|
|
|
|
call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt')
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter
|
2018-03-26 08:55:18 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'),
|
2018-03-26 09:35:10 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
|
|
|
|
Execute(The local executable from textlint/bin should be used if available):
|
|
|
|
call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt')
|
|
|
|
|
|
|
|
if has('win32')
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter
|
|
|
|
\ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
2018-03-26 09:35:10 +00:00
|
|
|
\ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
else
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter
|
|
|
|
\ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
2018-03-26 09:35:10 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
2018-03-26 08:55:18 +00:00
|
|
|
endif
|