summaryrefslogtreecommitdiff
path: root/test/fixers/test_mix_format_fixer_callback.vader
blob: 365fbecf6161bf2205a75179835f40623ce788a1 (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
Before:
  Save g:ale_elixir_mix_executable
  Save g:ale_elixir_mix_format_options

  let g:ale_elixir_mix_executable = 'xxxinvalid'
  let g:ale_elixir_mix_format_options = ''

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

After:
  Restore

  call ale#test#RestoreDirectory()

Execute(The mix_format callback should return the correct default values):
  call ale#test#SetFilename('../elixir-test-files/testfile.ex')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape('xxxinvalid')
  \     . ' format %t',
  \ },
  \ ale#fixers#mix_format#Fix(bufnr(''))

Execute(The mix_format callback should include the correct format options):
  let g:ale_elixir_mix_format_options = 'invalid_options'
  call ale#test#SetFilename('../elixir-test-files/testfile.ex')

  AssertEqual
  \ {
  \   'read_temporary_file': 1,
  \   'command': ale#Escape('xxxinvalid')
  \     . ' format invalid_options %t',
  \ },
  \ ale#fixers#mix_format#Fix(bufnr(''))