@@ -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+
4752let 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\n Actual type = %s\n Expected 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
150160let write_file fname str =
0 commit comments