summaryrefslogtreecommitdiff
path: root/test/command_callback/test_foodcritic_command_callback.vader
blob: e3ad8a70102abe0a349762844e691dde1c6118e9 (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
Before:
  Save g:ale_chef_foodcritic_executable
  Save g:ale_chef_foodcritic_options

  unlet! g:ale_chef_foodcritic_executable
  unlet! g:ale_chef_foodcritic_options

  call ale#test#SetDirectory('/testplugin/test')

  runtime ale_linters/chef/foodcritic.vim

After:
  Restore

  unlet! b:ale_chef_foodcritic_executable
  unlet! b:ale_chef_foodcritic_options

  call ale#test#RestoreDirectory()
  call ale#linter#Reset()

Execute(The default command should be correct):
  AssertEqual
  \ 'foodcritic',
  \ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
  AssertEqual
  \ ale#Escape('foodcritic') . ' %s',
  \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))

Execute(Extra options should be included with escapeed tildes (~)):
  let b:ale_chef_foodcritic_options = '-t ~F011'

  AssertEqual
  \ ale#Escape('foodcritic') . ' -t \~F011 %s',
  \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))

Execute(The executable should be configurable):
  let b:ale_chef_foodcritic_executable = 'foobar'

  AssertEqual
  \ 'foobar',
  \ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
  AssertEqual
  \ ale#Escape('foobar') . ' %s',
  \ ale_linters#chef#foodcritic#GetCommand(bufnr(''))