forked from patricoferris/get-activity
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
565 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
open Alcotest | ||
|
||
module Msg = struct | ||
type 'a t = [ `Msg of 'a ] | ||
|
||
let pp f fs (`Msg s : 'a t) = Format.fprintf fs "%a" f s | ||
let eq f (`Msg s1 : 'a t) (`Msg s2 : 'a t) = f s1 s2 | ||
|
||
let testable t = | ||
let pp = pp (Alcotest.pp t) in | ||
let eq = eq (Alcotest.equal t) in | ||
testable pp eq | ||
end | ||
|
||
let msg = Msg.testable | ||
let string_msg = msg string | ||
let or_msg x = result x string_msg | ||
|
||
module Lwt = struct | ||
type 'a t = 'a Lwt.t | ||
|
||
let pp f fs (x : 'a t) = | ||
let x = Lwt_main.run x in | ||
Format.fprintf fs "%a" f x | ||
|
||
let eq f (x : 'a t) (y : 'a t) = | ||
let x = Lwt_main.run x in | ||
let y = Lwt_main.run y in | ||
f x y | ||
|
||
let testable (t : 'a testable) : 'a t testable = | ||
let pp = pp (Alcotest.pp t) in | ||
let eq = eq (Alcotest.equal t) in | ||
testable pp eq | ||
end | ||
|
||
let lwt = Lwt.testable | ||
|
||
module Yojson = struct | ||
type t = Yojson.Safe.t | ||
|
||
let pp = Yojson.Safe.pp | ||
let eq = Yojson.Safe.equal | ||
let testable : t testable = testable pp eq | ||
end | ||
|
||
let yojson = Yojson.testable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
val msg : 'a Alcotest.testable -> [ `Msg of 'a ] Alcotest.testable | ||
val string_msg : [ `Msg of string ] Alcotest.testable | ||
|
||
val or_msg : | ||
'a Alcotest.testable -> ('a, [ `Msg of string ]) result Alcotest.testable | ||
|
||
val lwt : 'a Alcotest.testable -> 'a Lwt.t Alcotest.testable | ||
val yojson : Yojson.Safe.t Alcotest.testable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(test | ||
(name main) | ||
(package get-activity-lib) | ||
(libraries get-activity-lib alcotest)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let () = | ||
Alcotest.run "get-activity-lib" | ||
[ | ||
Test_token.suite; | ||
Test_period.suite; | ||
Test_graphql.suite; | ||
Test_contributions.suite; | ||
] |
Oops, something went wrong.