Module Ppx_expect_runtime.Make_test_block

Parameters

Signature

val read_test_output_no_backtrace_check : Base.unit -> Base.string

Read test output, passing it through the configured sanitization function but not checking for backtraces. Equivalent to [%expect.output].

Consuming read.

Given a test id:

  • Look up the Test_node.t with that id
  • Perform a consuming read of current test output, performing sanitization and checking for backtraces
  • Compare the consumed output with the output expected by the associated Test_node.t
  • Record the test outcome in the associated Test_node.t
  • If the test failed, set the current Test_block's fail ref to true (so that the test harness will be informed of a failure at the conclusion of this let%expect_test block)
val run_test_without_commiting : test_id:Ppx_expect_runtime_types.Expectation_id.t -> Base.unit

Given a test id:

  • Look up the Test_node.t with that id
  • Perform a consuming read of current test output, performing sanitization and checking for backtraces
  • Compare the consumed output with the output expected by the associated Test_node.t

Unlike run_test, run_test_without_commiting does not automatically record the test outcome or set the fail ref. Instead, user code must call exactly one of For_external.Expectation.commit or For_external.Expectation.skip below to commit or ignore the test result.

Execute a single let%expect_test block through Ppx_inline_test_lib.test.

  • Assert that the test is defined in the currently-executing file.
  • Generate two implicit Test_node.ts representing trailing output (expectation that there is none) and uncaught exception (expectation that there is none if expected_exn = None, or else that the test raises with expected_exn).
  • Add the explicit Test_node.ts in expectations (those actually present in the test body), as well as the two implicit Test_node.ts described above, into the global table of Test_node.ts.
  • Run the callback and the tests for trailing output and uncaught exceptions, accumulating the results of each reached "expectation" inside the corresponding Test_node.t.
  • After the callback finishes, if any of the expectations do not match, inform the inline testing harness that the test has "failed".