-
Notifications
You must be signed in to change notification settings - Fork 87
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
3 changed files
with
52 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
open Lwt | ||
let (>>=) = Lwt.(>>=) | ||
|
||
let cmp a b = String.compare a b = 0 | ||
|
||
let fail fmt = Printf.ksprintf OUnit.assert_failure fmt | ||
|
||
let expect msg expected actual = | ||
(if not (cmp expected actual) then | ||
fail "Expected '%s', got '%s': %s" expected actual msg) ; | ||
Lwt.return_unit | ||
if cmp expected actual then Lwt.return_unit | ||
else fail "Expected '%s', got '%s': %s" expected actual msg | ||
|
||
let or_error name fn t = | ||
fn t >>= function | ||
| `Error e -> fail "or_error starting %s" name | ||
| `Ok t -> return t | ||
|
||
| `Ok t -> Lwt.return t |
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