(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestEncProtoNilRequest(t *testing.T) { |
| 72 | s := RunServerOnPort(TEST_PORT) |
| 73 | defer s.Shutdown() |
| 74 | |
| 75 | ec := NewProtoEncodedConn(t) |
| 76 | defer ec.Close() |
| 77 | |
| 78 | testPerson := &pb.Person{Name: "Anatolii", Age: 25, Address: "Ukraine, Nikolaev"} |
| 79 | |
| 80 | //Subscribe with empty interface shouldn't failed on empty message |
| 81 | ec.Subscribe("nil_test", func(_, reply string, _ any) { |
| 82 | ec.Publish(reply, testPerson) |
| 83 | }) |
| 84 | |
| 85 | resp := new(pb.Person) |
| 86 | |
| 87 | //Request with nil argument shouldn't failed with nil argument |
| 88 | err := ec.Request("nil_test", nil, resp, 100*time.Millisecond) |
| 89 | ec.Flush() |
| 90 | |
| 91 | if err != nil { |
| 92 | t.Error("Fail to send empty message via encoded proto connection") |
| 93 | } |
| 94 | |
| 95 | if !reflect.DeepEqual(testPerson.ProtoReflect(), resp.ProtoReflect()) { |
| 96 | t.Error("Fail to receive encoded response") |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func BenchmarkProtobufMarshalStruct(b *testing.B) { |
| 101 | me := &pb.Person{Name: "derek", Age: 22, Address: "140 New Montgomery St"} |
nothing calls this directly
no test coverage detected