Internal Change
PiperOrigin-RevId: 627235640
parent
5a91d6fe5e
commit
37bd0e00fa
|
@ -13,6 +13,10 @@ option java_package = "com.google.protobuf_test_messages.edition2023";
|
|||
option java_multiple_files = true;
|
||||
option objc_class_prefix = "Editions";
|
||||
|
||||
message ComplexMessage {
|
||||
int32 d = 1;
|
||||
}
|
||||
|
||||
message TestAllTypesEdition2023 {
|
||||
message NestedMessage {
|
||||
int32 a = 1;
|
||||
|
|
|
@ -261,6 +261,7 @@ void TextFormatConformanceTestSuiteImpl<MessageType>::RunDelimitedTests() {
|
|||
"DelimitedFieldExtension", REQUIRED,
|
||||
"[protobuf_test_messages.editions.delimited_ext] { c: 1 }");
|
||||
|
||||
|
||||
// Test that lower-cased group name (i.e. implicit field name) are accepted.
|
||||
RunValidTextFormatTest("DelimitedFieldLowercased", REQUIRED,
|
||||
"groupliketype { group_int32: 1 }");
|
||||
|
|
|
@ -77,6 +77,8 @@ Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
|
|||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.ProtobufOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.TextFormatOutput
|
||||
Required.Editions_Proto3.TextFormatInput.FloatFieldNegativeZero.ProtobufOutput
|
||||
Required.Editions_Proto3.TextFormatInput.FloatFieldNegativeZero.TextFormatOutput
|
||||
Required.Editions_Proto3.TextFormatInput.FloatFieldNegativeZero_F.ProtobufOutput
|
||||
|
|
|
@ -70,3 +70,5 @@ Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
|
|||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.ProtobufOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.TextFormatOutput
|
||||
|
|
|
@ -73,3 +73,5 @@ Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
|
|||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
|
||||
Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.ProtobufOutput
|
||||
Required.Editions.TextFormatInput.ExtensionMetadata.TextFormatOutput
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "google/protobuf/text_format.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -19,17 +18,22 @@
|
|||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/container/btree_set.h"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/strings/ascii.h"
|
||||
#include "absl/strings/cord.h"
|
||||
#include "absl/strings/escaping.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/numbers.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "google/protobuf/any.h"
|
||||
|
@ -40,7 +44,6 @@
|
|||
#include "google/protobuf/io/strtod.h"
|
||||
#include "google/protobuf/io/tokenizer.h"
|
||||
#include "google/protobuf/io/zero_copy_stream.h"
|
||||
#include "google/protobuf/io/zero_copy_stream_impl.h"
|
||||
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
|
||||
#include "google/protobuf/map_field.h"
|
||||
#include "google/protobuf/message.h"
|
||||
|
@ -498,7 +501,6 @@ class TextFormat::Parser::ParserImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Consumes the current field (as returned by the tokenizer) on the
|
||||
// passed in message.
|
||||
bool ConsumeField(Message* message) {
|
||||
|
@ -619,7 +621,6 @@ class TextFormat::Parser::ParserImpl {
|
|||
reserved_field = descriptor->IsReservedName(field_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (field == nullptr && !reserved_field) {
|
||||
if (!allow_unknown_field_) {
|
||||
ReportError(absl::StrCat("Message type \"", descriptor->full_name(),
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "google/protobuf/descriptor.h"
|
||||
#include "google/protobuf/io/tokenizer.h"
|
||||
#include "google/protobuf/io/zero_copy_stream_impl.h"
|
||||
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
|
||||
#include "google/protobuf/map_unittest.pb.h"
|
||||
#include "google/protobuf/message.h"
|
||||
#include "google/protobuf/test_util.h"
|
||||
|
@ -121,6 +122,7 @@ class TextFormatTest : public TextFormatTestBase {
|
|||
protected:
|
||||
// Text format read from text_format_unittest_data.txt.
|
||||
const std::string proto_text_format_;
|
||||
|
||||
private:
|
||||
static std::string static_proto_text_format_;
|
||||
};
|
||||
|
@ -994,6 +996,7 @@ TEST_F(TextFormatExtensionsTest, ParseExtensions) {
|
|||
TestUtil::ExpectAllExtensionsSet(proto_);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(TextFormatTest, ParseEnumFieldFromNumber) {
|
||||
// Create a parse string with a numerical value for an enum field.
|
||||
std::string parse_string =
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
syntax = "proto2";
|
||||
|
||||
package protobuf_unittest;
|
||||
|
||||
option java_multiple_files = true;
|
||||
|
||||
message SimpleMessage {
|
||||
optional int32 c = 1;
|
||||
optional int32 d = 2;
|
||||
}
|
||||
|
||||
message ComplexMessage {
|
||||
optional int32 d = 1;
|
||||
}
|
||||
|
||||
message TestExtensionsWithMetadata {
|
||||
extensions 1 [metadata = {
|
||||
type: "int32",
|
||||
name: "optional_primitive_extension",
|
||||
}];
|
||||
extensions 2 [metadata = {
|
||||
type: "protobuf_unittest.SimpleMessage",
|
||||
name: "optional_message_extension",
|
||||
}];
|
||||
extensions 3 [metadata = {
|
||||
type: "protobuf_unittest.ComplexMessage",
|
||||
name: "optional_complex_message_extension",
|
||||
}];
|
||||
}
|
||||
|
||||
extend TestExtensionsWithMetadata {
|
||||
optional int32 optional_primitive_extension = 1;
|
||||
optional protobuf_unittest.SimpleMessage optional_message_extension = 2;
|
||||
}
|
Loading…
Reference in New Issue