summaryrefslogtreecommitdiff
path: root/test/fixers/test_xmllint_fixer_callback.vader
blob: 54fe05bd660d3db5c8332ea27c0ebb1e0a682e0c (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
42
43
44
45
46
Before:
  Save g:ale_xml_xmllint_executable
  Save g:ale_xml_xmllint_indentsize
  Save g:ale_xml_xmllint_options

  let g:ale_xml_xmllint_executable = '/path/to/xmllint'
  let g:ale_xml_xmllint_indentsize = ''
  let g:ale_xml_xmllint_options = ''

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

After:
  Restore

Execute(The xmllint callback should return the correct default command):
  AssertEqual
  \ {
  \   'command': ale#Escape('/path/to/xmllint')
  \     . ' --format '
  \     . ale#Escape(bufname(bufnr('')))
  \ },
  \ ale#fixers#xmllint#Fix(bufnr(''))

Execute(The xmllint callback should include the XMLLINT_INDENT variable):
  let g:ale_xml_xmllint_indentsize = 2

  AssertEqual
  \ {
  \   'command': ale#Env('XMLLINT_INDENT', '  ')
  \     . ale#Escape('/path/to/xmllint')
  \     . ' --format '
  \     . ale#Escape(bufname(bufnr('')))
  \ },
  \ ale#fixers#xmllint#Fix(bufnr(''))

Execute(The xmllint callback should include additional options):
  let g:ale_xml_xmllint_options = '--nonet'

  AssertEqual
  \ {
  \   'command': ale#Escape('/path/to/xmllint')
  \     . ' --format '
  \     . ale#Escape(bufname(bufnr('')))
  \     . ' --nonet'
  \ },
  \ ale#fixers#xmllint#Fix(bufnr(''))