summaryrefslogtreecommitdiff
path: root/test/test_ant_find_project_root.vader
blob: bde33f007e15546e50c6818a1615209ea6169e3e (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
Before:
  call ale#test#SetDirectory('/testplugin/test')
  runtime ale_linters/java/javac.vim

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

Execute(Should return current directory if called on the project root):
  call ale#test#SetFilename('ant-test-files/ant-project/Main.java')

  AssertEqual
  \ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
  \ ale#ant#FindProjectRoot(bufnr(''))

Execute(Should return root directory if called on a deeply nested source file):
  call ale#test#SetFilename('ant-test-files/ant-project/src/several/namespace/layers/A.java')

  AssertEqual
  \ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
  \ ale#ant#FindProjectRoot(bufnr(''))

Execute(Should return empty string if called on a non-ant project):
  call ale#test#SetFilename('ant-test-files/non-ant-project/Main.java')

  AssertEqual
  \ '',
  \ ale#ant#FindProjectRoot(bufnr(''))

Execute(Should return empty string if called on a file in a non-ant project):
  call ale#test#SetFilename('ant-test-files/non-ant-project/several/namespace/layers/A.java')

  AssertEqual
  \ '',
  \ ale#ant#FindProjectRoot(bufnr(''))