Commit 7c8a3bb9 authored by Markus Klinik's avatar Markus Klinik
Browse files

refactor test cases

parent 3230cb9e
......@@ -5,6 +5,7 @@ import lang::java::m3::Core;
import ClassHierarchy;
import SpecUtil;
import Util;
test bool findInterfaceThatExists()
{
......@@ -61,7 +62,7 @@ test bool interfaceExtendsInterfaceUnknownInterface()
errors = extendsInterface(model, "Foobar", "MyInterface");
return
{ "There should be one interface called Foobar" }
<= { message | error(message, _) <- errors };
<= messages(errors);
}
test bool interfaceDoesntExtendInterface()
......@@ -70,7 +71,7 @@ test bool interfaceDoesntExtendInterface()
errors = extendsInterface(model, "MyOtherInterface", "MyInterface");
return
{ "MyOtherInterface should extend MyInterface" }
<= { message | error(message, _) <- errors };
<= messages(errors);
}
test bool classExtendsClass()
......@@ -85,7 +86,7 @@ test bool unknownClass()
errors = extendsClass(model, "Baa", "A");
return
{ "There should be one class called Baa" }
<= { message | error(message, _) <- errors };
<= messages(errors);
}
test bool classDoesntExtendClass()
......@@ -94,7 +95,7 @@ test bool classDoesntExtendClass()
errors = extendsClass(model, "C", "A");
return
{ "C should extend A" }
<= { message | error(message, _) <- errors };
<= messages(errors);
}
test bool classImplementsInterface()
......@@ -109,5 +110,5 @@ test bool classDoesntImplementInterface()
errors = implementsInterface(model, "A", "MyInterface");
return
{ "A should implement MyInterface" }
<= { message | error(message, _) <- errors };
<= messages(errors);
}
......@@ -51,7 +51,7 @@ test bool projectWithImproperConstantName()
test bool twoMains()
{
errors = ps_dedicated_main(loadTestProject("assignment01-two-mains"));
return "There should be one main method" in { message | error(message, _) <- errors };
return "There should be one main method" in messages(errors);
}
test bool explicitAccessModifiersGood()
......@@ -65,7 +65,7 @@ test bool explicitAccessModifiersMissing()
return
size(errors) == 2 &&
{ "Always explicitly specify access modifiers: public, protected, or private" } <=
{ message | error(message,_) <- errors };
messages(errors);
}
test bool nonFinalPublicAttribute()
......@@ -73,7 +73,7 @@ test bool nonFinalPublicAttribute()
errors = ps_public_attributes(loadTestProject("assignment01-non-final-public"));
return
{ "Only final attributes may be public" } <=
{ message | error(message,_) <- errors };
messages(errors);
}
test bool constructorMissing()
......@@ -82,5 +82,5 @@ test bool constructorMissing()
return
size(errors) == 1 && // main class has no constructor, but that's okay
{ "All classes should have at least one constructor" } <=
{ message | error(message,_) <- errors };
messages(errors);
}
\ No newline at end of file
Supports Markdown
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