diff options
author | w0rp <devw0rp@gmail.com> | 2020-08-28 19:50:36 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2020-08-28 19:50:36 +0100 |
commit | 7d4ce4e6aa960a6052a16d90322566d6f4fddb7c (patch) | |
tree | 0f191e0dff643cc4b53f6dbd5259fef028d7a0dd /test | |
parent | 3d5a2690ce707cbc9e71e8ed4d5d1955e4b26d65 (diff) | |
download | ale-7d4ce4e6aa960a6052a16d90322566d6f4fddb7c.zip |
Close #3325 - Apply new formatting where possible
Diffstat (limited to 'test')
-rw-r--r-- | test/command_callback/test_ada_gcc_command_callbacks.vader | 8 | ||||
-rw-r--r-- | test/command_callback/test_asm_gcc_command_callbacks.vader | 2 | ||||
-rw-r--r-- | test/command_callback/test_c_cc_command_callbacks.vader | 2 | ||||
-rw-r--r-- | test/command_callback/test_c_import_paths.vader | 16 | ||||
-rw-r--r-- | test/command_callback/test_cpp_cc_command_callbacks.vader (renamed from test/command_callback/test_cpp_gcc_command_callbacks.vader) | 2 | ||||
-rw-r--r-- | test/command_callback/test_nasm_nasm_command_callbacks.vader | 7 | ||||
-rw-r--r-- | test/command_callback/test_pydocstyle_command_callback.vader | 20 | ||||
-rw-r--r-- | test/command_callback/test_pyrex_cython_command_callback.vader | 12 | ||||
-rw-r--r-- | test/command_callback/test_rubocop_command_callback.vader | 9 | ||||
-rw-r--r-- | test/command_callback/test_ruumba_command_callback.vader | 9 | ||||
-rw-r--r-- | test/command_callback/test_standardrb_command_callback.vader | 9 | ||||
-rw-r--r-- | test/fixers/test_ocamlformat_fixer_callback.vader | 6 | ||||
-rw-r--r-- | test/fixers/test_rubocop_fixer_callback.vader | 12 |
13 files changed, 49 insertions, 65 deletions
diff --git a/test/command_callback/test_ada_gcc_command_callbacks.vader b/test/command_callback/test_ada_gcc_command_callbacks.vader index de6e355e..906b31a4 100644 --- a/test/command_callback/test_ada_gcc_command_callbacks.vader +++ b/test/command_callback/test_ada_gcc_command_callbacks.vader @@ -18,11 +18,10 @@ After: call ale#assert#TearDownLinterTest() Execute(The executable should be configurable): - AssertLinter 'gcc', \ ale#Escape('gcc') . ' -x ada -c -gnatc' \ . ' -o ' . b:out_file - \ . ' -I ' . ale#Escape(getcwd()) + \ . ' -I %s:h' \ . ' -gnatwa -gnatq %t' let b:ale_ada_gcc_executable = 'foo' @@ -30,15 +29,14 @@ Execute(The executable should be configurable): AssertLinter 'foo', \ ale#Escape('foo') . ' -x ada -c -gnatc' \ . ' -o ' . b:out_file - \ . ' -I ' . ale#Escape(getcwd()) + \ . ' -I %s:h' \ . ' -gnatwa -gnatq %t' Execute(The options should be configurable): - let g:ale_ada_gcc_options = '--foo --bar' AssertLinter 'gcc', \ ale#Escape('gcc') . ' -x ada -c -gnatc' \ . ' -o ' . b:out_file - \ . ' -I ' . ale#Escape(getcwd()) + \ . ' -I %s:h' \ . ' --foo --bar %t' diff --git a/test/command_callback/test_asm_gcc_command_callbacks.vader b/test/command_callback/test_asm_gcc_command_callbacks.vader index 42606ec0..5976b5f2 100644 --- a/test/command_callback/test_asm_gcc_command_callbacks.vader +++ b/test/command_callback/test_asm_gcc_command_callbacks.vader @@ -3,7 +3,7 @@ Before: call ale#test#SetFilename('test.cpp') let b:command_tail = ' -x assembler' \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') - \ . '-iquote ' . ale#Escape(g:dir) + \ . '-iquote %s:h' \ . ' -Wall -' After: diff --git a/test/command_callback/test_c_cc_command_callbacks.vader b/test/command_callback/test_c_cc_command_callbacks.vader index 9d71d941..c8c2de7d 100644 --- a/test/command_callback/test_c_cc_command_callbacks.vader +++ b/test/command_callback/test_c_cc_command_callbacks.vader @@ -23,7 +23,7 @@ Before: let b:command_tail = ' -S -x c' \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(getcwd()) + \ . ' -iquote %s:h' \ . ' -std=c11 -Wall -' After: diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader index 8384a659..3c2bd79b 100644 --- a/test/command_callback/test_c_import_paths.vader +++ b/test/command_callback/test_c_import_paths.vader @@ -43,7 +43,7 @@ Execute(The C cc linter should include 'include' directories for projects with a AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include')) \ . ' -' @@ -55,7 +55,7 @@ Execute(The C cc linter should include 'include' directories for projects with a AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include')) \ . ' -' @@ -67,7 +67,7 @@ Execute(The C cc linter should include root directories for projects with .h fil AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project')) \ . ' -' @@ -79,7 +79,7 @@ Execute(The C cc linter should include root directories for projects with .hpp f AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project')) \ . ' -' @@ -101,7 +101,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include')) \ . ' -' @@ -113,7 +113,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include')) \ . ' -' @@ -125,7 +125,7 @@ Execute(The C++ cc linter should include root directories for projects with .h f AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project')) \ . ' -' @@ -137,7 +137,7 @@ Execute(The C++ cc linter should include root directories for projects with .hpp AssertLinter 'gcc', \ ale#Escape('gcc') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir')) + \ . ' -iquote %s:h' \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project')) \ . ' -' diff --git a/test/command_callback/test_cpp_gcc_command_callbacks.vader b/test/command_callback/test_cpp_cc_command_callbacks.vader index 930cc68a..dec3a07c 100644 --- a/test/command_callback/test_cpp_gcc_command_callbacks.vader +++ b/test/command_callback/test_cpp_cc_command_callbacks.vader @@ -23,7 +23,7 @@ Before: let b:command_tail = ' -S -x c++' \ . ' -o ' . (has('win32') ? 'nul': '/dev/null') - \ . ' -iquote ' . ale#Escape(getcwd()) + \ . ' -iquote %s:h' \ . ' -std=c++14 -Wall -' After: diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader index 8e077306..2bfe2b0d 100644 --- a/test/command_callback/test_nasm_nasm_command_callbacks.vader +++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader @@ -2,9 +2,9 @@ Before: call ale#assert#SetUpLinterTest('nasm', 'nasm') let b:command_tail = - \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') let b:command_tail_opt = - \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null') After: unlet! b:command_tail @@ -23,7 +23,8 @@ Execute(The options should be configurable): let b:ale_nasm_nasm_options = '-w-macro-params' AssertLinter 'nasm', ale#Escape('nasm') - \ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null') + \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') + \ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null') Execute(The options should be used in command): let b:ale_nasm_nasm_options = '-w+orphan-labels' diff --git a/test/command_callback/test_pydocstyle_command_callback.vader b/test/command_callback/test_pydocstyle_command_callback.vader index 02177f36..511443a6 100644 --- a/test/command_callback/test_pydocstyle_command_callback.vader +++ b/test/command_callback/test_pydocstyle_command_callback.vader @@ -7,34 +7,34 @@ After: Execute(The pydocstyle command callback should return default string): AssertLinter 'pydocstyle', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('pydocstyle') . ' ' . ale#Escape('test.py') + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pydocstyle') . ' %s:t' Execute(The pydocstyle command callback should allow options): let g:ale_python_pydocstyle_options = '--verbose' AssertLinter 'pydocstyle', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('pydocstyle') . ' --verbose ' . ale#Escape('test.py') + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pydocstyle') . ' --verbose %s:t' Execute(The pydocstyle executable should be configurable): let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle' AssertLinter '~/.local/bin/pydocstyle', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('~/.local/bin/pydocstyle') . ' ' . ale#Escape('test.py') + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('~/.local/bin/pydocstyle') . ' %s:t' Execute(Setting executable to 'pipenv' appends 'run pydocstyle'): let g:ale_python_pydocstyle_executable = 'path/to/pipenv' AssertLinter 'path/to/pipenv', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('path/to/pipenv') . ' run pydocstyle ' . ale#Escape('test.py') + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('path/to/pipenv') . ' run pydocstyle %s:t' Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set): let g:ale_python_pydocstyle_auto_pipenv = 1 call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py') AssertLinter 'pipenv', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('pipenv') . ' run pydocstyle ' . ale#Escape('whatever.py') + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('pipenv') . ' run pydocstyle %s:t' diff --git a/test/command_callback/test_pyrex_cython_command_callback.vader b/test/command_callback/test_pyrex_cython_command_callback.vader index b9020f11..af86366a 100644 --- a/test/command_callback/test_pyrex_cython_command_callback.vader +++ b/test/command_callback/test_pyrex_cython_command_callback.vader @@ -6,8 +6,8 @@ After: Execute(The default cython command should be correct): AssertLinter 'cython', ale#Escape('cython') - \ . ' --working ' . ale#Escape(g:dir) - \ . ' --include-dir ' . ale#Escape(g:dir) + \ . ' --working %s:h' + \ . ' --include-dir %s:h' \ . ' --warning-extra' \ . ' --output-file ' . g:ale#util#nul_file . ' %t' @@ -15,8 +15,8 @@ Execute(The cython executable should be configurable): let b:ale_pyrex_cython_executable = 'cython_foobar' AssertLinter 'cython_foobar', ale#Escape('cython_foobar') - \ . ' --working ' . ale#Escape(g:dir) - \ . ' --include-dir ' . ale#Escape(g:dir) + \ . ' --working %s:h' + \ . ' --include-dir %s:h' \ . ' --warning-extra' \ . ' --output-file ' . g:ale#util#nul_file . ' %t' @@ -24,7 +24,7 @@ Execute(Additional cython options should be configurable): let b:ale_pyrex_cython_options = '--foobar' AssertLinter 'cython', ale#Escape('cython') - \ . ' --working ' . ale#Escape(g:dir) - \ . ' --include-dir ' . ale#Escape(g:dir) + \ . ' --working %s:h' + \ . ' --include-dir %s:h' \ . ' --foobar' \ . ' --output-file ' . g:ale#util#nul_file . ' %t' diff --git a/test/command_callback/test_rubocop_command_callback.vader b/test/command_callback/test_rubocop_command_callback.vader index 7f42a8c0..e7cc32e8 100644 --- a/test/command_callback/test_rubocop_command_callback.vader +++ b/test/command_callback/test_rubocop_command_callback.vader @@ -10,20 +10,17 @@ After: Execute(Executable should default to rubocop): AssertLinter 'rubocop', ale#Escape('rubocop') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Should be able to set a custom executable): let g:ale_ruby_rubocop_executable = 'bin/rubocop' AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Setting bundle appends 'exec rubocop'): let g:ale_ruby_rubocop_executable = 'path to/bundle' AssertLinter 'path to/bundle', ale#Escape('path to/bundle') \ . ' exec rubocop' - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' diff --git a/test/command_callback/test_ruumba_command_callback.vader b/test/command_callback/test_ruumba_command_callback.vader index 244b264a..9fa48903 100644 --- a/test/command_callback/test_ruumba_command_callback.vader +++ b/test/command_callback/test_ruumba_command_callback.vader @@ -10,20 +10,17 @@ After: Execute(Executable should default to ruumba): AssertLinter 'ruumba', ale#Escape('ruumba') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Should be able to set a custom executable): let g:ale_eruby_ruumba_executable = 'bin/ruumba' AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Setting bundle appends 'exec ruumba'): let g:ale_eruby_ruumba_executable = 'path to/bundle' AssertLinter 'path to/bundle', ale#Escape('path to/bundle') \ . ' exec ruumba' - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb')) + \ . ' --format json --force-exclusion --stdin %s' diff --git a/test/command_callback/test_standardrb_command_callback.vader b/test/command_callback/test_standardrb_command_callback.vader index 7bc1c976..108dd870 100644 --- a/test/command_callback/test_standardrb_command_callback.vader +++ b/test/command_callback/test_standardrb_command_callback.vader @@ -10,20 +10,17 @@ After: Execute(Executable should default to standardrb): AssertLinter 'standardrb', ale#Escape('standardrb') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Should be able to set a custom executable): let g:ale_ruby_standardrb_executable = 'bin/standardrb' AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb') - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' Execute(Setting bundle appends 'exec standardrb'): let g:ale_ruby_standardrb_executable = 'path to/bundle' AssertLinter 'path to/bundle', ale#Escape('path to/bundle') \ . ' exec standardrb' - \ . ' --format json --force-exclusion --stdin ' - \ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb')) + \ . ' --format json --force-exclusion --stdin %s' diff --git a/test/fixers/test_ocamlformat_fixer_callback.vader b/test/fixers/test_ocamlformat_fixer_callback.vader index f0c36ed7..0ccdb070 100644 --- a/test/fixers/test_ocamlformat_fixer_callback.vader +++ b/test/fixers/test_ocamlformat_fixer_callback.vader @@ -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('')) diff --git a/test/fixers/test_rubocop_fixer_callback.vader b/test/fixers/test_rubocop_fixer_callback.vader index 305881e0..84579d31 100644 --- a/test/fixers/test_rubocop_fixer_callback.vader +++ b/test/fixers/test_rubocop_fixer_callback.vader @@ -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('')) |