diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-15 18:24:53 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-15 18:28:28 +0100 |
commit | a42999a639b2916b769a85f37d037be314d9d61b (patch) | |
tree | 5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_lintr_command_callback.vader | |
parent | 5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff) | |
download | ale-a42999a639b2916b769a85f37d037be314d9d61b.zip |
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_lintr_command_callback.vader')
-rw-r--r-- | test/command_callback/test_lintr_command_callback.vader | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/test/command_callback/test_lintr_command_callback.vader b/test/command_callback/test_lintr_command_callback.vader index 2f7dfb1d..8a0e6c1c 100644 --- a/test/command_callback/test_lintr_command_callback.vader +++ b/test/command_callback/test_lintr_command_callback.vader @@ -1,48 +1,36 @@ Before: - Save g:ale_r_lintr_options - - unlet! g:ale_r_lintr_options - unlet! b:ale_r_lintr_options - - runtime ale_linters/r/lintr.vim + call ale#assert#SetUpLinterTest('r', 'lintr') After: - Restore - - unlet! b:ale_r_lintr_options - - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(The default lintr command should be correct): - AssertEqual + AssertLinter 'Rscript', \ 'cd ' . ale#Escape(getcwd()) . ' && ' \ . 'Rscript --vanilla -e ' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' - \ . 'lint(cache = FALSE, commandArgs(TRUE), ' - \ . 'with_defaults())') - \ . ' %t', - \ ale_linters#r#lintr#GetCommand(bufnr('')) + \ . 'lint(cache = FALSE, commandArgs(TRUE), ' + \ . 'with_defaults())') + \ . ' %t' Execute(The lintr options should be configurable): let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)' - AssertEqual + AssertLinter 'Rscript', \ 'cd ' . ale#Escape(getcwd()) . ' && ' \ . 'Rscript --vanilla -e ' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' - \ . 'lint(cache = FALSE, commandArgs(TRUE), ' - \ . 'with_defaults(object_usage_linter = NULL))') - \ . ' %t', - \ ale_linters#r#lintr#GetCommand(bufnr('')) + \ . 'lint(cache = FALSE, commandArgs(TRUE), ' + \ . 'with_defaults(object_usage_linter = NULL))') + \ . ' %t' Execute(If the lint_package flag is set, lintr::lint_package should be called): let b:ale_r_lintr_lint_package = 1 - AssertEqual + AssertLinter 'Rscript', \ 'cd ' . ale#Escape(getcwd()) . ' && ' \ . 'Rscript --vanilla -e ' \ . ale#Escape('suppressPackageStartupMessages(library(lintr));' - \ . 'lint_package(cache = FALSE, ' - \ . 'linters = with_defaults())') - \ . ' %t', - \ ale_linters#r#lintr#GetCommand(bufnr('')) + \ . 'lint_package(cache = FALSE, ' + \ . 'linters = with_defaults())') + \ . ' %t' |