use correct packages
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s
This commit is contained in:
@@ -25,12 +25,19 @@ func TestTcpHelpers(t *testing.T) {
|
||||
log.Printf("Received call: %s\n", string(data))
|
||||
return 3, []byte("Hello, client!"), nil
|
||||
})
|
||||
server.HandleCall(Ping, func(data []byte) (uint32, []byte, error) {
|
||||
return Pong, nil, nil
|
||||
})
|
||||
|
||||
client.SendPacket(1, []byte("Hello, world!"))
|
||||
answer, err := client.Call(2, 3, []byte("Hello, server!"))
|
||||
if err != nil {
|
||||
t.Errorf("Error calling: %v\n", err)
|
||||
}
|
||||
_, err = client.Call(Ping, Pong, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Error calling: %v\n", err)
|
||||
}
|
||||
if string(answer) != "Hello, client!" {
|
||||
t.Errorf("Expected answer 'Hello, client!', got %s\n", string(answer))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user