Skip to content

Commit

Permalink
Merge pull request #316 from tmc-cli/cache-test-results-jclc
Browse files Browse the repository at this point in the history
tmc submit -c automatically sends all completed exercises
  • Loading branch information
juvester authored Jun 22, 2016
2 parents b89a773 + 4130372 commit 9796334
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ public void run(CommandLine args, Io io) {
passed += ResultPrinter.passedTests(runResult.testResults);
exercise.setAttempted(true);
if (runResult.status == PASSED && !exercise.isCompleted()) {
// add exercise to locally tested exercises
if (!info.getLocalCompletedExercises().contains(exercise.getName())) {
info.getLocalCompletedExercises().add(exercise.getName());
}
} else {
if (info.getLocalCompletedExercises().contains(exercise.getName())) {
info.getLocalCompletedExercises().remove(exercise.getName());
}
}
}
CourseInfoIo.save(info, workDir.getConfigFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public class SubmitCommand extends AbstractCommand {
public void getOptions(Options options) {
options.addOption("a", "all", false, "Show all test results");
options.addOption("d", "details", false, "Show detailed error message");
options.addOption("c", "completed", false, "Only exercises that have passed all tests");
options.addOption("c", "completed", false,
"Filter out exercises that haven't been locally tested");
}

@Override
Expand Down Expand Up @@ -68,6 +69,7 @@ public void run(CommandLine args, Io io) {

List<String> exerciseNames;
if (args.hasOption("c")) {
workDir.addPath(workDir.getCourseDirectory());
exerciseNames = workDir.getExerciseNames(true, true, false);
} else {
exerciseNames = workDir.getExerciseNames();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -133,5 +132,4 @@ public void worksInCourseDirectoryIfExerciseIsGiven() {
app.run(args);
assertTrue(io.out().contains("Testing: " + EXERCISE1_NAME));
}

}

0 comments on commit 9796334

Please sign in to comment.