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
99fa0c6d
Commit
99fa0c6d
authored
Oct 07, 2019
by
Markus Klinik
Browse files
refactor test cases
parent
ac272aee
Changes
2
Hide whitespace changes
Inline
Side-by-side
java-feedback-rascal/src/Util.rsc
View file @
99fa0c6d
...
...
@@ -4,6 +4,7 @@ import lang::java::m3::Core;
import lang::java::m3::AST;
import Relation;
import Set;
import Message;
// Assumption: the given identifier has exactly one name.
str getName(M3 model, loc identifier) = getOneFrom(invert(model.names)[identifier]);
...
...
@@ -19,4 +20,6 @@ set[loc] getMainMethods(M3 model)
// Assumes that there is exactly one Main class in the project
loc getMainClass(M3 model) =
getOneFrom(range(domainR(invert(model.containment), getMainMethods(model))));
\ No newline at end of file
getOneFrom(range(domainR(invert(model.containment), getMainMethods(model))));
set[str] messages(set[Message] errors) = { message | error(message, _) <- errors };
\ No newline at end of file
java-feedback-rascal/test/Assignment02RulesSpec.rsc
View file @
99fa0c6d
...
...
@@ -5,6 +5,7 @@ import IO;
import SpecUtil;
import Assignment02Rules;
import Util;
test bool allGood()
{
...
...
@@ -15,19 +16,19 @@ test bool allGood()
test bool wrongProject()
{
errors = allAssignment02Rules(loadTestProject("assignment01-good"));
return "There should be one class called Gallows" in
{
message
|
error
(message, _) <- errors }
;
return "There should be one class called Gallows" in message
s(
error
s)
;
}
test bool mainHasIO()
{
errors = allAssignment02Rules(loadTestProject("assignment02-main-has-io"));
return "All I/O should happen in the view class" in
{
message
|
error
(message, _) <- errors }
;
return "All I/O should happen in the view class" in message
s(
error
s)
;
}
test bool noUseStringBuilder()
{
errors = allAssignment02Rules(loadTestProject("assignment02-no-use-stringbuilder"));
return "Gallows should use StringBuilder" in
{
message
|
error
(message, _) <- errors }
;
return "Gallows should use StringBuilder" in message
s(
error
s)
;
}
// Main class creates a Scanner and passes it on to the View class. This should be allowed.
...
...
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