Queue UI output and status updates
This commit is contained in:
committed by
Brandon McGinty
parent
b10e08477c
commit
12761f29ca
@@ -4,6 +4,24 @@ import "testing"
|
||||
|
||||
// Regression: Close sent to a bounded channel and could block or enqueue
|
||||
// duplicate shutdowns when called more than once.
|
||||
// Regression: network callbacks modified terminal state directly. Post gives
|
||||
// them a bounded handoff to the UI-owning Run goroutine instead of blocking.
|
||||
func TestPostIsBoundedAndRejectsClosedUI(t *testing.T) {
|
||||
ui := New(nil)
|
||||
for i := 0; i < cap(ui.events); i++ {
|
||||
if !ui.Post(func() {}) {
|
||||
t.Fatal("queue filled too early")
|
||||
}
|
||||
}
|
||||
if ui.Post(func() {}) {
|
||||
t.Fatal("Post accepted work past queue capacity")
|
||||
}
|
||||
ui.Close()
|
||||
if ui.Post(func() {}) {
|
||||
t.Fatal("Post accepted work after close")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloseIsNonblockingAndIdempotent(t *testing.T) {
|
||||
ui := New(nil)
|
||||
ui.Close()
|
||||
|
||||
Reference in New Issue
Block a user