Remove enforce_utf8 from edition zero test cases.

PiperOrigin-RevId: 568978635
pull/14235/head
Mike Kruskal 1 year ago committed by Copybara-Service
parent ed763d0294
commit 7bd4744da6
  1. 6
      src/google/protobuf/editions/codegen_tests/BUILD
  2. 15
      src/google/protobuf/editions/codegen_tests/proto3_utf8_disabled.proto
  3. 9
      src/google/protobuf/editions/golden/editions_transform_proto2.proto
  4. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_lite.proto
  5. 2
      src/google/protobuf/editions/golden/editions_transform_proto2_utf8_disabled.proto
  6. 4
      src/google/protobuf/editions/golden/editions_transform_proto3.proto
  7. 2
      src/google/protobuf/editions/golden/editions_transform_proto3_utf8_disabled.proto
  8. 27
      src/google/protobuf/editions/proto/editions_transform_proto2.proto
  9. 2
      src/google/protobuf/editions/proto/editions_transform_proto2_lite.proto
  10. 2
      src/google/protobuf/editions/proto/editions_transform_proto2_utf8_disabled.proto
  11. 4
      src/google/protobuf/editions/proto/editions_transform_proto3.proto
  12. 2
      src/google/protobuf/editions/proto/editions_transform_proto3_utf8_disabled.proto
  13. 3
      src/google/protobuf/editions/transform.awk

@ -79,12 +79,6 @@ proto_library(
strip_import_prefix = "/src",
)
proto_library(
name = "proto3_utf8_disabled_proto",
srcs = ["proto3_utf8_disabled.proto"],
strip_import_prefix = "/src",
)
proto_library(
name = "proto2_import_proto",
srcs = ["proto2_import.proto"],

@ -1,15 +0,0 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
package protobuf_editions_test.proto3;
message Proto3Utf8Disabled {
string string_field = 1;
map<string, string> map_field = 10;
}

@ -59,11 +59,6 @@ extend ParentMessage.ExtendedMessage {
message TestMessage {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3;
string options_strip_beginning = 4 [ ctype = STRING_PIECE, default = "hello world abcd" ];
string options_strip_middle = 5 [ ctype = STRING_PIECE, default = "hello world abcd" ];
string options_strip_end = 6 [ ctype = STRING_PIECE, default = "hello world abcd" ];
map<string, string> string_map_field = 7;
@ -71,6 +66,10 @@ message TestMessage {
repeated int32 int_field_packed = 9 [features.repeated_field_encoding = PACKED];
repeated int32 int_field_unpacked = 10;
repeated int32 options_strip_beginning = 4 [ /* inline comment*/ debug_redact = true, deprecated = false ];
repeated int32 options_strip_middle = 5 [debug_redact = true, deprecated = false];
repeated int32 options_strip_end = 6 [debug_redact = true, deprecated = false];
message OptionalGroup {
int32 a = 17;
}

@ -19,8 +19,6 @@ option optimize_for = LITE_RUNTIME;
message TestMessageLite {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3;
map<string, string> string_map_field = 4;

@ -18,8 +18,6 @@ package protobuf_editions_test;
message TestMessageUtf8Disabled {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3;
map<string, string> string_map_field = 4;

@ -12,12 +12,8 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED];
map<string, string> string_map_field = 4;
map<string, string> string_map_field_utf = 5;
map<string, string> string_map_field_noutf = 6 [features.utf8_validation = UNVERIFIED];
repeated int32 int_field = 7;
repeated int32 int_field_packed = 8;

@ -13,8 +13,6 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3 [features.utf8_validation = UNVERIFIED];
map<string, string> string_map_field = 4;

@ -54,23 +54,6 @@ extend ParentMessage.ExtendedMessage {
message TestMessage {
optional string string_field = 1;
optional string string_field_utf = 2;
optional string string_field_noutf = 3;
optional string options_strip_beginning = 4 [
enforce_utf8 = false,
ctype = STRING_PIECE,
default = "hello world abcd"
];
optional string options_strip_middle = 5 [
ctype = STRING_PIECE,
enforce_utf8 = false,
default = "hello world abcd"
];
optional string options_strip_end = 6 [
ctype = STRING_PIECE,
default = "hello world abcd",
enforce_utf8 = false
];
map<string, string> string_map_field = 7;
@ -78,6 +61,16 @@ message TestMessage {
repeated int32 int_field_packed = 9 [packed = true];
repeated int32 int_field_unpacked = 10 [packed = false];
repeated int32 options_strip_beginning = 4 [
packed = false,
/* inline comment*/ debug_redact = true,
deprecated = false
];
repeated int32 options_strip_middle = 5
[debug_redact = true, packed = false, deprecated = false];
repeated int32 options_strip_end = 6
[debug_redact = true, deprecated = false, packed = false];
optional group OptionalGroup = 16 {
optional int32 a = 17;
}

@ -13,8 +13,6 @@ option optimize_for = LITE_RUNTIME;
message TestMessageLite {
optional string string_field = 1;
optional string string_field_utf = 2;
optional string string_field_noutf = 3;
map<string, string> string_map_field = 4;

@ -12,8 +12,6 @@ package protobuf_editions_test;
message TestMessageUtf8Disabled {
optional string string_field = 1;
optional string string_field_utf = 2;
optional string string_field_noutf = 3;
map<string, string> string_map_field = 4;

@ -11,12 +11,8 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3;
map<string, string> string_map_field = 4;
map<string, string> string_map_field_utf = 5;
map<string, string> string_map_field_noutf = 6;
repeated int32 int_field = 7;
repeated int32 int_field_packed = 8 [packed = true];

@ -12,8 +12,6 @@ package protobuf_editions_test;
message TestMessageProto3 {
string string_field = 1;
string string_field_utf = 2;
string string_field_noutf = 3;
map<string, string> string_map_field = 4;

@ -72,7 +72,6 @@ function transform_field(field)
sub(/\<optional\s*/, "", field_def)
sub(/\<packed = true\>/, "features.repeated_field_encoding = PACKED", existing_options)
existing_options = strip_option("packed = false", existing_options)
existing_options = strip_option("enforce_utf8 = (true|false)", existing_options)
if (match(field_def, /^\s*required\>/)) {
sub(/\<required\s*/, "", field_def)
options[++num_options] = "features.field_presence = LEGACY_REQUIRED"
@ -80,10 +79,8 @@ function transform_field(field)
}
if(syntax == 3) {
sub(/\<enforce_utf8 = false\>/, "features.utf8_validation = UNVERIFIED", existing_options)
sub(/\<packed = false\>/, "features.repeated_field_encoding = EXPANDED", existing_options)
existing_options = strip_option("packed = true", existing_options)
existing_options = strip_option("enforce_utf8 = (true|false)", existing_options)
if (match($0, /\<optional\>/)) {
sub(/\<optional /, "", field_def)
options[++num_options] = "features.field_presence = EXPLICIT"

Loading…
Cancel
Save