Rewrite GradleDaemonAnalyzerTest

Previously, GradleDaemonAnalyzer reused common IJ infrastructure for
highlighting tests (see DaemonAnalyzerTеstCase, ExpectedHighlightingData
and such).

Unfortunately, this infrastructure had several flaws,
mainly around checking expected highlighting against actual one:

- overlapping line markers lead to crash (fixed in 193+)

- no way to sanitize descriptions of line markers (important for cases
where description returns HTML-formatted text, which makes testdata
completely unreadable and also drives parser insane)

- thrown FileNotFoundException doesn't have a physical file with
expected testdata attached, which makes browsing diff a little less
convenient (no way to apply changes to expected file)

- no easy way to plug-in with additional after-highlighting checks

This commit fixes it by overriding doCheckResult and providing custom
checking of highlighting/line markers, based on TagsTestDataUtil.
Because we don't rely on IJ-checking anymore, we also remove weird hoops
with removing/adding testdata markup in checkFiles.
Also this commit adds strings sanitization in TagsTestDataUtil, removing HTML-tags
and line breaks, so that description of tag is always one-liner with
plain text.
This commit is contained in:
Dmitry Savvinov
2020-01-14 15:17:34 +03:00
parent a02e5d452f
commit 5800160ee1
12 changed files with 161 additions and 50 deletions
@@ -1,7 +1,7 @@
package sample
expect class <lineMarker descr="Has actuals in JS, JVM">Sample</lineMarker>() {
fun <lineMarker>checkMe</lineMarker>(): Int
fun <lineMarker descr="Has actuals in JS, JVM">checkMe</lineMarker>(): Int
}
expect object <lineMarker descr="Has actuals in JS, JVM">Platform</lineMarker> {
@@ -1,4 +1,4 @@
package sample
fun common(): Boolean {
return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is String but Boolean was expected">""</error>
return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is String but Boolean was expected" textAttributesKey="ERRORS_ATTRIBUTES">""</error>
}
@@ -2,5 +2,5 @@ package sample
fun jvm() {
println(common())
println(<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: js">js</error>())
println(<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: js" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">js</error>())
}
@@ -1,3 +1,3 @@
expect class <error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module first_jsMain for JS"><lineMarker>My</lineMarker></error> {
fun <lineMarker>foo</lineMarker>()
expect class <lineMarker descr="Has actuals in JVM"><error descr="[NO_ACTUAL_FOR_EXPECT] Expected class 'My' has no actual declaration in module first_jsMain for JS" textAttributesKey="ERRORS_ATTRIBUTES">My</error></lineMarker> {
fun <lineMarker descr="Has actuals in JVM">foo</lineMarker>()
}
@@ -1,5 +1,5 @@
actual class <lineMarker>My</lineMarker> {
actual fun <lineMarker>foo</lineMarker>() {}
actual class <lineMarker descr="Has declaration in common module">My</lineMarker> {
actual fun <lineMarker descr="Has declaration in common module">foo</lineMarker>() {}
actual fun <error descr="[ACTUAL_WITHOUT_EXPECT] Actual function 'bar' has no corresponding expected declaration">bar</error>() {}
actual fun <error descr="[ACTUAL_WITHOUT_EXPECT] Actual function 'bar' has no corresponding expected declaration" textAttributesKey="ERRORS_ATTRIBUTES">bar</error>() {}
}
@@ -1,3 +1,3 @@
expect class <lineMarker><lineMarker>My</lineMarker></lineMarker> {
fun <lineMarker><lineMarker>foo</lineMarker></lineMarker>()
expect class <lineMarker descr="Has actuals in JS, JVM">My</lineMarker> {
fun <lineMarker descr="Has actuals in JS, JVM">foo</lineMarker>()
}
@@ -1,3 +1,3 @@
actual class <lineMarker>My</lineMarker> {
actual fun <lineMarker>foo</lineMarker>() {}
actual class <lineMarker descr="Has declaration in common module">My</lineMarker> {
actual fun <lineMarker descr="Has declaration in common module">foo</lineMarker>() {}
}
@@ -1,3 +1,3 @@
actual class <lineMarker>My</lineMarker> {
actual fun <lineMarker>foo</lineMarker>() {}
actual class <lineMarker descr="Has declaration in common module">My</lineMarker> {
actual fun <lineMarker descr="Has declaration in common module">foo</lineMarker>() {}
}
@@ -1,7 +1,7 @@
import kotlin.test.*
class SimpleTest {
@Test fun testFoo() {
class <lineMarker descr="Run Test">SimpleTest</lineMarker> {
@Test fun <lineMarker descr="Run Test">testFoo</lineMarker>() {
// Will run
}