summaryrefslogtreecommitdiff
path: root/test/command_callback/test_swaglint_command_callback.vader
blob: 0f1d870eb72f31b8baf9b03094757638eb29f16a (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
Before:
  runtime ale_linters/yaml/swaglint.vim

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

After:
  let g:ale_yaml_swaglint_executable = 'swaglint'
  let g:ale_yaml_swaglint_use_global = 0

  call ale#linter#Reset()

Execute(The yaml swaglint command callback should return the correct default string):
  AssertEqual 'swaglint',
  \ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))
  AssertEqual 'swaglint -r compact --stdin',
  \ ale_linters#yaml#swaglint#GetCommand(bufnr(''))

Execute(The yaml swaglint command callback should be configurable):
  let g:ale_yaml_swaglint_executable = '~/.local/bin/swaglint'
  AssertEqual '~/.local/bin/swaglint',
  \ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))
  AssertEqual '~/.local/bin/swaglint -r compact --stdin',
  \ ale_linters#yaml#swaglint#GetCommand(bufnr(''))

Execute(The yaml swaglint command callback should allow a global installation to be used):
  let g:ale_yaml_swaglint_executable = '/usr/local/bin/swaglint'
  let g:ale_yaml_swaglint_use_global = 1
  AssertEqual '/usr/local/bin/swaglint',
  \ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))
  AssertEqual '/usr/local/bin/swaglint -r compact --stdin',
  \ ale_linters#yaml#swaglint#GetCommand(bufnr(''))

Execute(The yaml swaglint command callback should allow a local installation to be used):
  call ale#test#SetFilename('swaglint_paths/docs/swagger.yaml')

  AssertEqual
  \ ale#path#Winify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint'),
  \ ale_linters#yaml#swaglint#GetExecutable(bufnr(''))

  AssertEqual
  \ ale#path#Winify(g:dir . '/swaglint_paths/node_modules/.bin/swaglint')
  \   . ' -r compact --stdin',
  \ ale_linters#yaml#swaglint#GetCommand(bufnr(''))