summaryrefslogtreecommitdiff
path: root/test/command_callback/test_elixir_mix_command_callbacks.vader
blob: 22d35eeb5b65e40b5bd450f2d608ca21304e3a5c (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
Before:
  runtime ale_linters/elixir/mix.vim

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

  let g:project_root = ale#path#Simplify(g:dir . '/mix_paths/wrapped_project')

  let g:env_prefix = has('win32')
  \ ? 'set MIX_BUILD_PATH=TEMP && '
  \ : 'MIX_BUILD_PATH=TEMP '


  function! GetCommand(buffer) abort
    let l:command = ale_linters#elixir#mix#GetCommand(a:buffer)

    let l:split_command = split(l:command, 'MIX_BUILD_PATH=[^ ]*\s')

    return l:split_command[0] . 'MIX_BUILD_PATH=TEMP' .  l:split_command[1]
  endfunction



After:
  Restore

  unlet! g:env_prefix
  unlet! g:project_root

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

  delfunction GetCommand

Execute(The default mix command should be correct):
  call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex')

  AssertEqual
  \ GetCommand(bufnr('')),
  \ ale#path#CdString(g:project_root)
  \ . g:env_prefix
  \ . 'mix compile %s'