[Parameter Name Hints] added diagnostic

This commit is contained in:
Yaroslav Lepenkin
2016-11-14 16:08:09 +03:00
parent d32718a288
commit 3153722b84
2 changed files with 7 additions and 4 deletions
@@ -88,7 +88,8 @@ class InlayAssert(private val file: PsiFile, val inlays: List<Inlay>) {
val hintOffsets = hints.map { it.first }
val hintNames = hints.map { it.second }
assertThat(hints.size).isEqualTo(expectedInlays.size)
val elements = hintOffsets.mapNotNull { file.findElementAt(it) }
assertThat(hints.size).isEqualTo(expectedInlays.size).withFailMessage("Element at offsets: ${elements.joinToString(", ")}")
val expect = expectedInlays.map { it.substringBefore("->") to it.substringAfter("->") }
val expectedHintNames = expect.map { it.first }
@@ -96,8 +97,7 @@ class InlayAssert(private val file: PsiFile, val inlays: List<Inlay>) {
assertThat(hintNames).isEqualTo(expectedHintNames)
val wordsAfter = hintOffsets.mapNotNull { file.findElementAt(it) }.map { it.text }
val wordsAfter = elements.map { it.text }
assertThat(wordsAfter).isEqualTo(expectedWordsAfter)
}
@@ -708,13 +708,16 @@ class Key {
setup("""
class Test {
void test() {
xxx(100);
check(1 + 1);
int i=1; check(1 + 1 + 1);
}
void check(int isShow) {}
void xxx(int followTheSum) {}
}
""")
onLineStartingWith("xxx").assertInlays("followTheSum->100")
onLineStartingWith("check").assertInlays("isShow->1")
onLineStartingWith("int").assertInlays("isShow->1")
}