summaryrefslogtreecommitdiff
path: root/test/command_callback/test_objc_ccls_command_callbacks.vader
blob: 58d824c5e183999d6f113bb36ea20c7a5841f1b1 (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
Before:
  call ale#assert#SetUpLinterTest('objc', 'ccls')

  Save b:ale_c_build_dir_names
  Save b:ale_objc_ccls_executable
  Save b:ale_objc_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.m')

  AssertLSPProject ''

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

  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.m')

  AssertLSPProject ''

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

  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.m')

  AssertLSPProject ''

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

  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_objc_ccls_executable = 'foobar'

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

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

  let b:ale_objc_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') }