package ppx_expect

  1. Overview
  2. Docs

Functions exported for use in toplevel expect tests

val expectation_of_t : Test_node.t -> Base.string Base.option

The string that this test node "expects" if it is an [%expect] or [%expect_exact] node. None if it is an [%expect.unreachable].

val record_and_return_number_of_lines_in_correction : expect_node_formatting:Ppx_expect_runtime__.Types.Expect_node_formatting.t -> failure_ref:Base.bool Base.ref -> test_output_raw:Base.string -> Test_node.t -> Base.int Base.option

Records the test result of receiving the raw test output test_output_raw. If the test "fails" (the output is not considered to match the expectation), sets failure_ref := true and returns the number of lines that will be spanned by inserted correction. If the test "passes", does not update failure_ref and returns None.

val loc : Test_node.t -> Ppx_expect_runtime__.Types.Compact_loc.t

The location of the AST extension node associated with this test.

val to_diffs : cr_for_multiple_outputs: (output_name:Base.string -> outputs:Base.string Base.list -> Base.string) -> expect_node_formatting:Ppx_expect_runtime__.Types.Expect_node_formatting.t -> original_file_contents:Base.string -> Test_node.t -> (Ppx_expect_runtime__.Types.Compact_loc.t * Base.string) Base.list

Retrieves the corrections that need to be made to the original source file based on the test results collected in this test node so far. Returns a list of pairs containing the location of the character range to overwrite and the string to write at that location.

OCaml

Innovation. Community. Security.