Module Ppx_expect_runtime.For_external

Functions for other libraries to interact with expect tests.

val read_current_test_output_exn : here:Base.Source_code_position.t -> Base.string

If there is an expect test running, perform a consuming read of the current output and return it without any sanitization or backtrace-checking. Note that this is different from the behavior of [%expect.output], which does perform sanitization.

If there is no test running, raise an error that includes here.

val am_running_expect_test : Base.unit -> Base.bool @@ portable
val current_expect_test_name_exn : here:Base.Source_code_position.t -> Base.string Base.option @@ portable

The name of the currently-running expect-test.

If there is no test running, raise an error that includes here.

val default_cr_for_multiple_outputs : output_name:Base.string -> outputs:Base.string Base.list -> Base.string @@ portable
val current_test_has_output_that_does_not_match_exn : here:Base.Source_code_position.t -> Base.bool @@ portable

If the current test has reached a [%expect], [%expect_exact], or [%expect.if_reached] node whose output does not match the expected output, or if it has reached a [%expect.unreachable] node at all, returns true.

If the current test does not meet those criteria, returns false.

If there is no current test running, raises an error including here.

module Stack_frame : sig ... end
module Match_or_mismatch : sig ... end
val push_output_exn : here:Base.Source_code_position.t -> Stack_frame.t @@ portable

Push current output onto a notional stack. Until the output is popped, it will be excluded from read_current_test_output_exn.

val pop_output_exn : here:Base.Source_code_position.t -> Stack_frame.t -> Match_or_mismatch.t @@ portable

Pop the top output stack frame, which must be the given frame. Returns Mismatch if the stack frame is not popped in the correct order.

module Expectation : sig ... end

The functions below are more thoroughly documented in the public interface in Expect_test_helpers_base