Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve assertion message of 'has type' check #74

Open
wants to merge 1 commit into
base: 2023.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7174,18 +7174,24 @@
<ref role="1Pybhc" to="wyt6:~String" resolve="String" />
<ref role="37wK5l" to="wyt6:~String.format(java.lang.String,java.lang.Object...)" resolve="format" />
<node concept="Xl_RD" id="5wEVZcC27k0" role="37wK5m">
<property role="Xl_RC" value="node '%s' doesn't have type '%s'!" />
<property role="Xl_RC" value="node '%s' expected to have type '%s' but has type '%s'" />
</node>
<node concept="1rXfSq" id="5wEVZcC2989" role="37wK5m">
<ref role="37wK5l" node="18jf_F1WDtL" resolve="nodeWithIdToString" />
<node concept="37vLTw" id="5wEVZcC2aNx" role="37wK5m">
<ref role="3cqZAo" node="18jf_F1WDun" resolve="node" />
</node>
</node>
<node concept="1rXfSq" id="5ZLr23X0LTr" role="37wK5m">
<ref role="37wK5l" node="18jf_F1WDtL" resolve="nodeWithIdToString" />
<node concept="37vLTw" id="5ZLr23X0ML5" role="37wK5m">
<ref role="3cqZAo" node="18jf_F1WDur" resolve="type2" />
</node>
</node>
<node concept="1rXfSq" id="5wEVZcC2av$" role="37wK5m">
<ref role="37wK5l" node="18jf_F1WDtL" resolve="nodeWithIdToString" />
<node concept="37vLTw" id="5wEVZcC2av_" role="37wK5m">
<ref role="3cqZAo" node="18jf_F1WDur" resolve="type2" />
<ref role="3cqZAo" node="18jf_F1WDup" resolve="type1" />
</node>
</node>
</node>
Expand All @@ -7199,12 +7205,12 @@
<node concept="3Tqbb2" id="18jf_F1WDuo" role="1tU5fm" />
</node>
<node concept="37vLTG" id="18jf_F1WDup" role="3clF46">
<property role="TrG5h" value="type1" />
<property role="TrG5h" value="actualType" />
<property role="3TUv4t" value="true" />
<node concept="3Tqbb2" id="18jf_F1WDuq" role="1tU5fm" />
</node>
<node concept="37vLTG" id="18jf_F1WDur" role="3clF46">
<property role="TrG5h" value="type2" />
<property role="TrG5h" value="expectedType" />
<property role="3TUv4t" value="true" />
<node concept="3Tqbb2" id="18jf_F1WDus" role="1tU5fm" />
</node>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<product version="3" modelHash="bnemfl6dhzw43mw9vbdzewzweg7crrm">
<product version="3" modelHash="-4xw699fbfn0cgu3brdpzmgbjnunlj1z">
<files names="BaseEditorTestBody.java:BaseMigrationTestBody.java:BaseTestBody.java:BaseTransformationTest.java:CellReference.java:CheckErrorMessagesRunnable.java:CheckExpectedMessageRunnable.java:CheckScopesAction.java:CheckTypesAction.java:CouldNotFindModelException.java:EditorTestUtil.java:EnvironmentIsNullException.java:ExecuteCommandExtension.java:ExpandedProjectPathIsNullException.java:Fixture.java:FixtureTestable.java:IntentionTester.java:KeyEventsDispatcher.java:LanguageTestDiscoveryParticipants.java:MPSTestModelInitializationException.java:MatchIntentionById.java:MatchIntentionByIdAndParameter.java:ModuleActivator.java:MouseEventsDispatcher.java:NodeCheckerUtil.java:NodeDataFlowCheckerUtil.java:ProjectPathIsNullException.java:ProjectTestHelper.java:RunWithCommand.java:TestParametersCache.java:TestParametersCacheExtension.java:Testable.java:TestsErrorsChecker.java:TransformationTest.java" />
</product>

Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public static String nodeWithIdToString(final SNode node) {
return SNodeOperations.present(node) + " [" + node.getNodeId() + "]";
}

public static void assertTypesAreTheSame(SNode node, final SNode type1, final SNode type2) {
Assert.assertTrue(String.format("node '%s' doesn't have type '%s'!", nodeWithIdToString(node), nodeWithIdToString(type2)), new NodesMatcher(type1, type2).diff().isEmpty());
public static void assertTypesAreTheSame(SNode node, final SNode actualType, final SNode expectedType) {
Assert.assertTrue(String.format("node '%s' expected to have type '%s' but has type '%s'", nodeWithIdToString(node), nodeWithIdToString(expectedType), nodeWithIdToString(actualType)), new NodesMatcher(actualType, expectedType).diff().isEmpty());
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@
<root nodeRef="r:00000000-0000-4000-0000-011c895903a2(jetbrains.mps.lang.test.runtime)/1302453276762085176">
<file name="NodeCheckerUtil.java">
<node id="1302453276762085235" at="36,61,37,73" concept="12" />
<node id="6353154051987139581" at="40,94,41,176" concept="6" />
<node id="6353154051987139581" at="40,106,41,248" concept="6" />
<node id="4866539458460623431" at="45,100,46,127" concept="11" />
<node id="2436047764492929511" at="47,58,48,18" concept="12" />
<node id="4866539458460622190" at="49,5,50,78" concept="11" />
Expand Down Expand Up @@ -883,7 +883,7 @@
<node id="284455749621197098" at="54,0,65,0" concept="16" trace="getStandardCheckers#(Ljetbrains/mps/components/ComponentHost;)Ljava/util/List;" />
<node id="284455749621194126" at="66,0,78,0" concept="16" trace="checkForNodeMessages#(Lorg/jetbrains/mps/openapi/model/SNode;Ljetbrains/mps/components/ComponentHost;)Ljava/util/Collection;" />
<scope id="1302453276762085234" at="36,61,37,73" />
<scope id="1302453276762085252" at="40,94,41,176" />
<scope id="1302453276762085252" at="40,106,41,248" />
<scope id="2436047764492927449" at="47,58,48,18" />
<scope id="284455749619731469" at="72,163,73,60" />
<scope id="3743352646565401348" at="82,197,84,28">
Expand All @@ -893,9 +893,9 @@
<var name="node" id="1302453276762085248" />
</scope>
<scope id="1302453276762085251" at="40,0,43,0">
<var name="actualType" id="1302453276762085273" />
<var name="expectedType" id="1302453276762085275" />
<var name="node" id="1302453276762085271" />
<var name="type1" id="1302453276762085273" />
<var name="type2" id="1302453276762085275" />
</scope>
<scope id="284455749619234065" at="70,247,74,7">
<var name="reportedNode" id="284455749619798776" />
Expand Down