summaryrefslogtreecommitdiff
path: root/test/fixers/test_xmllint_fixer_callback.vader
blob: 103b0f7bd8ddb9df2e1f01b46d392e0ca4f850a2 (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
47
48
49
50
51
52
53
54
55
56
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 with unpersisted buffer):
  new

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

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(''))