Commits

Anonymous committed 31917f5

unified repl outputters

  • Participants
  • Parent commits ef1e565

Comments (0)

Files changed (1)

reporters/repl.scm

   (import chicken scheme data-structures csi)
   (use veritas veritas-base-reporter fmt fmt-color)
 
+  (define (colorize format)
+    (if (reporter-use-colors?) format identity))
+
   (define (print-success result out)
-    (if (reporter-use-colors?)
-        (print-success/colors result out)
-        (print-success/nocolors result out)))
+    (fmt out ((colorize fmt-green) ((colorize fmt-bold) (cat (current-success-designator) "  ")))))
 
   (define (print-failure result out)
-    (if (reporter-use-colors?)
-        (print-failure/colors result out)
-        (print-failure/nocolors result out)))
-
-  (define (print-success/colors result out)
-    (fmt out (fmt-green (fmt-bold (cat (current-success-designator) "  ")))))
-
-  (define (print-success/nocolors result out)
-    (display (conc (current-success-designator) "  ") out))
-
-  (define (print-failure/colors result out)
-    (fmt out (fmt-red (fmt-bold (cat (current-failure-designator) "  FAILED"))) nl)
-    (fmt out (fmt-red (verification-result-message result))))
-
-  (define (print-failure/nocolors result out)
-    (display (conc (current-failure-designator) "  ") out)
-    (display (verification-result-message result) out))
+    (fmt out ((colorize fmt-red) ((colorize fmt-bold) (cat (current-failure-designator) "  FAILED"))) nl)
+    (fmt out ((colorize fmt-red) (verification-result-message result))))
 
   (define-record-printer (verification-result result out)
     (if (verification-failure? result)