From 06d169c440fa319efc3e37ebc40d671aa8a96f88 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Mon, 25 Feb 2019 07:08:13 -0800 Subject: [PATCH] [sledge] Add Trace.fail Reviewed By: mbouaziz Differential Revision: D14075528 fbshipit-source-id: 0f068f063 --- sledge/src/trace/trace.ml | 8 ++++++++ sledge/src/trace/trace.mli | 3 +++ 2 files changed, 11 insertions(+) diff --git a/sledge/src/trace/trace.ml b/sledge/src/trace/trace.ml index f0857f72d..3990ad6a7 100644 --- a/sledge/src/trace/trace.ml +++ b/sledge/src/trace/trace.ml @@ -148,5 +148,13 @@ let report fmt = Format.fprintf fs "@\n@[<2>| " ; Format.kfprintf (fun fs -> Format.fprintf fs "@]" ; false) fs fmt +let fail fmt = + Format.fprintf fs "@\n@[<2>| " ; + Format.kfprintf + (fun fs -> + Format.fprintf fs "@]@." ; + assert false ) + fs fmt + let%test_module _ = (module struct let () = init ~margin:70 ~config:!config () end) diff --git a/sledge/src/trace/trace.mli b/sledge/src/trace/trace.mli index f8aa844e0..389d2edc5 100644 --- a/sledge/src/trace/trace.mli +++ b/sledge/src/trace/trace.mli @@ -54,3 +54,6 @@ val flush : unit -> unit val report : ('a, Formatter.t, unit, bool) format4 -> 'a (** Emit a message at the current indentation level, and return [false]. *) + +val fail : ('a, Formatter.t, unit, _) format4 -> 'a +(** Emit a message at the current indentation level, and [assert false]. *)