summaryrefslogtreecommitdiff
path: root/test/fixers/test_shfmt_fixer_callback.vader
blob: 02fce526cad269ac97c850141daa8ec15eed549c (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
Before:
  Save g:ale_sh_shfmt_executable
  Save g:ale_sh_shfmt_options
  Save &l:expandtab
  Save &l:shiftwidth
  Save &l:tabstop

After:
  Restore

Execute(The shfmt callback should return 'shfmt' as default command):
  setlocal noexpandtab
  Assert
  \ ale#fixers#shfmt#Fix(bufnr('')).command =~# '^' . ale#Escape('shfmt'),
  \ "Default command name is expected to be 'shfmt'"

Execute(The shfmt executable and options should be configurable):
  let g:ale_sh_shfmt_executable = 'foobar'
  let g:ale_sh_shfmt_options = '--some-option'

  AssertEqual
  \ {
  \   'command': ale#Escape('foobar')
  \     . ' -filename=%s'
  \     . ' --some-option',
  \ },
  \ ale#fixers#shfmt#Fix(bufnr(''))