diff --git a/pw_protobuf/codegen_message_test.cc b/pw_protobuf/codegen_message_test.cc index 091794dd7..cbd907ea8 100644 --- a/pw_protobuf/codegen_message_test.cc +++ b/pw_protobuf/codegen_message_test.cc @@ -2147,11 +2147,11 @@ TEST(CodegenMessage, OneOf_Encode_MultipleTimes) { 0); } -TEST(CodegenMessage, OneOf_Encode_UnsetEncoderFails) { +TEST(CodegenMessage, OneOf_Encode_UnsetEncoderIsIgnored) { OneOfTest::Message message; std::array buffer; OneOfTest::MemoryEncoder oneof_test(buffer); - EXPECT_EQ(oneof_test.Write(message), Status::DataLoss()); + EXPECT_EQ(oneof_test.Write(message), OkStatus()); } TEST(CodegenMessage, OneOf_Decode) { @@ -2208,7 +2208,7 @@ TEST(CodegenMessage, OneOf_Decode_MultipleOneOfFieldsFails) { EXPECT_EQ(stream_decoder.Read(message), Status::DataLoss()); } -TEST(CodegenMessage, OneOf_Decode_UnsetDecoderFails) { +TEST(CodegenMessage, OneOf_Decode_UnsetDecoderIsIgnored) { // clang-format off constexpr uint8_t proto_data[] = { // type.an_int @@ -2219,7 +2219,7 @@ TEST(CodegenMessage, OneOf_Decode_UnsetDecoderFails) { stream::MemoryReader reader(as_bytes(span(proto_data))); OneOfTest::StreamDecoder stream_decoder(reader); OneOfTest::Message message; - EXPECT_EQ(stream_decoder.Read(message), Status::DataLoss()); + EXPECT_EQ(stream_decoder.Read(message), OkStatus()); } } // namespace diff --git a/pw_protobuf/public/pw_protobuf/internal/codegen.h b/pw_protobuf/public/pw_protobuf/internal/codegen.h index b922533a0..d549916b4 100644 --- a/pw_protobuf/public/pw_protobuf/internal/codegen.h +++ b/pw_protobuf/public/pw_protobuf/internal/codegen.h @@ -300,7 +300,7 @@ struct OneOf { invoked_ = true; return encode_(encoder); } - return Status::DataLoss(); + return OkStatus(); } Status Decode(Fields field, StreamDecoder& decoder) const { @@ -313,7 +313,7 @@ struct OneOf { invoked_ = true; return decode_(field, decoder); } - return Status::DataLoss(); + return OkStatus(); } mutable bool invoked_;