Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pieter Koopman
Personal Prof public repository
Commits
7c8a3bb9
Commit
7c8a3bb9
authored
Oct 07, 2019
by
Markus Klinik
Browse files
refactor test cases
parent
3230cb9e
Changes
2
Hide whitespace changes
Inline
Side-by-side
java-feedback-rascal/test/ClassHierarchySpec.rsc
View file @
7c8a3bb9
...
...
@@ -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 }
;
<= message
s(
error
s)
;
}
test bool interfaceDoesntExtendInterface()
...
...
@@ -70,7 +71,7 @@ test bool interfaceDoesntExtendInterface()
errors = extendsInterface(model, "MyOtherInterface", "MyInterface");
return
{ "MyOtherInterface should extend MyInterface" }
<=
{
message
|
error
(message, _) <- errors }
;
<= message
s(
error
s)
;
}
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 }
;
<= message
s(
error
s)
;
}
test bool classDoesntExtendClass()
...
...
@@ -94,7 +95,7 @@ test bool classDoesntExtendClass()
errors = extendsClass(model, "C", "A");
return
{ "C should extend A" }
<=
{
message
|
error
(message, _) <- errors }
;
<= message
s(
error
s)
;
}
test bool classImplementsInterface()
...
...
@@ -109,5 +110,5 @@ test bool classDoesntImplementInterface()
errors = implementsInterface(model, "A", "MyInterface");
return
{ "A should implement MyInterface" }
<=
{
message
|
error
(message, _) <- errors }
;
<= message
s(
error
s)
;
}
java-feedback-rascal/test/CodingRulesSpec.rsc
View file @
7c8a3bb9
...
...
@@ -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 message
s(
error
s)
;
}
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
}
;
message
s(
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
}
;
message
s(
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
}
;
message
s(
errors
)
;
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment