Report error count
[tiger.ml.git] / compiler / src / exe / tiger_tests.ml
index 4d86259..e2015e9 100644 (file)
@@ -158,7 +158,11 @@ end = struct
             p_indent 2; p "out: %s" parsing_out; p_ln ();
     );
     p "%s" bar_end; p_ln ();
-    exit !error_count
+    let error_count = !error_count in
+    let clr = (if error_count = 0 then Green else Red) in
+    p "Errors: %s" (color clr (string_of_int error_count)); p_ln ();
+    p "%s" bar_end; p_ln ();
+    exit error_count
 end
 
 let test_cases_from_book =
@@ -354,16 +358,16 @@ let tests_micro_cases =
   ; (let code = "abc[0]" in Test.case code ~code ~out_lexing:[ID "abc"; LBRACK; INT 0; RBRACK])
 
   ; (let code = "abc[0] := foo()" in Test.case code ~code
-                       ~out_lexing:
-                               [ID "abc"; LBRACK; INT 0; RBRACK; ASSIGN; ID "foo"; LPAREN; RPAREN])
+      ~out_lexing:
+        [ID "abc"; LBRACK; INT 0; RBRACK; ASSIGN; ID "foo"; LPAREN; RPAREN])
 
   ; (let code = "abc [5] of nil" in Test.case code ~code
-                       ~out_lexing:
-                               [ID "abc"; LBRACK; INT 5; RBRACK; OF; NIL])
+      ~out_lexing:
+        [ID "abc"; LBRACK; INT 5; RBRACK; OF; NIL])
 
   ; (let code = "f(\"a\", 3, foo)" in Test.case code ~code
-                       ~out_lexing:
-                               [ID "f"; LPAREN; STRING "a"; COMMA; INT 3; COMMA; ID "foo"; RPAREN])
+      ~out_lexing:
+        [ID "f"; LPAREN; STRING "a"; COMMA; INT 3; COMMA; ID "foo"; RPAREN])
   ]
 
 let tests =
This page took 0.019889 seconds and 4 git commands to generate.