summaryrefslogtreecommitdiff
path: root/test/command_callback/test_slimlint_command_callback.vader
blob: 38588a1ff97af9b49ee44df6906d894c5abcbe4f (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
Before:
  runtime ale_linters/slim/slimlint.vim

  let g:default_command = 'slim-lint %t'

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

After:
  Restore

  unlet! g:default_command
  unlet! b:conf

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

Execute(The default command should be correct):
  AssertEqual g:default_command, ale_linters#slim#slimlint#GetCommand(bufnr(''))

Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
  call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')

  let b:conf = ale#path#Simplify(g:dir . '/../slimlint-test-files/.rubocop.yml')

  if has('win32')
    " Windows uses 'set var=... && command'
    AssertEqual
    \ 'set SLIM_LINT_RUBOCOP_CONF='
    \   . ale#Escape(b:conf)
    \   .  ' && ' . g:default_command,
    \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
  else
    " Unix uses 'var=... command'
    AssertEqual
    \ 'SLIM_LINT_RUBOCOP_CONF='
    \   . ale#Escape(b:conf)
    \   .  ' ' . g:default_command,
    \ ale_linters#slim#slimlint#GetCommand(bufnr(''))
  endif