Skip to content

Commit 9557c42

Browse files
committed
Test custom diagnostics level
1 parent 0340827 commit 9557c42

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ class DiagnosticTest : SingleFileTestFixture("diagnostic", "Diagnostics.kt") {
1919
assertThat(warnings, hasSize(1))
2020
}
2121

22+
@Test fun `report only errors`() {
23+
languageServer.config.diagnostics.level = DiagnosticSeverity.Error
24+
diagnostics.clear()
25+
26+
// Trigger a diagnostics update via a dummy change.
27+
// TODO: Use the LSP configuration change notification mechanism instead
28+
// and automatically update diagnostics.
29+
replace(file, 6, 1, "", " ")
30+
languageServer.textDocumentService.debounceLint.waitForPendingTask()
31+
32+
assertThat(diagnostics, hasSize(1))
33+
assertThat(errors, hasSize(1))
34+
assertThat(warnings, empty<Diagnostic>())
35+
}
36+
2237
@Test fun `only lint once for many edits in a short period`() {
2338
var text = "1"
2439
for (i in 1..10) {

0 commit comments

Comments
 (0)