summaryrefslogtreecommitdiff
path: root/test/linter/test_cpp_ccls.vader
blob: 12aa30e3f780a78025b2c3ff446d9f272292c54f (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
57
58
59
60
61
62
63
64
65
66
67
68
69
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>
" Description: A language server for C++

Before:
  call ale#assert#SetUpLinterTest('cpp', 'ccls')

  Save b:ale_c_build_dir_names
  Save b:ale_cpp_ccls_executable
  Save b:ale_cpp_ccls_init_options

After:
  call ale#assert#TearDownLinterTest()

Execute(The project root should be detected correctly using compile_commands.json file):
  call ale#test#SetFilename(tempname() . '/dummy.cpp')

  AssertLSPProject ''

  call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.cpp')

  AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json')

Execute(The project root should be detected correctly using .ccls file):
  call ale#test#SetFilename(tempname() . '/dummy.cpp')

  AssertLSPProject ''

  call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.cpp')

  AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls')

Execute(The project root should be detected correctly using .ccls-root file):
  call ale#test#SetFilename(tempname() . '/dummy.cpp')

  AssertLSPProject ''

  call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.cpp')

  AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root')

Execute(The executable should be configurable):
  AssertLinter 'ccls', ale#Escape('ccls')

  let b:ale_cpp_ccls_executable = 'foobar'

  AssertLinter 'foobar', ale#Escape('foobar')

Execute(The initialization options should be configurable):
  AssertLSPOptions {}

  let b:ale_cpp_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' }

  AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' }

Execute(The compile command database should be detected correctly):
  call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c')

  AssertLSPOptions {}

  call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c')

  AssertLSPOptions { 'compilationDatabaseDirectory':
  \  ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') }

  call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c')
  let b:ale_c_build_dir_names = ['unusual_build_dir_name']

  AssertLSPOptions { 'compilationDatabaseDirectory':
  \  ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') }