123456789101112131415161718192021222324252627282930313233343536373839404142434445open!Core_kernelmoduleCaml_embed=Ecaml_value.Caml_embedmoduleEcaml_callback=Ecaml_value.Ecaml_callbackmoduleForm=Ecaml_value.FormmoduleFuncall=Ecaml_value.FuncallmoduleFunction=Ecaml_value.FunctionmoduleGenerated_bindings=Ecaml_value.Generated_bindingsmoduleValue=Ecaml_value.ValuemoduleValueable=Ecaml_value.Valueableletmessage=Ecaml_value.messageletmessagef=Ecaml_value.messagefletmessage_s=Ecaml_value.message_sincludeComposition_infixletinitialize_module=Printexc.record_backtracetrue;Sexp.of_int_style:=`Underscores;;letconcat=String.concatletdebug=falseletprint_s=Expect_test_helpers_kernel.print_sleteprint_s=Core_kernel.Debug.eprint_sletraise_strings=raise_s[%sexp(String.strip(concats):string)]letsec_ns=Time_ns.Span.of_sec(* Buffer local variables can cause emacs to segfault when gc'ed. So we use these
functions to prevent such variables from being gc'ed. See thread "nasty ecaml bug" or
bug report http://lists.gnu.org/archive/html/bug-gnu-emacs/2017-10/msg01453.html.
This workaround can cause a memory leak in theory, but in practice, they are used very
little. *)letadd_gc_root=letgc_roots=Stack.create()infunf->Stack.pushgc_rootsf;;letadd_gc_roota=add_gc_root(fun()->Gc.keep_alivea)type'aopaque_in_test='aletsexp_of_opaque_in_testsexp_of_aa=ifam_running_testthen[%sexp"_"]else[%sexp(a:a)];;