Skip to content

Commit a330879

Browse files
committed
WIP
1 parent 20503d2 commit a330879

File tree

9 files changed

+48
-37
lines changed

9 files changed

+48
-37
lines changed

src/alcotest-async/alcotest_async_intf.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ module type Alcotest_async = sig
2626
open Alcotest_engine.Unstable
2727

2828
include
29-
Cli.S
29+
Core.S
3030
with type 'a m := 'a Async_kernel.Deferred.t
3131
and type 'a test_args := 'a
3232
and type config := Config.User.t
33+
and type source_code_position := Source_code_position.here
3334
and type tag_set := Tag.Set.t
3435

3536
val test :

src/alcotest-async/dune

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
(name alcotest_async)
33
(public_name alcotest-async)
44
(libraries
5-
alcotest
65
alcotest.engine
76
alcotest.stdlib_ext
7+
alcotest
88
async_kernel
99
async_unix
1010
base

src/alcotest-engine/cli.ml

-1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,5 @@ module V1 = struct
171171
end
172172

173173
module Unstable = struct
174-
include Unstable_types
175174
module Make = Make
176175
end

src/alcotest-engine/cli_intf.ml

+1-13
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ module V1_types = struct
5858
S with type return = unit M.t
5959
end
6060

61-
module Unstable_types = struct
62-
module type S = sig
63-
include Core.Unstable.S
64-
(** @inline *)
65-
end
66-
67-
module type MAKER = Core.Unstable.MAKER
68-
end
69-
7061
module type Cli = sig
7162
module V1 : sig
7263
module type S = V1_types.S
@@ -76,9 +67,6 @@ module type Cli = sig
7667
end
7768

7869
module Unstable : sig
79-
module type S = Unstable_types.S
80-
module type MAKER = Unstable_types.MAKER
81-
82-
module Make : MAKER
70+
module Make : Core.Unstable.MAKER
8371
end
8472
end

src/alcotest-engine/core.ml

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ module Make (P : Platform.MAKER) (M : Monad.S) = struct
107107
{ suite; errors = []; loc; config; run_id; log_trap; progress_reporter }
108108

109109
type 'a test = 'a Suite.test
110-
type 'a extra_info = ?here:Source_code_position.here -> ?tags:Tag.Set.t -> 'a
111110

112111
let bt () = match Printexc.get_backtrace () with "" -> "" | s -> "\n" ^ s
113112

src/alcotest-engine/core_intf.ml

+35-17
Original file line numberDiff line numberDiff line change
@@ -106,37 +106,50 @@ module Types = struct
106106
end
107107

108108
module Unstable_types = struct
109-
module type S = sig
109+
module type Test_constructors = sig
110110
(* These types are intended to be destructively-substituted by various
111111
backends. *)
112112

113113
type 'a m
114114
type 'a test_args
115115
type tag_set
116-
type config
116+
type source_code_position
117117

118118
type 'a test
119119
(** The type of unit tests. *)
120120

121-
type 'a extra_info = ?here:Source_code_position.here -> ?tags:tag_set -> 'a
122-
(** Tests and test groups can be located by attaching source code positions
123-
to them. *)
124-
125-
val test : (name:string -> ('a -> unit m) test_args -> 'a test) extra_info
121+
val test :
122+
?here:source_code_position ->
123+
?tags:tag_set ->
124+
name:string ->
125+
('a -> unit m) test_args ->
126+
'a test
126127
(** [test ~name f] is a suite containing a single named test that runs [f].*)
127128

128-
val group : (name:string -> 'a test list -> 'a test) extra_info
129+
val group :
130+
?here:source_code_position ->
131+
?tags:tag_set ->
132+
name:string ->
133+
'a test list ->
134+
'a test
129135
(** [test_group ~name ts] *)
136+
end
137+
138+
module type Test_runners = sig
139+
type 'a m
140+
type 'a test
141+
type config
142+
type source_code_position
130143

131144
val run :
132-
?here:Source_code_position.here ->
145+
?here:source_code_position ->
133146
?config:config ->
134147
name:string ->
135148
unit test list ->
136149
unit m
137150

138151
val run_with_args :
139-
?here:Source_code_position.here ->
152+
?here:source_code_position ->
140153
?config:config ->
141154
name:string ->
142155
'a ->
@@ -145,22 +158,29 @@ module Unstable_types = struct
145158
end
146159

147160
(** Extensions to {!S} for use by backends. *)
148-
module type EXT = sig
149-
include S
161+
module type S = sig
162+
include Test_constructors
163+
164+
include
165+
Test_runners
166+
with type 'a m := 'a m
167+
and type 'a test := 'a test
168+
and type source_code_position := source_code_position
150169

151170
val list_tests :
152-
?here:Source_code_position.here ->
171+
?here:source_code_position ->
153172
?config:config ->
154173
name:string ->
155174
_ test list ->
156175
unit m
157176
end
158177

159178
module type MAKER = functor (P : Platform.MAKER) (M : Monad.S) ->
160-
EXT
179+
S
161180
with type 'a m := 'a M.t
162181
and type 'a test_args := 'a
163182
and type config := Config.User.t
183+
and type source_code_position := Source_code_position.here
164184
and type tag_set := Tag.Set.t
165185
end
166186

@@ -181,9 +201,7 @@ module type Core = sig
181201
module Unstable : sig
182202
type nonrec 'a identified = 'a identified
183203

184-
module type S = Unstable_types.S
185-
module type MAKER = Unstable_types.MAKER
186-
204+
include module type of Unstable_types
187205
module Make : MAKER
188206
end
189207
end

src/alcotest-lwt/alcotest_lwt_intf.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ module type Alcotest_lwt = sig
2424
open Alcotest_engine.Unstable
2525

2626
include
27-
Cli.S
27+
Core.S
2828
with type 'a m := 'a Lwt.t
2929
and type 'a test_args := Lwt_switch.t -> 'a
3030
and type config := Config.User.t
31+
and type source_code_position := Source_code_position.here
3132
and type tag_set := Tag.Set.t
3233

3334
val test_sync : (('a -> unit) -> 'a test) Core.identified

src/alcotest-mirage/alcotest_mirage.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ module Unstable : sig
3636

3737
module Make (C : Mirage_clock.MCLOCK) : sig
3838
include
39-
Cli.S
39+
Core.S
4040
with type 'a m := 'a Lwt.t
4141
and type 'a test_args := Lwt_switch.t -> 'a
4242
and type config := Config.User.t
43+
and type source_code_position := Source_code_position.here
4344
and type tag_set := Tag.Set.t
4445

4546
val test_sync :

src/alcotest/alcotest.mli

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ include Alcotest_engine.V1.Cli.S with type return := unit
4040
functions below. *)
4141

4242
include module type of Alcotest_engine.V1.Test
43+
(** @inline *)
4344

4445
(** {1 Versioned APIs} *)
4546

@@ -54,6 +55,7 @@ end
5455

5556
module Unstable : sig
5657
open Alcotest_engine.Unstable
58+
(** The latest, cutting-edge API of Alcotest. Still under active development. *)
5759

5860
module Source_code_position : sig
5961
type here = Lexing.position
@@ -67,6 +69,7 @@ module Unstable : sig
6769
documentation of [__POS__] for more information. *)
6870
end
6971

72+
(** A {i tag} is an attribute that is attached to a test. *)
7073
module Tag : sig
7174
include module type of Tag with type t = Tag.t
7275
(** @inline *)
@@ -113,10 +116,11 @@ module Unstable : sig
113116

114117
(** @inline *)
115118
include
116-
Cli.S
119+
Core.S
117120
with type 'a m := 'a
118121
and type 'a test_args := 'a
119122
and type tag_set := Tag.Set.t
123+
and type source_code_position := Source_code_position.here
120124
and type config := Config.t
121125
end
122126

0 commit comments

Comments
 (0)