Skip to content

Commit 65f0260

Browse files
committed
Check diagnostics by severity
1 parent 7367a36 commit 65f0260

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/src/test/kotlin/org/javacs/kt/DiagnosticTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.javacs.kt
22

33
import java.util.concurrent.CancellationException
44
import org.eclipse.lsp4j.Diagnostic
5+
import org.eclipse.lsp4j.DiagnosticSeverity
56
import org.eclipse.lsp4j.DocumentSymbolParams
67
import org.eclipse.lsp4j.PublishDiagnosticsParams
78
import org.eclipse.lsp4j.TextDocumentIdentifier
@@ -10,10 +11,12 @@ import org.junit.Assert.assertThat
1011
import org.junit.Test
1112

1213
class DiagnosticTest : SingleFileTestFixture("diagnostic", "Diagnostics.kt") {
13-
@Test fun `report error on open`() {
14+
@Test fun `report diagnostics on open`() {
1415
languageServer.textDocumentService.debounceLint.waitForPendingTask()
1516

16-
assertThat(diagnostics, not(empty<Diagnostic>()))
17+
assertThat(diagnostics, hasSize(2))
18+
assertThat(diagnostics.filter { it.severity == DiagnosticSeverity.Warning }, hasSize(1))
19+
assertThat(diagnostics.filter { it.severity == DiagnosticSeverity.Error }, hasSize(1))
1720
}
1821

1922
@Test fun `only lint once for many edits in a short period`() {

0 commit comments

Comments
 (0)