Skip to content

Commit 62b29ad

Browse files
committed
Print <COMPLETEDIN::> on failures
1 parent 2e599a0 commit 62b29ad

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cw_example_extraction/SolutionTest.v

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Extract Inductive nat => "int"
1010
Extract Constant plus => "( + )".
1111
Extract Constant mult => "( * )".
1212

13+
CWGroup "Group".
14+
1315
CWTest "Successful Extraction Test".
1416

1517
Extraction "factorial.ml" Solution.factorial.
@@ -38,3 +40,4 @@ let () =
3840

3941
CWEndTest.
4042

43+
CWEndGroup.

src/coq_cw.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ let begin_group tag name =
4444
group_stack := mk_group tag t :: !group_stack;
4545
display tag name
4646

47+
let rec end_all_groups () =
48+
match !group_stack with
49+
| [] -> ()
50+
| {tag = tag} :: gs -> end_group tag; end_all_groups ()
51+
4752
let locate r =
4853
try
4954
let gr = Smartlocate.locate_global_with_alias r in
@@ -63,6 +68,7 @@ let test_type ?(msg = "Type Test") r c_ty =
6368
let p_expected = Printer.pr_econstr_env env sigma expected_ty in
6469
failed (Printf.sprintf "%s\nActual type = %s\nExpected type = %s"
6570
msg (string_of_ppcmds p_actual) (string_of_ppcmds p_expected));
71+
end_all_groups ();
6672
CErrors.user_err (str "Incorrect Type: " ++ Printer.pr_econstr_env env sigma tm)
6773

6874
(* Based on the PrintAssumptions code from vernac/vernacentries.ml *)
@@ -101,6 +107,7 @@ let test_axioms ?(msg = "Axiom Test") c_ref ax_refs =
101107
if Printer.ContextObjectSet.mem t ax_set then ()
102108
else begin
103109
failed msg;
110+
end_all_groups ();
104111
CErrors.user_err (str "Prohibited Axiom: " ++ pr_axiom env sigma ax ty)
105112
end
106113
| _ -> ()
@@ -117,6 +124,7 @@ let test_file_size ?(fname = solution_file) size =
117124
else begin
118125
let msg = Format.sprintf "Size %d >= %d" stats.Unix.st_size size in
119126
failed msg;
127+
end_all_groups ();
120128
CErrors.user_err (str msg)
121129
end
122130
with Unix.Unix_error _ -> CErrors.user_err (str ("Bad file name: " ^ fname))
@@ -134,6 +142,7 @@ let test_file_regex ?(fname = solution_file) match_flag regex =
134142
passed "OK"
135143
else begin
136144
failed "Bad match";
145+
end_all_groups ();
137146
CErrors.user_err (str "Bad match")
138147
end
139148

@@ -145,6 +154,7 @@ let run_system_command ?err_msg args =
145154
| _ ->
146155
let msg = match err_msg with None -> "Failed" | Some msg -> msg in
147156
failed msg;
157+
end_all_groups ();
148158
CErrors.user_err (str msg)
149159

150160
let write_file fname str =

0 commit comments

Comments
 (0)