Restructure syntax branches in text format conformance tests.
This doesn't change the tests at all, but refactors them to be more reusable in different contexts. Specifically, this will make it easier to add corresponding editions-based tests. This also splits the concept of "uses a proto3 message" and "runs proto3 tests", in preparation for that change.
PiperOrigin-RevId: 574310612
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index fc80ec6..94efbcc 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -141,22 +141,22 @@
return std::unique_ptr<Message>(prototype_message_for_compare_->New());
}
-std::string ConformanceTestSuite::ConformanceRequestSetting::GetTestName()
- const {
- std::string rname;
+std::string
+ConformanceTestSuite::ConformanceRequestSetting::GetSyntaxIdentifier() const {
switch (FileDescriptorLegacy(prototype_message_.GetDescriptor()->file())
.syntax()) {
case FileDescriptorLegacy::Syntax::SYNTAX_PROTO3:
- rname = ".Proto3.";
- break;
+ return "Proto3";
case FileDescriptorLegacy::Syntax::SYNTAX_PROTO2:
- rname = ".Proto2.";
- break;
+ return "Proto2";
default:
- break;
+ return "Unknown";
}
+}
- return absl::StrCat(ConformanceLevelToString(level_), rname,
+string ConformanceTestSuite::ConformanceRequestSetting::GetTestName() const {
+ return absl::StrCat(ConformanceLevelToString(level_), ".",
+ GetSyntaxIdentifier(), ".",
InputFormatString(input_format_), ".", test_name_, ".",
OutputFormatString(output_format_));
}