ale/test/command_callback/test_lintr_command_callback.vader

49 lines
1.5 KiB
Plaintext
Raw Normal View History

2017-09-03 22:29:12 +00:00
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
After:
Restore
unlet! b:ale_r_lintr_options
call ale#linter#Reset()
Execute(The default lintr command should be correct):
AssertEqual
\ 'cd ' . ale#Escape(getcwd()) . ' && '
\ . 'Rscript -e '
2018-02-01 02:06:35 +00:00
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
2018-02-05 17:54:15 +00:00
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
2018-02-01 02:06:35 +00:00
\ . 'with_defaults())')
\ . ' %t',
2017-09-03 22:29:12 +00:00
\ ale_linters#r#lintr#GetCommand(bufnr(''))
Execute(The lintr options should be configurable):
2018-02-01 02:06:35 +00:00
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
2017-09-03 22:29:12 +00:00
AssertEqual
\ 'cd ' . ale#Escape(getcwd()) . ' && '
\ . 'Rscript -e '
2018-02-01 02:06:35 +00:00
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
2018-02-05 17:54:15 +00:00
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
2018-02-01 02:06:35 +00:00
\ . 'with_defaults(object_usage_linter = NULL))')
\ . ' %t',
2017-09-03 22:29:12 +00:00
\ ale_linters#r#lintr#GetCommand(bufnr(''))
2018-02-04 18:57:52 +00:00
Execute(If the lint_package flag is set, lintr::lint_package should be called):
let b:ale_r_lintr_lint_package = 1
AssertEqual
\ 'cd ' . ale#Escape(getcwd()) . ' && '
\ . 'Rscript -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
2018-02-05 17:54:15 +00:00
\ . 'lint_package(cache = FALSE, '
\ . 'linters = with_defaults())')
2018-02-04 18:57:52 +00:00
\ . ' %t',
\ ale_linters#r#lintr#GetCommand(bufnr(''))