From 3153722b84e34d64f6c011f7dcde18ca136ca3f5 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Mon, 14 Nov 2016 15:46:34 +0300 Subject: [PATCH] [Parameter Name Hints] added diagnostic --- .../codeInsight/daemon/inlays/InlayParameterHintsTest.kt | 6 +++--- .../codeInsight/daemon/inlays/JavaParameterNameHintsTest.kt | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/InlayParameterHintsTest.kt b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/InlayParameterHintsTest.kt index ceba1745faa7..d60c2a6dd8b1 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/InlayParameterHintsTest.kt +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/InlayParameterHintsTest.kt @@ -88,7 +88,8 @@ class InlayAssert(private val file: PsiFile, val inlays: List) { 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) { assertThat(hintNames).isEqualTo(expectedHintNames) - val wordsAfter = hintOffsets.mapNotNull { file.findElementAt(it) }.map { it.text } - + val wordsAfter = elements.map { it.text } assertThat(wordsAfter).isEqualTo(expectedWordsAfter) } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/JavaParameterNameHintsTest.kt b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/JavaParameterNameHintsTest.kt index d695a36345be..ff2227789255 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/JavaParameterNameHintsTest.kt +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/inlays/JavaParameterNameHintsTest.kt @@ -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") }