Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the concrete Alcotest.testable type #330

Open
craigfe opened this issue Oct 8, 2021 · 0 comments
Open

Deprecate the concrete Alcotest.testable type #330

craigfe opened this issue Oct 8, 2021 · 0 comments

Comments

@craigfe
Copy link
Member

craigfe commented Oct 8, 2021

The Alcotest API exposes the definition of Alcotest.testable as:

(** [TESTABLE] provides an abstract description for testable values. *)
module type TESTABLE = sig
  type t
  (** The type to test. *)

  val pp : t Fmt.t
  (** A way to pretty-print the value. *)

  val equal : t -> t -> bool
  (** Test for equality between two values. *)
end

type 'a testable = (module TESTABLE with type t = 'a)
(** The type for testable values. *)

val testable : 'a Fmt.t -> ('a -> 'a -> bool) -> 'a testable
(** [testable pp eq] is a new {!type-testable} with the pretty-printer [pp] and
    equality [eq]. *)

This is unfortunate, as it means testables can't keep any additional structure about the underlying type when it's available. For instance:

We should deprecate the concreteness of the testable type and then make it abstract. Users will still be able to construct testables with Alcotest.testable, and to ease migration we can add a new function like Alcotest.testable_of_module that does something equivalent with first-class module syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant