ale/test/command_callback/test_lintr_command_callback.vader
2018-06-07 15:56:14 +02:00

49 lines
1.5 KiB
Plaintext

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 --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
\ . 'with_defaults())')
\ . ' %t',
\ ale_linters#r#lintr#GetCommand(bufnr(''))
Execute(The lintr options should be configurable):
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
AssertEqual
\ '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(''))
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 --vanilla -e '
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
\ . 'lint_package(cache = FALSE, '
\ . 'linters = with_defaults())')
\ . ' %t',
\ ale_linters#r#lintr#GetCommand(bufnr(''))