Module Expect_test_helpers_core
include module type of sig ... end
module type With_comparator = Expect_test_helpers_base__.Expect_test_helpers_base_intf.With_comparator
module CR = Expect_test_helpers_base.CR
module Sexp_style = Expect_test_helpers_base.Sexp_style
val hide_positions_in_string : Base.string -> Base.string
val hide_temp_files_in_string : Base.string -> Base.string
val sexp_to_string : ?hide_positions:Base.bool -> Base.Sexp.t -> Base.string
val replace : Base.string -> pattern:Base.string -> with_:Base.string -> Base.string
val replace_s : Base.Sexp.t -> pattern:Base.string -> with_:Base.string -> Base.Sexp.t
val print_s : ?hide_positions:Base.bool -> Base.Sexp.t -> Base.unit
val print_string : ?hide_positions:Base.bool -> Base.string -> Base.unit
val print_endline : ?hide_positions:Base.bool -> Base.string -> Base.unit
val print_cr : ?cr:CR.t -> ?hide_positions:Base.bool -> Base.Source_code_position.t -> Base.Sexp.t -> Base.unit
val require : ?cr:CR.t -> ?hide_positions:Base.bool -> ?if_false_then_print_s:Base.Sexp.t Base.Lazy.t -> Base.Source_code_position.t -> Base.bool -> Base.unit
val require_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?if_false_then_print_s:Base.Sexp.t Base.Lazy.t -> ?message:Base.string -> Base.Source_code_position.t -> (module With_equal with type t = 'a) -> 'a -> 'a -> Base.unit
val require_compare_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?message:Base.string -> Base.Source_code_position.t -> (module With_compare with type t = 'a) -> 'a -> 'a -> Base.unit
val require_sets_are_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?names:(Base.string * Base.string) -> Base.Source_code_position.t -> (module With_comparator with type comparator_witness = 'cmp and type t = 'elt) -> ('elt, 'cmp) Base.Set.t -> ('elt, 'cmp) Base.Set.t -> Base.unit
val show_raise : ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> (Base.unit -> 'a) -> Base.unit
val require_does_not_raise : ?cr:CR.t -> ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> Base.Source_code_position.t -> (Base.unit -> Base.unit) -> Base.unit
val require_does_raise : ?cr:CR.t -> ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> Base.Source_code_position.t -> (Base.unit -> 'a) -> Base.unit
val quickcheck : Base.Source_code_position.t -> ?cr:CR.t -> ?hide_positions:Base.bool -> ?seed:Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Test.Config.Seed.t -> ?sizes:Base.int Base.Sequence.t -> ?trials:Base.int -> ?shrinker:'a Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Shrinker.t -> ?shrink_attempts:Base.int -> ?examples:'a Base.list -> sexp_of:('a -> Base.Sexp.t) -> f:('a -> Base.unit) -> 'a Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Generator.t -> Base.unit
val sexp_style : Sexp_style.t Base.ref
val on_print_cr : (Base.string -> Base.unit) Base.ref
module type With_containers = Expect_test_helpers_core__.Expect_test_helpers_core_intf.With_containers
module type With_comparable = Expect_test_helpers_core__.Expect_test_helpers_core_intf.With_comparable
Serialization tests
val print_and_check_stable_type : ?cr:CR.t -> ?hide_positions:bool -> ?max_binable_length:int -> Core_kernel.Source_code_position.t -> (module Core_kernel.Stable_without_comparator with type t = 'a) -> 'a list -> unit
print_and_check_stable_type
prints the bin-io digest for the given type, and the bin-io and sexp serializations of the given values. Prints an error message for any serializations that fail to round-trip, and for any bin-io serializations that exceedmax_binable_length
.
val print_and_check_stable_int63able_type : ?cr:CR.t -> ?hide_positions:bool -> ?max_binable_length:int -> Core_kernel.Source_code_position.t -> (module Core_kernel.Stable_int63able with type t = 'a) -> 'a list -> unit
print_and_check_stable_int63able_type
works likeprint_and_check_stable_type
, and includesInt63.t
serializations.
val print_and_check_container_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_containers with type t = 'a) -> 'a list -> unit
print_and_check_container_sexps
prints the sexp representation of maps, sets, hash tables, and hash sets based on the given values. For sets and hash sets, prints a CR if the sexp does not correspond to a list of elements. For maps and hash tables, prints a CR if the sexp does not correspond to an association list keyed on elements.
val print_and_check_comparable_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_comparable with type t = 'a) -> 'a list -> unit
print_and_check_comparable_sexps
is likeprint_and_check_container_sexps
for maps and sets only.
val print_and_check_hashable_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_hashable with type t = 'a) -> 'a list -> unit
print_and_check_hashable_sexps
is likeprint_and_check_container_sexps
for hash tables and hash sets only.
Allocation tests
module Allocation_limit : module type of sig ... end
val require_allocation_does_not_exceed : ?hide_positions:bool -> Allocation_limit.t -> Core_kernel.Source_code_position.t -> (unit -> 'a) -> 'a
require_allocation_does_not_exceed
is a specialized form ofrequire
that only produces output whenf ()
allocates more than the given limits. The output will include the actual number of major and minor words allocated. We do NOT include these numbers in the successful case because those numbers are not stable with respect to compiler versions and build flags.If
f
returns a value that should be ignored, use this idiom:ignore (require_allocation_does_not_exceed ... f : t)
rather than this idiom:
require_allocation_does_not_exceed ... (fun () -> ignore (f () : t))
With the latter idiom, the compiler may optimize the computation of
f ()
taking advantage of the fact that the result is ignored, and eliminate allocation that is intended to be measured. With the former idiom, the compiler cannot do such optimization and must compute the result off ()
.See documentation above about CRs and workflows for failing allocation tests.
val require_no_allocation : ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (unit -> 'a) -> 'a
require_no_allocation here f
is equivalent torequire_allocation_does_not_exceed (Minor_words 0) here f
.See documentation above about CRs and workflows for failing allocation tests.