summaryrefslogtreecommitdiff
path: root/test/command_callback/test_shellcheck_command_callback.vader
blob: 8e2290561d314b053fee4598e234a9b0e7cad360 (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_sh_shellcheck_exclusions
  Save g:ale_sh_shellcheck_executable
  Save g:ale_sh_shellcheck_options

  unlet! g:ale_sh_shellcheck_exclusions
  unlet! g:ale_sh_shellcheck_executable
  unlet! g:ale_sh_shellcheck_options

  runtime ale_linters/sh/shellcheck.vim

After:
  Restore

  unlet! b:ale_sh_shellcheck_exclusions
  unlet! b:ale_sh_shellcheck_executable
  unlet! b:ale_sh_shellcheck_options
  unlet! b:is_bash

  call ale#linter#Reset()

Execute(The default shellcheck command should be correct):
  AssertEqual
  \ 'shellcheck -f gcc -',
  \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))

Execute(The shellcheck command should accept options):
  let b:ale_sh_shellcheck_options = '--foobar'

  AssertEqual
  \ 'shellcheck --foobar -f gcc -',
  \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))

Execute(The shellcheck command should accept options and exclusions):
  let b:ale_sh_shellcheck_options = '--foobar'
  let b:ale_sh_shellcheck_exclusions = 'foo,bar'

  AssertEqual
  \ 'shellcheck --foobar -e foo,bar -f gcc -',
  \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))

Execute(The shellcheck command should include the dialect):
  let b:is_bash = 1

  AssertEqual
  \ 'shellcheck -s bash -f gcc -',
  \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))

Execute(The shellcheck command should include the dialect before options and exclusions):
  let b:is_bash = 1
  let b:ale_sh_shellcheck_options = '--foobar'
  let b:ale_sh_shellcheck_exclusions = 'foo,bar'

  AssertEqual
  \ 'shellcheck -s bash --foobar -e foo,bar -f gcc -',
  \ ale_linters#sh#shellcheck#GetCommand(bufnr(''))