summaryrefslogtreecommitdiff
path: root/test/test_jsonlint_executable_detection.vader
blob: de52f8460fb1c949e3f0a5712128e81bd2f13dcd (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
Before:
  call ale#test#SetDirectory('/testplugin/test')

  runtime ale_linters/json/jsonlint.vim

After:
  let g:ale_json_jsonlint_executable = 'jsonlint'
  let g:ale_json_jsonlint_use_global = 0

  call ale#test#RestoreDirectory()
  call ale#linter#Reset()

Execute(local executable should be detected correctly):
  call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')

  AssertEqual
  \ ale#path#Simplify(g:dir . '/jsonlint-test-files/app/node_modules/.bin/jsonlint'),
  \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))

Execute(recursively executable should be detected correctly):
  call ale#test#SetFilename('jsonlint-test-files/app-without-jsonlint/src/app.json')

  AssertEqual
  \ ale#path#Simplify(g:dir . '/jsonlint-test-files/node_modules/jsonlint/lib/cli.js'),
  \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))

Execute(use_global should override project executable):
  let g:ale_json_jsonlint_use_global = 1

  call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')

  AssertEqual
  \ 'jsonlint',
  \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))

Execute(manually defined should override default executable):
  let g:ale_json_jsonlint_use_global = 1
  let g:ale_json_jsonlint_executable = 'custom_jsonlint'

  call ale#test#SetFilename('jsonlint-test-files/app/src/app.json')

  AssertEqual
  \ 'custom_jsonlint',
  \ ale_linters#json#jsonlint#GetExecutable(bufnr(''))