fix go_test implement error (#7012)

* fix(grpc): fix go_test implement error

* fix(grpc): fix go_test implement error
This commit is contained in:
godcong
2022-02-04 00:43:28 +08:00
committed by GitHub
parent 39c8a19ce2
commit f5664d33fb

View File

@@ -1,8 +1,8 @@
package testing
import (
"../../tests/MyGame/Example"
flatbuffers "github.com/google/flatbuffers/go"
"github.com/google/flatbuffers/tests/MyGame/Example"
"context"
"net"
@@ -12,7 +12,9 @@ import (
"google.golang.org/grpc/encoding"
)
type server struct{}
type server struct {
Example.UnimplementedMonsterStorageServer
}
// test used to send and receive in grpc methods
var test = "Flatbuffers"
@@ -65,8 +67,12 @@ func RetrieveClient(c Example.MonsterStorageClient, t *testing.T) {
if err != nil {
t.Fatalf("Retrieve client failed: %v", err)
}
if string(out.Name()) != test {
t.Errorf("RetrieveClient failed: expected=%s, got=%s\n", test, out.Name())
monster, err := out.Recv()
if err != nil {
t.Fatalf("Recv failed: %v", err)
}
if string(monster.Name()) != test {
t.Errorf("RetrieveClient failed: expected=%s, got=%s\n", test, monster.Name())
t.Fail()
}
}