X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=compiler%2Fsrc%2Fexe%2Ftiger_tests.ml;h=6f1ce3b655d5e3754ac6a633cd4bee6d25848c6b;hb=5f295d042a33a89b68a50d80e4ce18e3f2b1cfe6;hp=4d86259c6dbfc39a65f7530b13df1ae7ac354c65;hpb=2c754e82103d61fdadd085a0408880c6c960e0af;p=tiger.ml.git diff --git a/compiler/src/exe/tiger_tests.ml b/compiler/src/exe/tiger_tests.ml index 4d86259..6f1ce3b 100644 --- a/compiler/src/exe/tiger_tests.ml +++ b/compiler/src/exe/tiger_tests.ml @@ -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 failures = !error_count in + let clr = (if failures = 0 then Green else Red) in + p "Failures: %s" (color clr (string_of_int failures)); p_ln (); + p "%s" bar_end; p_ln (); + exit failures 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 =