Add tests for diagnostics rendering

This commit is contained in:
Pavel V. Talanov
2016-02-16 15:43:58 +03:00
parent 4ab5aabfa0
commit 7ba4adf006
5 changed files with 59 additions and 0 deletions
@@ -0,0 +1,16 @@
// !DIAGNOSTICS_NUMBER: 1
// !DIAGNOSTICS: TYPE_MISMATCH
// !MESSAGE_TYPE: HTML
package a.b.c
class G
class D<T, G> {
fun f(t: Map<T, a.b.c.G>) {
}
fun <T> f(t1: Map<T, G>, T2: T) {
f(t1)
}
}
@@ -0,0 +1,14 @@
<!-- complexTypeMismatchWithTypeParameters1 -->
<html>
Type mismatch.
<table>
<tr>
<td>Required:</td>
<td>Map<`T#1<i> (type parameter of a.b.c.D)</i>, a.b.c.G></td>
</tr>
<tr>
<td>Found:</td>
<td>Map<`T#2<i> (type parameter of a.b.c.D.f)</i>, G#1<i> (type parameter of a.b.c.D)</i>></td>
</tr>
</table>
</html>
@@ -0,0 +1,15 @@
// !DIAGNOSTICS_NUMBER: 1
// !DIAGNOSTICS: TYPE_MISMATCH
// !MESSAGE_TYPE: TEXT
package myPackage.a.b
class A<T> {
fun g(t: T) {
}
fun <T> f(t: T) {
g(t)
}
}
@@ -0,0 +1,2 @@
<!-- typeMismatchWithTypeParameters1 -->
Type mismatch: inferred type is T#2 (type parameter of myPackage.a.b.A.f) but T#1 (type parameter of myPackage.a.b.A) was expected
@@ -65,6 +65,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
doTest(fileName);
}
@TestMetadata("complexTypeMismatchWithTypeParameters.kt")
public void testComplexTypeMismatchWithTypeParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/complexTypeMismatchWithTypeParameters.kt");
doTest(fileName);
}
@TestMetadata("conflictingOverloadsClass.kt")
public void testConflictingOverloadsClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/conflictingOverloadsClass.kt");
@@ -215,6 +221,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
doTest(fileName);
}
@TestMetadata("typeMismatchWithTypeParameters.kt")
public void testTypeMismatchWithTypeParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeMismatchWithTypeParameters.kt");
doTest(fileName);
}
@TestMetadata("typeParameterAsReified.kt")
public void testTypeParameterAsReified() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeParameterAsReified.kt");