mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-02 09:21:40 +02:00
755ae0ef84
write to deadlock stderr after closing gocui more deadlock checking
20 lines
368 B
Go
20 lines
368 B
Go
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
)
|
|
|
|
func TestOnceWriter(t *testing.T) {
|
|
innerWriter := bytes.NewBuffer(nil)
|
|
counter := 0
|
|
onceWriter := NewOnceWriter(innerWriter, func() {
|
|
counter += 1
|
|
})
|
|
_, _ = onceWriter.Write([]byte("hello"))
|
|
_, _ = onceWriter.Write([]byte("hello"))
|
|
if counter != 1 {
|
|
t.Errorf("expected counter to be 1, got %d", counter)
|
|
}
|
|
}
|