summaryrefslogtreecommitdiff
path: root/test/linter/test_erlang_erlang_ls.vader
blob: 2a3d7a702331ee98c15217839cf2632398ae9809 (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
70
Before:
  call ale#assert#SetUpLinterTest('erlang', 'erlang_ls')

After:
  unlet! b:root

  call ale#assert#TearDownLinterTest()

Execute(The default command should be correct):
  AssertLinter 'erlang_ls',
  \ ale#Escape('erlang_ls') . ' --log-level=' . ale#Escape('info')

Execute(Executable should be configurable):
  let b:ale_erlang_erlang_ls_executable = '/path/to/erlang_ls'

  AssertLinter '/path/to/erlang_ls',
  \ ale#Escape('/path/to/erlang_ls') . ' --log-level=' . ale#Escape('info')

Execute(Log level should be configurable):
  let b:ale_erlang_erlang_ls_log_level = 'debug'

  AssertLinter 'erlang_ls',
  \ ale#Escape('erlang_ls') . ' --log-level=' . ale#Escape('debug')

Execute(Log directory should be configurable):
  let b:ale_erlang_erlang_ls_log_dir = '/path/to/logs'

  AssertLinter 'erlang_ls',
  \ ale#Escape('erlang_ls')
  \ . ' --log-dir=' . ale#Escape('/path/to/logs')
  \ . ' --log-level=' . ale#Escape('info')

Execute(Project root should be detected using erlang_ls.config):
  let b:root = '../test-files/erlang/app_with_erlang_ls_config'

  call ale#test#SetFilename(b:root . '/src/app.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

  call ale#test#SetFilename(b:root . '/_build/default/lib/dep/src/dep.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

  call ale#test#SetFilename(b:root . '/deps/dep/src/dep.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

Execute(Root of Rebar3 project should be detected):
  let b:root = '../test-files/erlang/rebar3_app'

  call ale#test#SetFilename(b:root . '/src/app.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

  call ale#test#SetFilename(b:root . '/_build/default/lib/dep/src/dep.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

  call ale#test#SetFilename(b:root . '/_checkouts/dep/src/dep.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

Execute(Root of Erlang.mk project should be detected):
  let b:root = '../test-files/erlang/erlang_mk_app'

  call ale#test#SetFilename(b:root . '/src/app.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

  call ale#test#SetFilename(b:root . '/deps/dep/src/dep.erl')
  AssertLSPProject ale#test#GetFilename(b:root)

Execute(Root of kerl managed Erlang/OTP installation should be detected):
  let b:root = '../test-files/erlang/kerl_otp_root'

  call ale#test#SetFilename(b:root . '/lib/stdlib-4.1.1/array.erl')
  AssertLSPProject ale#test#GetFilename(b:root)