summaryrefslogtreecommitdiff
path: root/test/command_callback/test_lintr_command_callback.vader
blob: 33259e051a1cd579fe64fca910d4687b4333fa72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 '
  \   . 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 -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 -e '
  \   . ale#Escape('suppressPackageStartupMessages(library(lintr));'
      \    .           'lint_package(cache = FALSE, commandArgs(TRUE),'
      \    .           'with_defaults())')
  \   . ' %t',
  \ ale_linters#r#lintr#GetCommand(bufnr(''))