@dusty-phillips/rescript-zora
Version:
lightning-fast testing for a lightning-fast compiler
40 lines (35 loc) • 1.42 kB
JavaScript
// Generated by ReScript, PLEASE EDIT WITH CARE
import * as Zora from "zora";
function wait(amount) {
return new Promise((function (resolve, reject) {
setTimeout((function () {
resolve(undefined);
}), amount);
}));
}
Zora.test("Some Parallel Tests", (async function (t) {
var state = {
contents: 0
};
t.test("parallel 1", (async function (t) {
await wait(10);
t.equal(state.contents, 1, "parallel 2 should have incremented by now");
state.contents = state.contents + 1 | 0;
t.equal(state.contents, 2, "parallel 1 should increment");
}));
t.test("parallel 2", (async function (t) {
t.equal(state.contents, 0, "parallel 2 should be the first to increment");
state.contents = state.contents + 1 | 0;
t.equal(state.contents, 1, "parallel 2 should increment");
}));
t.test("parallel 3", (async function (t) {
await wait(20);
t.equal(state.contents, 2, "parallel 1 and 2 should have incremented by now");
state.contents = state.contents + 1 | 0;
t.equal(state.contents, 3, "parallel 3 should increment last");
}));
}));
export {
wait ,
}
/* Not a pure module */