| 45 | : public testing::TestWithParam<UnparserTestCaseTextProto> {}; |
| 46 | |
| 47 | TEST_P(UnparserTestTextProto, Test) { |
| 48 | auto test_case = GetParam(); |
| 49 | Expr expr; |
| 50 | ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString(test_case.proto_text, &expr)); |
| 51 | absl::StatusOr<std::string> result = Unparse(expr); |
| 52 | if (result.ok()) { |
| 53 | ASSERT_OK(test_case.expr); |
| 54 | ASSERT_EQ(*(test_case.expr), *result); |
| 55 | } else { |
| 56 | ASSERT_THAT(result.status(), |
| 57 | StatusIs(test_case.expr.status().code(), |
| 58 | HasSubstr(test_case.expr.status().message()))); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // these tests make explicit assumptions about specific proto structures |
| 63 | // that are to be observed |