Ejemplo n.º 1
0
 private static void assertPropertyEquals(SNode expectedNode, SNode actualNode) {
   HashSet<String> propertes = new HashSet<String>();
   propertes.addAll(IterableUtil.asCollection(expectedNode.getPropertyNames()));
   propertes.addAll(IterableUtil.asCollection(actualNode.getPropertyNames()));
   for (String key : propertes) {
     String expectedProperty =
         jetbrains.mps.util.SNodeOperations.getProperties(expectedNode).get(key);
     String actualProperty = jetbrains.mps.util.SNodeOperations.getProperties(actualNode).get(key);
     assertEquals(
         getErrorString("property", expectedNode, actualNode), expectedProperty, actualProperty);
   }
 }
Ejemplo n.º 2
0
 private static void checkModelNodes(@NotNull SModel model, @NotNull final List<String> result) {
   for (final SNode node : SNodeUtil.getDescendants(model)) {
     final SConcept concept = node.getConcept();
     if (concept == null) {
       result.add("unknown concept of node: " + SNodeUtil.getDebugText(node));
       continue;
     }
     for (String name : node.getPropertyNames()) {
       if (concept.getProperty(name) == null) {
         result.add("unknown property: `" + name + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
     for (SReference ref : node.getReferences()) {
       SAbstractLink link = concept.getLink(ref.getRole());
       if (link == null || !(link.isReference())) {
         result.add(
             "unknown link role: `" + ref.getRole() + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
     for (SNode child : node.getChildren()) {
       String role = child.getRoleInParent();
       SAbstractLink link = concept.getLink(role);
       if (link == null || link.isReference()) {
         result.add("unknown child role: `" + role + "' in node " + SNodeUtil.getDebugText(node));
       }
     }
   }
 }