summaryrefslogtreecommitdiff
path: root/test/test_elixir_credo.vader
blob: 78d3e0a661f7ae7cbf18e13449484b6290403354 (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
Before:
  call ale#test#SetDirectory('/testplugin/test')

  runtime ale_linters/elixir/credo.vim
  let g:test_command_start = ale#path#CdString('.') . 'mix help credo && '

After:
  call ale#test#RestoreDirectory()
  call ale#linter#Reset()
  let g:ale_elixir_credo_strict = 0
  let g:ale_elixir_credo_config_file = ''
  let g:test_command_start = ''

Execute(credo runs the right command):
  call ale#test#SetFilename('elixir-test-files/testfile.ex')

  AssertEqual
  \ ale_linters#elixir#credo#GetCommand(bufnr('')),
  \ g:test_command_start . 'mix credo suggest --format=flycheck --read-from-stdin %s'

Execute(credo runs the right command with the strict flag):
  let g:ale_elixir_credo_strict = 1
  call ale#test#SetFilename('elixir-test-files/testfile.ex')

  AssertEqual
  \ ale_linters#elixir#credo#GetCommand(bufnr('')),
  \ g:test_command_start . 'mix credo --strict --format=flycheck --read-from-stdin %s'

Execute(credo runs the right command with a custom config file):
  let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
  call ale#test#SetFilename('elixir-test-files/testfile.ex')

  AssertEqual
  \ ale_linters#elixir#credo#GetCommand(bufnr('')),
  \ g:test_command_start . 'mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'