修正扇出的测试用例会出现的问题

This commit is contained in:
fantasticbin 2024-11-15 23:34:35 +08:00
parent ad8459af83
commit a61d49c8c3

View File

@ -3,6 +3,7 @@ package observer
import ( import (
"fmt" "fmt"
"testing" "testing"
"time"
) )
func TestObserver(t *testing.T) { func TestObserver(t *testing.T) {
@ -28,4 +29,5 @@ func TestObserver(t *testing.T) {
newUser2 := "gan" newUser2 := "gan"
userRegister.Notify(newUser1) userRegister.Notify(newUser1)
userRegister.Notify(newUser2) userRegister.Notify(newUser2)
time.Sleep(1 * time.Second)
} }