From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/game/owner_goexit_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 internal/game/owner_goexit_test.go (limited to 'internal/game/owner_goexit_test.go') diff --git a/internal/game/owner_goexit_test.go b/internal/game/owner_goexit_test.go new file mode 100644 index 0000000..5be643f --- /dev/null +++ b/internal/game/owner_goexit_test.go @@ -0,0 +1,26 @@ +package game + +import ( + "runtime" + "testing" + "time" +) + +// A task that calls runtime.Goexit (t.Fatal on the owner goroutine) stops the +// owner loop. Later RunOnOwner calls must return instead of blocking forever +// waiting for a consumer that no longer exists. +func TestOwnerGoexitDoesNotHangLaterTasks(t *testing.T) { + h := newHarness(t) + h.g.RunOnOwner(func() { runtime.Goexit() }) + + done := make(chan struct{}) + go func() { + defer close(done) + h.g.RunOnOwner(func() {}) + }() + select { + case <-done: + case <-time.After(5 * time.Second): + t.Fatal("RunOnOwner hung after the owner goroutine exited") + } +} -- cgit v1.2.3