home
/
code
/
tiger.ml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve final pass/fail indicator
[tiger.ml.git]
/
compiler
/
src
/
lib
/
tiger
/
tiger_test.ml
diff --git
a/compiler/src/lib/tiger/tiger_test.ml
b/compiler/src/lib/tiger/tiger_test.ml
index
89e317f
..
89376a3
100644
(file)
--- a/
compiler/src/lib/tiger/tiger_test.ml
+++ b/
compiler/src/lib/tiger/tiger_test.ml
@@
-135,7
+135,7
@@
let p_ln = print_newline
let p_indent n = p "%s" (indent n)
let run tests =
let p_indent n = p "%s" (indent n)
let run tests =
- let
error
_count = ref 0 in
+ let
failure
_count = ref 0 in
let run_pass ~f ~input ~expect_output ~is_error_expected =
let output_status = "n/a" in
let output_value = None in
let run_pass ~f ~input ~expect_output ~is_error_expected =
let output_status = "n/a" in
let output_value = None in
@@
-146,10
+146,10
@@
let run tests =
| Tiger_error.T e when is_error_expected e ->
status_pass () ~info:(Tiger_error.to_string e)
| Tiger_error.T e ->
| Tiger_error.T e when is_error_expected e ->
status_pass () ~info:(Tiger_error.to_string e)
| Tiger_error.T e ->
- incr
error
_count;
+ incr
failure
_count;
status_fail () ~info:(Tiger_error.to_string e)
| e ->
status_fail () ~info:(Tiger_error.to_string e)
| e ->
- incr
error
_count;
+ incr
failure
_count;
status_fail () ~info:(Printexc.to_string e)
)
in
status_fail () ~info:(Printexc.to_string e)
)
in
@@
-158,7
+158,7
@@
let run tests =
, output_value
)
| Error info ->
, output_value
)
| Error info ->
- incr
error
_count;
+ incr
failure
_count;
( status_fail ~info ()
, output_status
, output_value
( status_fail ~info ()
, output_status
, output_value
@@
-174,7
+174,7
@@
let run tests =
| Some true ->
status_pass ()
| Some false ->
| Some true ->
status_pass ()
| Some false ->
- incr
error
_count;
+ incr
failure
_count;
status_fail ()
in
let output_value = Some produced in
status_fail ()
in
let output_value = Some produced in
@@
-223,8
+223,11
@@
let run tests =
p_indent 2; p "out: %s" stat_semant_out_cmp; p_ln ();
);
p "%s" bar_end; p_ln ();
p_indent 2; p "out: %s" stat_semant_out_cmp; p_ln ();
);
p "%s" bar_end; p_ln ();
- 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"
+ (match !failure_count with
+ | 0 -> status_pass ()
+ | _ -> status_fail () ~info:(s "%d failures" !failure_count)
+ );
+ p_ln ();
p "%s" bar_end; p_ln ();
p "%s" bar_end; p_ln ();
- exit
failures
+ exit
!failure_count
This page took
0.042803 seconds
and
4
git commands to generate.