Commit eb45b962 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: fixed tests and markers


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent ff70f0d4
...@@ -50,14 +50,15 @@ type class @trait BadTraitClass { ...@@ -50,14 +50,15 @@ type class @trait BadTraitClass {
public var integer m_int := 0; public var integer m_int := 0;
public timer Timer; public timer Timer;
create (charstring pl_str) {
var float vl_float := 1.0;
}
private function f_valid(integer pl_int); private function f_valid(integer pl_int);
private function f_invalid(integer pl_int) { private function f_invalid(integer pl_int) {
// this should not be here // this should not be here
} }
create (charstring pl_str) {
var float vl_float := 1.0;
}
} }
type class SuperClass { type class SuperClass {
...@@ -220,7 +221,7 @@ type class ClassWithPrivateExt extends ClassWithPrivate { ...@@ -220,7 +221,7 @@ type class ClassWithPrivateExt extends ClassWithPrivate {
} }
} }
// function with class parameter // function with class parameter
function f_class_param(FuncClass pl_fun) { function f_class_param(FuncClass pl_fun) {
var integer vl_int := pl_fun.f_dummy(1); // type mismatch var integer vl_int := pl_fun.f_dummy(1); // type mismatch
var charstring vl_chr := pl_fun.f_get_one(); // correct var charstring vl_chr := pl_fun.f_get_one(); // correct
......
...@@ -45,7 +45,7 @@ public class OOP_Semantic_tests { ...@@ -45,7 +45,7 @@ public class OOP_Semantic_tests {
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() { private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
//oopNegativeSemanticTest.ttcn //oopNegativeSemanticTest.ttcn
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(31); ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(33);
int lineNum = 28; int lineNum = 28;
markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 9; lineNum += 9;
...@@ -62,9 +62,10 @@ public class OOP_Semantic_tests { ...@@ -62,9 +62,10 @@ public class OOP_Semantic_tests {
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
markersToCheck.add(new MarkerToCheck("Trait classes can only declare methods", lineNum++, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Trait classes can only declare methods", lineNum++, IMarker.SEVERITY_ERROR));
} }
lineNum += 2; markersToCheck.add(new MarkerToCheck("Trait classes cannot have a constructor", ++lineNum, IMarker.SEVERITY_ERROR));
lineNum += 5;
markersToCheck.add(new MarkerToCheck("Trait method cannot have a function body", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Trait method cannot have a function body", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 20; lineNum += 17;
markersToCheck.add(new MarkerToCheck("Reference to non-existent field `nonexist' in union template for type `@classesNegativeSemantic.MyUnion'", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Reference to non-existent field `nonexist' in union template for type `@classesNegativeSemantic.MyUnion'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 4; lineNum += 4;
markersToCheck.add(new MarkerToCheck("Local Definiton `vl_b' collides with definition inherited from class type `@classesNegativeSemantic.SubClass'", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Local Definiton `vl_b' collides with definition inherited from class type `@classesNegativeSemantic.SubClass'", lineNum, IMarker.SEVERITY_ERROR));
...@@ -82,7 +83,9 @@ public class OOP_Semantic_tests { ...@@ -82,7 +83,9 @@ public class OOP_Semantic_tests {
markersToCheck.add(new MarkerToCheck("A class cannot be both abstract and trait", ++lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("A class cannot be both abstract and trait", ++lineNum, IMarker.SEVERITY_ERROR));
lineNum += 12; lineNum += 12;
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `charstring' was expected instead of `integer'", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `charstring' was expected instead of `integer'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 15; lineNum += 5;
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `integer' was expected instead of `float'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 10;
markersToCheck.add(new MarkerToCheck("`super' reference is only valid inside class bodies", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("`super' reference is only valid inside class bodies", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 10; lineNum += 10;
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `integer' was expected instead of `charstring'", lineNum, IMarker.SEVERITY_ERROR)); markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `integer' was expected instead of `charstring'", lineNum, IMarker.SEVERITY_ERROR));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment