Skip to content

Commit 017a5b0

Browse files
authored
Merge pull request #73 from testmycode/notests-name
Simplify NoTestsPlugin
2 parents fc9b3e5 + bbcfc53 commit 017a5b0

File tree

8 files changed

+51
-17
lines changed

8 files changed

+51
-17
lines changed

tmc-langs-notests/src/main/java/fi/helsinki/cs/tmc/langs/NoTestsPlugin.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public String getPluginName() {
7474

7575
@Override
7676
public Optional<ExerciseDesc> scanExercise(Path path, String exerciseName) {
77-
TestDesc test = new TestDesc(getExerciseName(path) + "Test", getPoints(path));
77+
TestDesc test = new TestDesc(exerciseName + "Test", getPoints(path));
7878
return Optional.of(
79-
new ExerciseDesc(getExerciseName(path), ImmutableList.<TestDesc>of(test)));
79+
new ExerciseDesc(exerciseName, ImmutableList.<TestDesc>of(test)));
8080
}
8181

8282
private ImmutableList<String> getPoints(Path path) {
@@ -115,11 +115,4 @@ public Map<File, List<ValidationError>> getValidationErrors() {
115115

116116
@Override
117117
public void clean(Path path) {}
118-
119-
private String getExerciseName(Path path) {
120-
if (!getConfiguration(path).isSet("no-tests.exercise_name")) {
121-
return "DefaultName";
122-
}
123-
return getConfiguration(path).get("no-tests.exercise_name").asString();
124-
}
125118
}

tmc-langs-notests/src/test/java/fi/helsinki/cs/tmc/langs/NoTestsPluginTest.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public NoTestsPluginTest() {
2323

2424
@Test
2525
public void readsConfigsProperly() {
26-
Path project = TestUtils.getPath(getClass(), "notests");
27-
System.out.println(project.toAbsolutePath().toString());
26+
Path project = TestUtils.getPath(getClass(), "notests-points");
2827
assertTrue(plugin.isExerciseTypeCorrect(project));
2928
ExerciseDesc desc = plugin.scanExercise(project, "No Tests Exercise").get();
3029
assertEquals(1, desc.tests.size());
@@ -35,4 +34,15 @@ public void readsConfigsProperly() {
3534
RunResult runResult = plugin.runTests(project);
3635
assertEquals(RunResult.Status.PASSED, runResult.status);
3736
}
37+
38+
@Test
39+
public void worksWithoutPoints() {
40+
Path project = TestUtils.getPath(getClass(), "notests");
41+
assertTrue(plugin.isExerciseTypeCorrect(project));
42+
ExerciseDesc desc = plugin.scanExercise(project, "No Tests Exercise").get();
43+
assertEquals(1, desc.tests.size());
44+
assertEquals(0, desc.tests.get(0).points.size());
45+
RunResult runResult = plugin.runTests(project);
46+
assertEquals(RunResult.Status.PASSED, runResult.status);
47+
}
3848
}

tmc-langs-notests/src/test/resources/.Rprofile

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
no-tests:
2+
points:
3+
- 1
4+
- notests
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs
2+
browser.autorefresh.Chrome.INTEGRATED=true
3+
browser.highlightselection.Chrome.INTEGRATED=true
4+
file.reference.01_AsciiArtist-src=src
5+
file.reference.01_AsciiArtist-test=test
6+
files.encoding=UTF-8
7+
site.root.folder=${file.reference.notests-src}
8+
start.file=index.html
9+
test.folder=${file.reference.notests-test}
10+
web.context.root=/notests
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://www.netbeans.org/ns/project/1">
3+
<type>org.netbeans.modules.web.clientproject</type>
4+
<configuration>
5+
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
6+
<name>notests</name>
7+
</data>
8+
</configuration>
9+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Oh noes, more lemmings!</title>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
</head>
8+
<body>
9+
10+
<p>solution space, hello world! :)</p>
11+
12+
</body>
13+
</html>
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
no-tests:
2-
exercise_name: "No Tests Exercise"
3-
points:
4-
- 1
5-
- notests
1+
no-tests: true

0 commit comments

Comments
 (0)