I'm newbie in the world of Xtend and Unit Test.
I'm testing my grammar, and I want to write a test which test the validation of it.
Here a simple example:
MyGrammar:
Domainmodel: entities+=Entity* ;
Entity:
'ENTITY' name=ID 'END_ENTITY';
Now suppose I've also inserted this validation rule:
@Check
public void checkNoJack(Entity e){
if (e.getName().equals("Jack")){
error("This name is not valid.",null);
}
}
So, if I try to write:
I will receive an error.
But, if I try this Xtend test:
@Test
def void example() throws Exception{
parserHelper.parse("ENTITY Jack END_ENTITY")
}
all will go right.
How can I consider validation rules in my tests?
Very thank you!
[Updated on: Thu, 29 November 2012 09:40]
Report message to a moderator