Skip to content

Commit

Permalink
added test case for verifying required vs optional values #162
Browse files Browse the repository at this point in the history
  • Loading branch information
abstratt committed Feb 16, 2019
1 parent 97c3447 commit ba595d5
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.abstratt.mdd.frontend.core.ReturnStatementRequired;
import com.abstratt.mdd.frontend.core.ReturnValueNotExpected;
import com.abstratt.mdd.frontend.core.ReturnValueRequired;
import com.abstratt.mdd.frontend.core.TypeMismatch;
import com.abstratt.mdd.frontend.core.UnknownAttribute;
import com.abstratt.mdd.frontend.core.UnknownOperation;
import com.abstratt.mdd.frontend.core.UnknownRole;
Expand Down Expand Up @@ -55,6 +56,7 @@ public ActivityTests(String name) {
structure += " attribute zoo : Integer;\n";
structure += " attribute fred : Integer;\n";
structure += " attribute realValue : Double;\n";
structure += " attribute optionalRealValue : Double[0,1];\n";
structure += " static attribute staticZoo : Integer;\n";
structure += " readonly static attribute K : Integer := 42;\n";
structure += " end;\n";
Expand Down Expand Up @@ -576,6 +578,20 @@ public void testWriteAttribute() throws CoreException {
source += "end.";
parseAndCheck(structure, source);
}
//TODO-RC in preparation for validating required vs optional values
public void _testWriteRequiredAttributeWithOptionalValue() throws CoreException {
String source;
source = "model simple;\n";
source += "operation SimpleClass.bar;\n";
source += "begin\n";
source += "self.realValue := self.optionalRealValue;";
source += "end;\n";
source += "end.";
IProblem[] problems = parse(structure, source);
assertEquals(1, problems.length);
TypeMismatch typeMismatch = assertExpectedProblem(TypeMismatch.class, problems);
}


public void testWriteClassAttribute() throws CoreException {
String source;
Expand Down

0 comments on commit ba595d5

Please sign in to comment.