diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/game/owner_goexit_test.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/game/owner_goexit_test.go')
| -rw-r--r-- | internal/game/owner_goexit_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
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") + } +} |
