-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-142: Migrate test cases of Promise
- Loading branch information
1 parent
fda0b82
commit 328585f
Showing
3 changed files
with
22 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@require: test/test | ||
@require: test/expect | ||
|
||
@import: ../src/base0 | ||
@import: ../src/ref | ||
@import: ../src/promise | ||
|
||
let promise-test-cases = open Test in | ||
describe `Promise module` [ | ||
it `evaluate lazily` (fun () -> ( | ||
let r = Ref.make 0 in | ||
let p = Promise.delay ~(!!(&(let () = r |> Ref.inc in 1))) in | ||
Ref.get r == 0 | ||
&& (let _ = Promise.force p in | ||
Ref.get r == 1 | ||
&& (let _ = Promise.force p in | ||
Ref.get r == 1)) | ||
|> Expect.is-true | ||
)); | ||
] |