summaryrefslogtreecommitdiff
path: root/test/command_callback/test_nasm_nasm_command_callbacks.vader
blob: 5053e536609370a11768c614d776ed4af301a940 (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
Before:
  Save g:ale_nasm_nasm_executable
  Save g:ale_nasm_nasm_options

  unlet! g:ale_nasm_nasm_executable
  unlet! b:ale_nasm_nasm_executable
  unlet! g:ale_nasm_nasm_options
  unlet! b:ale_nasm_nasm_options

  runtime ale_linters/nasm/nasm.vim

  let b:command_tail =
  \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . '  %s'
  let b:command_tail_opt =
  \ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'

After:
  Restore
  unlet! b:command_tail
  unlet! b:command_tail_opt
  unlet! b:ale_nasm_nasm_executable
  unlet! b:ale_nasm_nasm_options
  call ale#linter#Reset()

Execute(The executable should be configurable):
  AssertEqual 'nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))

  let b:ale_nasm_nasm_executable = '/opt/nasm/nasm'

  AssertEqual '/opt/nasm/nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))

Execute(The executable should be used in the command):
  AssertEqual
  \ ale#Escape('nasm') . b:command_tail,
  \ ale_linters#nasm#nasm#GetCommand(bufnr(''))

  let b:ale_nasm_nasm_executable = '~/nasm'

  AssertEqual
  \ ale#Escape('~/nasm') . b:command_tail,
  \ ale_linters#nasm#nasm#GetCommand(bufnr(''))

Execute(The options should be configurable):
  AssertEqual '', ale_linters#nasm#nasm#GetOptions(bufnr(''))
  let b:ale_nasm_nasm_options = '-w-macro-params'
  AssertEqual '-w-macro-params', ale_linters#nasm#nasm#GetOptions(bufnr(''))

Execute(The options should be used in command):
    let b:ale_nasm_nasm_options = '-w+orphan-labels'
    AssertEqual
    \ ale#Escape('nasm') . b:command_tail_opt,
    \ ale_linters#nasm#nasm#GetCommand(bufnr(''))