fix tests post-refactor
--HG-- branch : adc
This commit is contained in:
parent
c4c6021c85
commit
b784c34d4d
@ -7,12 +7,13 @@ import (
|
||||
func ExampleHubConnectionOptions_Connect() {
|
||||
opts := HubConnectionOptions{
|
||||
Address: "127.0.0.1",
|
||||
Self: *NewUserInfo("slowpoke9"),
|
||||
Self: NewUserInfo("slowpoke9"),
|
||||
}
|
||||
hub := opts.Connect()
|
||||
|
||||
for {
|
||||
event := <-hub.OnEvent
|
||||
events := make(chan HubEvent, 0)
|
||||
hub := ConnectAsync(&opts, events)
|
||||
|
||||
for event := range events {
|
||||
switch event.EventType {
|
||||
case EVENT_CONNECTION_STATE_CHANGED:
|
||||
fmt.Printf("Connection -- %s (%s)\n", event.StateChange, event.Message)
|
||||
@ -50,9 +51,8 @@ func ExampleHubConnectionOptions_ConnectSync() {
|
||||
|
||||
opts := HubConnectionOptions{
|
||||
Address: "127.0.0.1",
|
||||
Self: *NewUserInfo("slowpoke9"),
|
||||
OnEventSync: cb,
|
||||
Self: NewUserInfo("slowpoke9"),
|
||||
}
|
||||
|
||||
opts.ConnectSync() // blocking
|
||||
ConnectSync(&opts, cb) // blocking
|
||||
}
|
||||
|
@ -4,12 +4,14 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type myInfoTestPair struct {
|
||||
func TestMyINFOParse(t *testing.T) {
|
||||
|
||||
np := NewNmdcProtocol(nil).(*NmdcProtocol)
|
||||
|
||||
type myInfoTestPair struct {
|
||||
in string
|
||||
expect UserInfo
|
||||
}
|
||||
|
||||
func TestMyINFOParse(t *testing.T) {
|
||||
}
|
||||
|
||||
cases := []myInfoTestPair{
|
||||
|
||||
@ -71,15 +73,14 @@ func TestMyINFOParse(t *testing.T) {
|
||||
|
||||
for _, v := range cases {
|
||||
|
||||
got := UserInfo{}
|
||||
err := got.fromMyINFO(v.in)
|
||||
got, err := np.parseMyINFO(v.in)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("MyINFO parse warning (%s)", err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
if got != v.expect {
|
||||
if *got != v.expect {
|
||||
t.Errorf("MyINFO parse failure\nExpected:\n%+v\nGot:\n%+v\n", v.expect, got)
|
||||
continue
|
||||
}
|
Loading…
Reference in New Issue
Block a user