Prechádzať zdrojové kódy

Fix ANSI redraw eating last log line

Feoramund 1 rok pred
rodič
commit
a1c5bebac7
2 zmenil súbory, kde vykonal 12 pridanie a 2 odobranie
  1. 5 1
      core/testing/reporting.odin
  2. 7 1
      core/testing/runner.odin

+ 5 - 1
core/testing/reporting.odin

@@ -271,7 +271,11 @@ needs_to_redraw :: proc(report: Report) -> bool {
 }
 
 draw_status_bar :: proc(w: io.Writer, threads_string: string, total_done_count, total_test_count: int) {
-	if total_done_count != total_test_count {
+	if total_done_count == total_test_count {
+		// All tests are done; print a blank line to maintain the same height
+		// of the progress report.
+		fmt.wprintln(w)
+	} else {
 		fmt.wprintfln(w,
 			"%s % 4i/% 4i :: total",
 			threads_string,

+ 7 - 1
core/testing/runner.odin

@@ -583,8 +583,14 @@ runner :: proc(internal_tests: []Internal_Test) -> bool {
 
 	finished_in := time.since(start_time)
 
+	when !FANCY_OUTPUT {
+		// One line to space out the results, since we don't have the status
+		// bar in plain mode.
+		fmt.wprintln(batch_writer)
+	}
+
 	fmt.wprintf(batch_writer,
-		"\nFinished %i test%s in %v.",
+		"Finished %i test%s in %v.",
 		total_done_count,
 		"" if total_done_count == 1 else "s",
 		finished_in)