rpc: add error when call result parameter is not addressable (#20638)

This commit is contained in:
Adam Schmideg
2020-02-11 09:48:58 +01:00
committed by GitHub
parent 34bb132b10
commit 172f7778fe
2 changed files with 20 additions and 0 deletions

View File

@ -49,6 +49,23 @@ func TestClientRequest(t *testing.T) {
}
}
func TestClientResponseType(t *testing.T) {
server := newTestServer()
defer server.Stop()
client := DialInProc(server)
defer client.Close()
if err := client.Call(nil, "test_echo", "hello", 10, &echoArgs{"world"}); err != nil {
t.Errorf("Passing nil as result should be fine, but got an error: %v", err)
}
var resultVar echoResult
// Note: passing the var, not a ref
err := client.Call(resultVar, "test_echo", "hello", 10, &echoArgs{"world"})
if err == nil {
t.Error("Passing a var as result should be an error")
}
}
func TestClientBatchRequest(t *testing.T) {
server := newTestServer()
defer server.Stop()