This commit is contained in:
jackdaw@loafle.com
2017-04-27 14:58:34 +09:00
parent d4d98d14a2
commit d444ac72de
4 changed files with 80 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ import (
"github.com/stretchr/testify/assert"
"testing"
"time"
"loafle.com/overflow/agent_api/observer/messages"
"fmt"
)
type Test struct {
@@ -85,7 +87,7 @@ func TestMultiAddObserver(t *testing.T) {
Notify("test", Test{Id: "test"})
time.Sleep(2 * time.Second)
Remove("test", ch1)
Remove(messages.CRAWLER_ADD, ch1)
Remove("test", ch2)
Remove("test", ch3)
Remove("test", ch4)
@@ -95,3 +97,18 @@ func TestMultiAddObserver(t *testing.T) {
time.Sleep(1 * time.Second)
}
func TestStringNotify(t *testing.T) {
ch := make(chan interface{},0)
Add("test",ch)
go func() {
data :=<-ch
str := data.(string)
fmt.Println(str)
}()
Notify("test","testsetasetaset")
time.Sleep(1 * time.Second)
}