mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 14:45:29 +08:00
merge master -- apparently someone else added dhall?
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
Before:
|
||||
Save g:ale_c_build_dir
|
||||
Save g:ale_c_clangtidy_executable
|
||||
Save g:ale_c_clangtidy_checks
|
||||
Save g:ale_c_clangtidy_extra_options
|
||||
Save g:ale_cpp_clangtidy_executable
|
||||
Save g:ale_cpp_clangtidy_checks
|
||||
Save g:ale_cpp_clangtidy_extra_options
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_c_clangtidy_executable = 'xxxinvalid'
|
||||
let g:ale_c_clangtidy_checks = []
|
||||
let g:ale_c_clangtidy_extra_options = ''
|
||||
let g:ale_cpp_clangtidy_executable = 'xxxinvalidpp'
|
||||
let g:ale_cpp_clangtidy_checks = []
|
||||
let g:ale_cpp_clangtidy_extra_options = ''
|
||||
let g:ale_c_build_dir = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
@@ -36,16 +47,3 @@ Execute(The clangtidy callback should include any additional options):
|
||||
\ . ' -fix -fix-errors --some-option %t',
|
||||
\ },
|
||||
\ ale#fixers#clangtidy#Fix(bufnr(''))
|
||||
|
||||
Execute(The clangtidy callback should support cpp files):
|
||||
call ale#test#SetFilename('c_paths/dummy.cpp')
|
||||
let g:ale_cpp_clangtidy_executable = 'invalidpp'
|
||||
set filetype=cpp " The test fails without this
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_cpp_clangtidy_executable)
|
||||
\ . ' -fix -fix-errors %t',
|
||||
\ },
|
||||
\ ale#fixers#clangtidy#Fix(bufnr(''))
|
||||
|
||||
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
@@ -0,0 +1,11 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('dhall', 'dhall')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertFixer
|
||||
\ { 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('dhall') . ' format --inplace %t'
|
||||
\ }
|
||||
@@ -1,7 +1,11 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('javascript', 'eslint')
|
||||
Save g:ale_command_wrapper
|
||||
|
||||
runtime autoload/ale/handlers/eslint.vim
|
||||
|
||||
let g:ale_command_wrapper = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ Before:
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_python_isort_executable = 'xxxinvalid'
|
||||
let g:ale_python_isort_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
silent cd ..
|
||||
@@ -27,7 +28,7 @@ Execute(The isort callback should return the correct default values):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
||||
\ },
|
||||
\ ale#fixers#isort#Fix(bufnr(''))
|
||||
@@ -42,7 +43,7 @@ Execute(The isort callback should respect custom options):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
||||
\ . ' --multi-line=3 --trailing-comma -',
|
||||
\ },
|
||||
|
||||
@@ -18,10 +18,8 @@ Execute(The latexindent callback should return the correct default values):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' -l -w'
|
||||
\ . ' %t',
|
||||
\ . ' -l'
|
||||
\ },
|
||||
\ ale#fixers#latexindent#Fix(bufnr(''))
|
||||
|
||||
@@ -31,10 +29,8 @@ Execute(The latexindent callback should include custom gofmt options):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' -l -w'
|
||||
\ . ' -l'
|
||||
\ . ' ' . g:ale_tex_latexindent_options
|
||||
\ . ' %t',
|
||||
\ },
|
||||
\ ale#fixers#latexindent#Fix(bufnr(''))
|
||||
|
||||
@@ -19,8 +19,7 @@ Execute(The ocamlformat callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' --name=' . ale#Escape(bufname(bufnr('')))
|
||||
\ . ' -',
|
||||
\ . ' --name=%s -',
|
||||
\ },
|
||||
\ ale#fixers#ocamlformat#Fix(bufnr(''))
|
||||
|
||||
@@ -32,7 +31,6 @@ Execute(The ocamlformat callback should include custom ocamlformat options):
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' ' . g:ale_ocaml_ocamlformat_options
|
||||
\ . ' --name=' . ale#Escape(bufname(bufnr('')))
|
||||
\ . ' -',
|
||||
\ . ' --name=%s -',
|
||||
\ },
|
||||
\ ale#fixers#ocamlformat#Fix(bufnr(''))
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('javascript', 'prettier_eslint')
|
||||
Save g:ale_command_wrapper
|
||||
|
||||
let g:ale_command_wrapper = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
@@ -70,7 +73,7 @@ Execute(The new --stdin-filepath option should be used when the version is new e
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
@@ -80,7 +83,7 @@ Execute(The version number should be cached):
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
@@ -88,7 +91,7 @@ Execute(The version number should be cached):
|
||||
GivenCommandOutput []
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('javascript', 'prettier')
|
||||
Save g:ale_command_wrapper
|
||||
|
||||
let g:ale_command_wrapper = ''
|
||||
|
||||
silent cd ..
|
||||
silent cd command_callback
|
||||
@@ -294,6 +297,17 @@ Execute(Should set --parser for experimental language, Handlebars):
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
Execute(Changes to directory where .prettierignore is found):
|
||||
call ale#test#SetFilename('../prettier-test-files/with_prettierignore/src/testfile.js')
|
||||
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
Execute(The prettier_d post-processor should permit regular JavaScript content):
|
||||
AssertEqual
|
||||
\ [
|
||||
|
||||
19
test/fixers/test_prettier_standard_callback.vader
Normal file
19
test/fixers/test_prettier_standard_callback.vader
Normal file
@@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('javascript', 'prettier_standard')
|
||||
|
||||
silent cd ..
|
||||
silent cd command_callback
|
||||
let g:dir = getcwd()
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The prettier callback should return the correct default values):
|
||||
call ale#test#SetFilename('../prettier-test-files/testfile.js')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_javascript_prettier_standard_executable)
|
||||
\ . ' --stdin'
|
||||
\ . ' --stdin-filepath=%s ',
|
||||
\ }
|
||||
24
test/fixers/test_remark_lint_fixer_callback.vader
Normal file
24
test/fixers/test_remark_lint_fixer_callback.vader
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_markdown_remark_lint_executable
|
||||
Save g:ale_markdown_remark_lint_options
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
Execute(The remark callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('remark')
|
||||
\ },
|
||||
\ ale#fixers#remark_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The remark executable and options should be configurable):
|
||||
let g:ale_markdown_remark_lint_executable = '/path/to/remark'
|
||||
let g:ale_markdown_remark_lint_options = '-h'
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('/path/to/remark')
|
||||
\ . ' -h',
|
||||
\ },
|
||||
\ ale#fixers#remark_lint#Fix(bufnr(''))
|
||||
@@ -23,8 +23,7 @@ Execute(The rubocop callback should return the correct default values):
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -36,8 +35,7 @@ Execute(The rubocop callback should include configuration files):
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -51,8 +49,7 @@ Execute(The rubocop callback should include custom rubocop options):
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --except Lint/Debugger'
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -65,8 +62,7 @@ Execute(The rubocop callback should use auto-correct-all option when set):
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --auto-correct-all --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct-all --force-exclusion --stdin %s'
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Execute(The executable path should be correct):
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js'))
|
||||
\ . ' --fix %t',
|
||||
\ . ' --fix --stdin < %s > %t',
|
||||
\ },
|
||||
\ ale#fixers#standard#Fix(bufnr(''))
|
||||
|
||||
@@ -26,6 +26,6 @@ Execute(Custom options should be supported):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('standard') . ' --foo-bar --fix %t',
|
||||
\ 'command': ale#Escape('standard') . ' --foo-bar --fix --stdin < %s > %t',
|
||||
\ },
|
||||
\ ale#fixers#standard#Fix(bufnr(''))
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
Before:
|
||||
Save g:ale_stylelint_options
|
||||
|
||||
let g:ale_stylelint_options = ''
|
||||
|
||||
call ale#assert#SetUpFixerTest('css', 'stylelint')
|
||||
|
||||
After:
|
||||
@@ -10,7 +14,7 @@ Execute(The stylelint callback should return the correct default values):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' %t'
|
||||
@@ -24,7 +28,7 @@ Execute(The stylelint callback should include custom stylelint options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' %t'
|
||||
|
||||
Reference in New Issue
Block a user