Skip to content

Commit

Permalink
[498324] Fix failing Dot xtext editor content assistant test cases.
Browse files Browse the repository at this point in the history
- Use the "org.eclipse.xtext.common.Terminals" within the DotShape.xtext
sub-grammar to ensure that the proposal provider of the dot node shape
attribute works properly.
- Activate corresponding Dot Content Assistant test cases.
- Modify the DotValidator and DotAttributes test cases to accept the
newly generated validation failure messages.
  • Loading branch information
miklossy committed Aug 8, 2016
1 parent 3d5a0e0 commit 7896b5e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ public void node_shape() {
fail("Expecting IllegalArgumentException.");
} catch (IllegalArgumentException e) {
assertEquals(
"Cannot set node attribute 'shape' to 'foo'. The value 'foo' is not a syntactically correct shape: Mismatched character 'o' expecting 'l'.",
"Cannot set node attribute 'shape' to 'foo'. The value 'foo' is not a syntactically correct shape: No viable alternative at input 'foo'.",
e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,20 +654,18 @@ public void node_shape() throws Exception {
.expectContent("graph {1[ shape=\"Mrecord\" ]}");

// test local attribute values with prefix
// TODO: activate
// newBuilder().append("graph {1[ shape=pr ]}")
// .assertTextAtCursorPosition(18, "primersite", "promoter",
// "proteasesite", "proteinstab", ",", ";", "]")
// .applyProposal(18, "primersite")
// .expectContent("graph {1[ shape=primersite ]}");
newBuilder().append("graph {1[ shape=pr ]}")
.assertTextAtCursorPosition(18, "primersite", "promoter",
"proteasesite", "proteinstab", ",", ";", "]")
.applyProposal(18, "primersite")
.expectContent("graph {1[ shape=primersite ]}");

// test local attribute values with quotes and prefix
// TODO: activate
// newBuilder().append("graph {1[ shape=\"pro\" ]}")
// .assertTextAtCursorPosition(20, "promoter", "proteasesite",
// "proteinstab")
// .applyProposal(20, "proteinstab")
// .expectContent("graph {1[ shape=\"proteinstab\" ]}");
newBuilder().append("graph {1[ shape=\"pro\" ]}")
.assertTextAtCursorPosition(20, "promoter", "proteasesite",
"proteinstab")
.applyProposal(20, "proteinstab")
.expectContent("graph {1[ shape=\"proteinstab\" ]}");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void testWrongNodeShape() throws Exception {

validationTestHelper.assertError(dotAst,
DotPackage.eINSTANCE.getAttribute(), DotAttributes.SHAPE__N,
"The value 'foo' is not a syntactically correct shape: Mismatched character 'o' expecting 'l'.");
"The value 'foo' is not a syntactically correct shape: No viable alternative at input 'foo'.");

// verify that this is the only reported issue
Assert.assertEquals(1, validationTestHelper.validate(dotAst).size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
* Tamas Miklossy (itemis AG) - initial API and implementation (bug #441352)
*
*******************************************************************************/
grammar org.eclipse.gef.dot.internal.parser.DotShape
grammar org.eclipse.gef.dot.internal.parser.DotShape with org.eclipse.xtext.common.Terminals

generate shape "http://www.eclipse.org/gef/dot/internal/parser/DotShape"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Shape:
shape = (PolygonBasedShape | RecordBasedShape);
Expand Down

0 comments on commit 7896b5e

Please sign in to comment.