summaryrefslogtreecommitdiff
path: root/test/fixers/test_ocp_indent_fixer_callback.vader
blob: 1f61f383a32bde8e6d981972f4f70a2772e94827 (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
Before:
  Save g:ale_ocaml_ocp_indent_executable
  Save g:ale_ocaml_ocpindent_options

  " Use an invalid global executable
  let g:ale_ocaml_ocp_indent_executable = 'xxxinvalid'
  let g:ale_ocaml_ocp_indent_options = ''

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

After:
  Restore

  call ale#test#RestoreDirectory()

Execute(The ocp_indent callback should return the correct default values):
  call ale#test#SetFilename('../ocaml-test-files/ocp_inden_testfile.re')

  AssertEqual
  \ {
  \   'command': ale#Escape('xxxinvalid')
  \ },
  \ ale#fixers#ocp_indent#Fix(bufnr(''))

Execute(The ocp_indent callback should include custom ocp_indent options):
  let g:ale_ocaml_ocp_indent_config = "base=4, type=4"
  call ale#test#SetFilename('../ocaml-test-files/ocp_inden_testfile.re')

  AssertEqual
  \ {
  \   'command': ale#Escape('xxxinvalid')
  \     . ' --config=' . ale#Escape(g:ale_ocaml_ocp_indent_config)
  \ },
  \ ale#fixers#ocp_indent#Fix(bufnr(''))