2019-01-12 14:40:03 +00:00
|
|
|
" Author: januswel, w0rp
|
|
|
|
Before:
|
|
|
|
" This is just one language for the linter.
|
|
|
|
call ale#assert#SetUpLinterTest('rst', 'textlint')
|
|
|
|
|
|
|
|
" The configuration is shared between many languages.
|
|
|
|
Save g:ale_textlint_executable
|
|
|
|
Save g:ale_textlint_use_global
|
|
|
|
Save g:ale_textlint_options
|
|
|
|
|
|
|
|
let g:ale_textlint_executable = 'textlint'
|
|
|
|
let g:ale_textlint_use_global = 0
|
|
|
|
let g:ale_textlint_options = ''
|
|
|
|
|
|
|
|
unlet! b:ale_textlint_executable
|
|
|
|
unlet! b:ale_textlint_use_global
|
|
|
|
unlet! b:ale_textlint_options
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! b:ale_textlint_executable
|
|
|
|
unlet! b:ale_textlint_use_global
|
|
|
|
unlet! b:ale_textlint_options
|
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
2023-09-16 21:22:01 +00:00
|
|
|
Execute(The default textlint command should be correct):
|
2019-01-12 14:40:03 +00:00
|
|
|
AssertLinter 'textlint',
|
|
|
|
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
|
|
|
|
|
2023-09-16 21:22:01 +00:00
|
|
|
Execute(The text executable and command should be configurable):
|
2019-01-12 14:40:03 +00:00
|
|
|
let b:ale_textlint_executable = 'foobar'
|
|
|
|
let b:ale_textlint_options = '--something'
|
|
|
|
|
2023-09-16 21:22:01 +00:00
|
|
|
AssertLinter 'foobar',
|
|
|
|
\ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s'
|
2019-01-12 14:40:03 +00:00
|
|
|
|
|
|
|
Execute(The local executable from .bin should be used if available):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt')
|
2019-01-12 14:40:03 +00:00
|
|
|
|
|
|
|
AssertLinter
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'),
|
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'))
|
2019-01-12 14:40:03 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
|
|
|
|
|
|
|
Execute(The local executable from textlint/bin should be used if available):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt')
|
2019-01-12 14:40:03 +00:00
|
|
|
|
|
|
|
if has('win32')
|
|
|
|
AssertLinter
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
|
|
|
\ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
2019-01-12 14:40:03 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
|
|
|
else
|
|
|
|
AssertLinter
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
2019-01-12 14:40:03 +00:00
|
|
|
\ . ' -f json --stdin --stdin-filename %s'
|
|
|
|
endif
|