Skip to content

Commit 56ff5fd

Browse files
authored
test: add SymbolsLabelProvider WorkspaceSymbol label tests (#1420)
1 parent e27c3c2 commit 56ff5fd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/outline/SymbolsLabelProviderTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.eclipse.lsp4j.Range;
2424
import org.eclipse.lsp4j.SymbolInformation;
2525
import org.eclipse.lsp4j.SymbolKind;
26+
import org.eclipse.lsp4j.WorkspaceSymbol;
27+
import org.eclipse.lsp4j.jsonrpc.messages.Either;
2628
import org.junit.jupiter.api.Test;
2729

2830
public class SymbolsLabelProviderTest extends AbstractTest {
@@ -44,6 +46,26 @@ public void testShowKindLocation() {
4446
assertEquals("Foo :Class path/to/foo", labelProvider.getText(info));
4547
}
4648

49+
@Test
50+
public void testWorkspaceSymbolShowKind() {
51+
final var labelProvider = new SymbolsLabelProvider(false, true);
52+
final var workspaceSymbol = new WorkspaceSymbol();
53+
workspaceSymbol.setName("Foo");
54+
workspaceSymbol.setKind(SymbolKind.Class);
55+
workspaceSymbol.setLocation(Either.forLeft(LOCATION));
56+
assertEquals("Foo :Class", labelProvider.getText(workspaceSymbol));
57+
}
58+
59+
@Test
60+
public void testWorkspaceSymbolShowKindLocation() {
61+
final var labelProvider = new SymbolsLabelProvider(true, true);
62+
final var workspaceSymbol = new WorkspaceSymbol();
63+
workspaceSymbol.setName("Foo");
64+
workspaceSymbol.setKind(SymbolKind.Class);
65+
workspaceSymbol.setLocation(Either.forLeft(LOCATION));
66+
assertEquals("Foo :Class path/to/foo", labelProvider.getText(workspaceSymbol));
67+
}
68+
4769
@Test
4870
public void testShowLocation() {
4971
final var labelProvider = new SymbolsLabelProvider(true, false);

0 commit comments

Comments
 (0)