@@ -381,7 +381,7 @@ impl AppState {
381
381
382
382
// Return the exercise index of the first pending exercise found.
383
383
fn check_all_exercises ( & self , stdout : & mut StdoutLock ) -> Result < Option < usize > > {
384
- stdout. write_all ( RERUNNING_ALL_EXERCISES_MSG ) ?;
384
+ stdout. write_all ( FINAL_CHECK_MSG ) ?;
385
385
let n_exercises = self . exercises . len ( ) ;
386
386
387
387
let status = thread:: scope ( |s| {
@@ -441,7 +441,10 @@ impl AppState {
441
441
/// Mark the current exercise as done and move on to the next pending exercise if one exists.
442
442
/// If all exercises are marked as done, run all of them to make sure that they are actually
443
443
/// done. If an exercise which is marked as done fails, mark it as pending and continue on it.
444
- pub fn done_current_exercise ( & mut self , stdout : & mut StdoutLock ) -> Result < ExercisesProgress > {
444
+ pub fn done_current_exercise < const CLEAR_BEFORE_FINAL_CHECK : bool > (
445
+ & mut self ,
446
+ stdout : & mut StdoutLock ,
447
+ ) -> Result < ExercisesProgress > {
445
448
let exercise = & mut self . exercises [ self . current_exercise_ind ] ;
446
449
if !exercise. done {
447
450
exercise. done = true ;
@@ -453,6 +456,12 @@ impl AppState {
453
456
return Ok ( ExercisesProgress :: NewPending ) ;
454
457
}
455
458
459
+ if CLEAR_BEFORE_FINAL_CHECK {
460
+ clear_terminal ( stdout) ?;
461
+ } else {
462
+ stdout. write_all ( b"\n " ) ?;
463
+ }
464
+
456
465
if let Some ( pending_exercise_ind) = self . check_all_exercises ( stdout) ? {
457
466
stdout. write_all ( b"\n \n " ) ?;
458
467
@@ -482,8 +491,7 @@ impl AppState {
482
491
483
492
const BAD_INDEX_ERR : & str = "The current exercise index is higher than the number of exercises" ;
484
493
const STATE_FILE_HEADER : & [ u8 ] = b"DON'T EDIT THIS FILE!\n \n " ;
485
- const RERUNNING_ALL_EXERCISES_MSG : & [ u8 ] = b"
486
- All exercises seem to be done.
494
+ const FINAL_CHECK_MSG : & [ u8 ] = b"All exercises seem to be done.
487
495
Recompiling and running all exercises to make sure that all of them are actually done.
488
496
" ;
489
497
const FENISH_LINE : & str = "+----------------------------------------------------+
0 commit comments