From e013eeb0ef69630fb74c7bb4aa64ce85d6fe5d7a Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Tue, 1 Oct 2019 20:35:51 +0300 Subject: [PATCH] XDebuggerAssertions: Add optional "icon" parameter GitOrigin-RevId: f074ecfcab46da0a490c6c1d7dc3b1562ab458c4 --- .../xdebugger/XDebuggerAssertions.java | 89 ++++++++++++++----- 1 file changed, 69 insertions(+), 20 deletions(-) diff --git a/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerAssertions.java b/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerAssertions.java index 38f587b965ca..0f9efbfb5a0d 100644 --- a/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerAssertions.java +++ b/platform/xdebugger-testFramework/src/com/intellij/xdebugger/XDebuggerAssertions.java @@ -72,12 +72,47 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { assertPosition(session.getCurrentPosition(), file, line); } + public static void assertVariable(@NotNull Collection vars, + @Nullable String name, + @Nullable String type, + @Nullable String value, + @Nullable Boolean hasChildren) { + assertVariable(vars, name, type, value, hasChildren, null); + } + + public static void assertVariable(@NotNull Collection vars, + @Nullable String name, + @Nullable String type, + @Nullable String value, + @Nullable Boolean hasChildren, + @Nullable Icon icon) { + assertVariable(findVar(vars, name), name, type, value, hasChildren, icon); + } + + public static void assertVariable(@NotNull Pair varAndErrorMessage, + @Nullable String name, + @Nullable String type, + @Nullable String value, + @Nullable Boolean hasChildren) { + assertVariable(varAndErrorMessage, name, type, value, hasChildren, null); + } + + public static void assertVariable(@NotNull Pair varAndErrorMessage, + @Nullable String name, + @Nullable String type, + @Nullable String value, + @Nullable Boolean hasChildren, + @Nullable Icon icon) { + assertNull(varAndErrorMessage.second); + assertVariable(varAndErrorMessage.first, name, type, value, hasChildren, icon); + } + public static void assertVariable(@NotNull XValue var, @Nullable String name, @Nullable String type, @Nullable String value, @Nullable Boolean hasChildren) { - assertVariable(var, name, type, value, hasChildren, XDebuggerTestUtil::waitFor); + assertVariable(var, name, type, value, hasChildren, null); } public static void assertVariable(@NotNull XValue var, @@ -85,6 +120,16 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { @Nullable String type, @Nullable String value, @Nullable Boolean hasChildren, + @Nullable Icon icon) { + assertVariable(var, name, type, value, hasChildren, icon, XDebuggerTestUtil::waitFor); + } + + public static void assertVariable(@NotNull XValue var, + @Nullable String name, + @Nullable String type, + @Nullable String value, + @Nullable Boolean hasChildren, + @Nullable Icon icon, @NotNull BiFunction waitFunction) { XTestValueNode node = computePresentation(var, waitFunction); @@ -92,10 +137,11 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { if (type != null) assertEquals(type, node.myType); if (value != null) assertEquals(value, node.myValue); if (hasChildren != null) assertEquals(hasChildren, node.myHasChildren); + if (icon != null) assertEquals(icon, node.myIcon); } public static void assertVariableValue(@NotNull XValue var, @Nullable String name, @Nullable String value) { - assertVariable(var, name, null, value, null); + assertVariable(var, name, null, value, null, null); } public static void assertVariableValue(@NotNull Collection vars, @Nullable String name, @Nullable String value) { @@ -123,6 +169,15 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { assertVariableValueMatches(findVar(vars, name), name, type, valuePattern, hasChildren); } + public static void assertVariableValueMatches(@NotNull Collection vars, + @Nullable String name, + @Nullable String type, + @Nullable @Language("RegExp") String valuePattern, + @Nullable Boolean hasChildren, + @Nullable Icon icon) { + assertVariableValueMatches(findVar(vars, name), name, type, valuePattern, hasChildren, icon); + } + public static void assertVariableValueMatches(@NotNull XValue var, @Nullable String name, @Nullable @Language("RegExp") String valuePattern) { @@ -141,7 +196,7 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { @Nullable String type, @Nullable @Language("RegExp") String valuePattern, @Nullable Boolean hasChildren) { - assertVariableValueMatches(var, name, type, valuePattern, hasChildren, XDebuggerTestUtil::waitFor); + assertVariableValueMatches(var, name, type, valuePattern, hasChildren, null); } public static void assertVariableValueMatches(@NotNull XValue var, @@ -149,6 +204,16 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { @Nullable String type, @Nullable @Language("RegExp") String valuePattern, @Nullable Boolean hasChildren, + @Nullable Icon icon) { + assertVariableValueMatches(var, name, type, valuePattern, hasChildren, icon, XDebuggerTestUtil::waitFor); + } + + public static void assertVariableValueMatches(@NotNull XValue var, + @Nullable String name, + @Nullable String type, + @Nullable @Language("RegExp") String valuePattern, + @Nullable Boolean hasChildren, + @Nullable Icon icon, @NotNull BiFunction waitFunction) { XTestValueNode node = computePresentation(var, waitFunction); if (name != null) assertEquals(name, node.myName); @@ -157,6 +222,7 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { assertTrue("Expected value: " + valuePattern + " Actual value: " + node.myValue, node.myValue.matches(valuePattern)); } if (hasChildren != null) assertEquals(hasChildren, node.myHasChildren); + if (icon != null) assertEquals(icon, node.myIcon); } public static void assertVariableTypeMatches(@NotNull Collection vars, @@ -269,23 +335,6 @@ public class XDebuggerAssertions extends XDebuggerTestUtil { assertEquals(line, position.getLine()); } - public static void assertVariable(@NotNull Collection vars, - @Nullable String name, - @Nullable String type, - @Nullable String value, - @Nullable Boolean hasChildren) { - assertVariable(findVar(vars, name), name, type, value, hasChildren); - } - - public static void assertVariable(@NotNull Pair varAndErrorMessage, - @Nullable String name, - @Nullable String type, - @Nullable String value, - @Nullable Boolean hasChildren) { - assertNull(varAndErrorMessage.second); - assertVariable(varAndErrorMessage.first, name, type, value, hasChildren); - } - public static String assertVariableExpression(@NotNull XValue desc, String expectedExpression) { String expression = desc.getEvaluationExpression(); assertEquals(expectedExpression, expression);