Skip to content

Commit

Permalink
exec should be checked in update_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Mar 5, 2024
1 parent f8f04a5 commit c12ff69
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/test/mdx_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,13 @@ let update_errors ~errors t =
match t.Block.value with
| OCaml v -> { t with value = OCaml (update_ocaml_value v) }
| Include
({ file_kind = Fk_ocaml ({ ocaml_value = Some v; _ } as fk); _ } as i) ->
let ocaml_value = Some (update_ocaml_value v) in
let file_kind = Block.Fk_ocaml { fk with ocaml_value } in
{ t with value = Include { i with file_kind } }
({ file_kind = Fk_ocaml ({ ocaml_value = Some v; exec; _ } as fk); _ } as
i) ->
if exec then
let ocaml_value = Some (update_ocaml_value v) in
let file_kind = Block.Fk_ocaml { fk with ocaml_value } in
{ t with value = Include { i with file_kind } }
else t
| _ -> assert false

let update_include ~contents = function
Expand Down Expand Up @@ -360,16 +363,15 @@ let run_exn ~non_deterministic ~silent_eval ~record_backtrace ~syntax ~silent
| Include
{
file_included;
file_kind = Fk_ocaml { part_included; ocaml_value; exec; _ };
file_kind = Fk_ocaml { part_included; ocaml_value; _ };
} ->
assert (syntax <> Some Cram);
let new_block =
update_file_or_block ?root file file_included t part_included
in
let updated_block =
match ocaml_value with
| Some ocaml_value when exec ->
run_ocaml_value new_block ocaml_value
| Some ocaml_value -> run_ocaml_value new_block ocaml_value
| _ -> new_block
in
Block.pp ?syntax ppf updated_block
Expand Down

0 comments on commit c12ff69

Please sign in to comment.