forked from fwcd/kotlin-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorkspaceSymbolsTest.kt
25 lines (22 loc) · 1.07 KB
/
WorkspaceSymbolsTest.kt
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
package org.javacs.kt
import org.eclipse.lsp4j.SymbolKind
import org.eclipse.lsp4j.WorkspaceSymbolParams
import org.hamcrest.Matchers.hasItem
import org.hamcrest.Matchers.not
import org.junit.Assert.assertThat
import org.junit.Before
import org.junit.Test
class WorkspaceSymbolsTest: SingleFileTestFixture("symbols", "DocumentSymbols.kt") {
@Test fun `find symbols in OtherFileSymbols`() {
val found = languageServer.workspaceService.symbol(WorkspaceSymbolParams("")).get()
val byKind = found.groupBy({ it.kind }, { it.name })
val all = found.map { it.name }.toList()
assertThat(byKind[SymbolKind.Class], hasItem("OtherFileSymbols"))
assertThat(byKind[SymbolKind.Constructor], hasItem("OtherFileSymbols"))
assertThat(byKind[SymbolKind.Property], hasItem("otherFileProperty"))
assertThat(byKind[SymbolKind.Function], hasItem("otherFileFunction"))
assertThat(all, not(hasItem("aFunctionArg")))
assertThat(all, not(hasItem("aConstructorArg")))
assertThat(all, not(hasItem("otherFileLocalVariable")))
}
}