home
/
code
/
tiger.ml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
19284c5
)
Improve test result printing
author
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 24 May 2018 01:39:05 +0000
(21:39 -0400)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Thu, 24 May 2018 01:39:16 +0000
(21:39 -0400)
tiger/src/exe/tiger_tests.ml
patch
|
blob
|
blame
|
history
diff --git
a/tiger/src/exe/tiger_tests.ml
b/tiger/src/exe/tiger_tests.ml
index
e222599
..
b76f368
100644
(file)
--- a/
tiger/src/exe/tiger_tests.ml
+++ b/
tiger/src/exe/tiger_tests.ml
@@
-148,19
+148,20
@@
let tests =
let () =
let bar_sep = String.make 80 '-' in
let bar_end = String.make 80 '=' in
let () =
let bar_sep = String.make 80 '-' in
let bar_end = String.make 80 '=' in
- List.iter tests ~f:(fun (name, code, tokens_expected) ->
+ List.iteri tests ~f:(fun i (name, code, tokens_expected) ->
+ let i = i + 1 in (* Because iteri starts with 0 *)
let open Printf in
let open Printf in
- printf "%s\n
==> Test %S: " bar_sep
name;
+ printf "%s\n
Test %d : %S\n" bar_sep i
name;
let tokens_emitted = tokens_of_code code in
(try
assert (tokens_emitted = tokens_expected);
let tokens_emitted = tokens_of_code code in
(try
assert (tokens_emitted = tokens_expected);
- print_endline "OK";
+ print_endline "
--->
OK";
with Assert_failure _ ->
let tokens_to_string tokens =
String.concat "; " (List.map ~f:Tiger.Parser.Token.to_string tokens)
in
printf
with Assert_failure _ ->
let tokens_to_string tokens =
String.concat "; " (List.map ~f:Tiger.Parser.Token.to_string tokens)
in
printf
- "ERROR\n Expected: %s\n Emitted : %s\n\n"
+ "
--->
ERROR\n Expected: %s\n Emitted : %s\n\n"
(tokens_to_string tokens_expected)
(tokens_to_string tokens_emitted)
);
(tokens_to_string tokens_expected)
(tokens_to_string tokens_emitted)
);
This page took
0.022589 seconds
and
4
git commands to generate.