summaryrefslogtreecommitdiff
path: root/test/command_callback/test_erlang_syntaxerl_command_callback.vader
blob: a9a1a5008ddc33726670957bc9b54ff2a7e290ea (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Before:
  Save g:ale_erlang_syntaxerl_executable

  unlet! g:ale_erlang_syntaxerl_executable
  unlet! b:ale_erlang_syntaxerl_executable

  runtime ale_linters/erlang/syntaxerl.vim

After:
  Restore

  call ale#linter#Reset()

Execute (The executable should be correct):
  AssertEqual 'syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))

  let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
  AssertEqual '/some/other/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))

  let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
  AssertEqual '/yet/another/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))


Execute (The executable should be presented in the feature check command):
  let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'

  AssertEqual
  \ ale#Escape('/some/other/syntaxerl') . ' -h',
  \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))

  let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'

  AssertEqual
  \ ale#Escape('/yet/another/syntaxerl') . ' -h',
  \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))

Execute (The executable should be presented in the command):
  let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'

  AssertEqual
  \ ale#Escape('/some/other/syntaxerl') . ' %t',
  \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])

  let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'

  AssertEqual
  \ ale#Escape('/yet/another/syntaxerl') . ' %t',
  \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])

Execute (The -b option should be used when available):
  AssertEqual ale#Escape('syntaxerl') . ' %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
  \   'Syntax checker for Erlang (0.14.0)',
  \   'Usage: syntaxerl [-d | --debug] <FILENAME>',
  \   '       syntaxerl <-h | --help>',
  \   '  -d, --debug    Enable debug output',
  \   '  -h, --help     Show this message',
  \ ])

  AssertEqual ale#Escape('syntaxerl') . ' -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
  \   'Syntax checker for Erlang (0.14.0)',
  \   'Usage: syntaxerl [-b | --base <FILENAME>] [-d | --debug] <FILENAME>',
  \   '       syntaxerl <-h | --help>',
  \   '  -b, --base     Set original filename',
  \   '  -d, --debug    Enable debug output',
  \   '  -h, --help     Show this message',
  \ ])