summaryrefslogtreecommitdiff
path: root/test/test_gradle_find_project_root.vader
blob: b61591883048d354a2bd46f74b37ad5f75d65c8e (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/kotlin/kotlinc.vim

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

Execute(Should return directory for 'gradlew' if found in parent directory):
  call ale#test#SetFilename('test-files/gradle/wrapped-project/src/main/kotlin/dummy.kt')

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

Execute(Should return directory for 'settings.gradle' if found in parent directory):
  call ale#test#SetFilename('test-files/gradle/settings-gradle-project/src/main/kotlin/dummy.kt')

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

Execute(Should return directory for 'build.gradle' if found in parent directory):
  call ale#test#SetFilename('test-files/gradle/build-gradle-project/src/main/kotlin/dummy.kt')

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

Execute(Should return empty string if gradle files are not found in parent directory):
  call ale#test#SetFilename('test-files/gradle/non-gradle-project/src/main/kotlin/dummy.kt')

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