Skip to content

Commit 41fde49

Browse files
committed
test: keep cached re-entrancy regression focused
1 parent 3d42a1c commit 41fde49

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

‎packages/effect/test/Effect.test.ts‎

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,10 +4474,8 @@ describe("Effect", () => {
44744474
it.effect("shares the in-flight run when the body synchronously wakes a re-entrant caller", () =>
44754475
Effect.gen(function*() {
44764476
const gate = yield* Deferred.make<void>()
4477-
let runs = 0
44784477
const cached = yield* Effect.cached(
44794478
Effect.gen(function*() {
4480-
runs++
44814479
yield* Deferred.succeed(gate, void 0)
44824480
return 42
44834481
})
@@ -4490,38 +4488,6 @@ describe("Effect", () => {
44904488

44914489
assert.strictEqual(yield* cached, 42)
44924490
assert.strictEqual(yield* Fiber.join(waiter), 42)
4493-
assert.strictEqual(runs, 1)
4494-
}))
4495-
4496-
it.effect("interrupting a re-entrant waiter during synchronous startup keeps the owner running", () =>
4497-
Effect.gen(function*() {
4498-
let runs = 0
4499-
const cached: Effect.Effect<number> = yield* Effect.cached(
4500-
Effect.gen(function*() {
4501-
runs++
4502-
const waiter = yield* Effect.forkChild(cached, { startImmediately: true })
4503-
yield* Fiber.interrupt(waiter)
4504-
return 42
4505-
})
4506-
)
4507-
4508-
assert.strictEqual(yield* cached, 42)
4509-
assert.strictEqual(yield* cached, 42)
4510-
assert.strictEqual(runs, 1)
4511-
}))
4512-
4513-
it.effect("same-fiber re-entrant call suspends until interrupted, then starts fresh", () =>
4514-
Effect.gen(function*() {
4515-
let runs = 0
4516-
const cached: Effect.Effect<number> = yield* Effect.cached(
4517-
Effect.suspend(() => ++runs === 1 ? cached : Effect.succeed(42))
4518-
)
4519-
4520-
const fiber = yield* Effect.forkChild(cached, { startImmediately: true })
4521-
assert.isUndefined(fiber.pollUnsafe())
4522-
yield* Fiber.interrupt(fiber)
4523-
assert.strictEqual(yield* cached, 42)
4524-
assert.strictEqual(runs, 2)
45254491
}))
45264492

45274493
it.effect("replays failures", () =>

0 commit comments

Comments
 (0)