Created
November 14, 2017 06:24
-
-
Save tiensonqin/f3370df6b894946bf3e750d4696920b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
open Jest | |
open Atom | |
let _ = test "Atom create" @@ | |
fun () -> begin | |
let a = atom 0 in | |
ignore Expect.(expect @@ deref a |> toBe 0); | |
addWatch a 0 (fun _key _atom oldV newV -> | |
Js.log "oldV"; | |
Js.log oldV; | |
Js.log "newV"; | |
Js.log newV; | |
); | |
Js.log a.watches; | |
ignore @@ reset a 1; | |
ignore @@ Expect.(expect @@ deref a |> toBe 1); | |
ignore @@ (swap a @@ fun x -> x + 1); | |
Expect.(expect @@ deref a |> toBe 2); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment