Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 9796334

Browse files
authored
Merge pull request #316 from tmc-cli/cache-test-results-jclc
tmc submit -c automatically sends all completed exercises
2 parents b89a773 + 4130372 commit 9796334

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/main/java/fi/helsinki/cs/tmc/cli/command/RunTestsCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ public void run(CommandLine args, Io io) {
107107
passed += ResultPrinter.passedTests(runResult.testResults);
108108
exercise.setAttempted(true);
109109
if (runResult.status == PASSED && !exercise.isCompleted()) {
110+
// add exercise to locally tested exercises
110111
if (!info.getLocalCompletedExercises().contains(exercise.getName())) {
111112
info.getLocalCompletedExercises().add(exercise.getName());
112113
}
114+
} else {
115+
if (info.getLocalCompletedExercises().contains(exercise.getName())) {
116+
info.getLocalCompletedExercises().remove(exercise.getName());
117+
}
113118
}
114119
}
115120
CourseInfoIo.save(info, workDir.getConfigFile());

src/main/java/fi/helsinki/cs/tmc/cli/command/SubmitCommand.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public class SubmitCommand extends AbstractCommand {
4040
public void getOptions(Options options) {
4141
options.addOption("a", "all", false, "Show all test results");
4242
options.addOption("d", "details", false, "Show detailed error message");
43-
options.addOption("c", "completed", false, "Only exercises that have passed all tests");
43+
options.addOption("c", "completed", false,
44+
"Filter out exercises that haven't been locally tested");
4445
}
4546

4647
@Override
@@ -68,6 +69,7 @@ public void run(CommandLine args, Io io) {
6869

6970
List<String> exerciseNames;
7071
if (args.hasOption("c")) {
72+
workDir.addPath(workDir.getCourseDirectory());
7173
exerciseNames = workDir.getExerciseNames(true, true, false);
7274
} else {
7375
exerciseNames = workDir.getExerciseNames();

src/test/java/fi/helsinki/cs/tmc/cli/command/RunTestsCommandTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static org.junit.Assert.assertFalse;
44
import static org.junit.Assert.assertNotNull;
55
import static org.junit.Assert.assertTrue;
6-
76
import static org.mockito.Matchers.anyObject;
87
import static org.mockito.Mockito.doReturn;
98
import static org.mockito.Mockito.mock;
@@ -133,5 +132,4 @@ public void worksInCourseDirectoryIfExerciseIsGiven() {
133132
app.run(args);
134133
assertTrue(io.out().contains("Testing: " + EXERCISE1_NAME));
135134
}
136-
137135
}

0 commit comments

Comments
 (0)