Add editions-specific conformance tests

For now, these are limited to tests of text-form for delimited fields that locks down our problematic behavior in editions.  Follow up changes will adjust the behavior to behave better under editions.

PiperOrigin-RevId: 622211473
diff --git a/csharp/BUILD.bazel b/csharp/BUILD.bazel
index 3cbcf77..1ef004f 100644
--- a/csharp/BUILD.bazel
+++ b/csharp/BUILD.bazel
@@ -13,8 +13,8 @@
 conformance_test(
     name = "conformance_test",
     failure_list = "//conformance:failure_list_csharp.txt",
+    maximum_edition = "2023",
     testee = "//conformance:conformance_csharp",
-    text_format_failure_list = "//conformance:text_format_failure_list_csharp.txt",
 )
 
 ################################################################################
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 2acec5c..f3f0bc5 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -52,11 +52,13 @@
 # of protoc.
 $PROTOC -Isrc -I. \
     --experimental_allow_proto3_optional \
+    --experimental_editions \
     --csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
     --csharp_opt=file_extension=.pb.cs \
     --descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
     --include_source_info \
     --include_imports \
+    conformance/test_protos/test_messages_edition2023.proto \
     csharp/protos/map_unittest_proto3.proto \
     csharp/protos/unittest_issues.proto \
     csharp/protos/unittest_custom_options_proto3.proto \
@@ -70,6 +72,8 @@
     csharp/protos/unittest_issue6936_b.proto \
     csharp/protos/unittest_issue6936_c.proto \
     csharp/protos/unittest_selfreferential_options.proto \
+    src/google/protobuf/editions/golden/test_messages_proto3_editions.proto \
+    src/google/protobuf/editions/golden/test_messages_proto2_editions.proto \
     src/google/protobuf/unittest_well_known_types.proto \
     src/google/protobuf/test_messages_proto3.proto \
     src/google/protobuf/test_messages_proto2.proto \
diff --git a/csharp/src/Google.Protobuf.Conformance/Program.cs b/csharp/src/Google.Protobuf.Conformance/Program.cs
index 7816821..ad78bdb 100644
--- a/csharp/src/Google.Protobuf.Conformance/Program.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Program.cs
@@ -1,4 +1,4 @@
-#region Copyright notice and license
+#region Copyright notice and license
 // Protocol Buffers - Google's data interchange format
 // Copyright 2015 Google Inc.  All rights reserved.
 //
@@ -27,7 +27,10 @@
             var output = new BinaryWriter(Console.OpenStandardOutput());
             var typeRegistry = TypeRegistry.FromMessages(
                 ProtobufTestMessages.Proto3.TestAllTypesProto3.Descriptor,
-                ProtobufTestMessages.Proto2.TestAllTypesProto2.Descriptor);
+                ProtobufTestMessages.Proto2.TestAllTypesProto2.Descriptor,
+                ProtobufTestMessages.Editions.TestAllTypesEdition2023.Descriptor,
+                ProtobufTestMessages.Editions.Proto3.TestAllTypesProto3.Descriptor,
+                ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2.Descriptor);
 
             int count = 0;
             while (RunTest(input, output, typeRegistry))
@@ -66,6 +69,20 @@
                 ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension,
                 ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension2.Extensions.MessageSetExtension
             };
+            ExtensionRegistry editionsProto2ExtensionRegistry = new ExtensionRegistry
+            {
+              ProtobufTestMessages.Editions.Proto2.TestMessagesProto2EditionsExtensions
+                  .ExtensionInt32,
+              ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2.Types
+                  .MessageSetCorrectExtension1.Extensions.MessageSetExtension,
+              ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2.Types
+                  .MessageSetCorrectExtension2.Extensions.MessageSetExtension
+            };
+            ExtensionRegistry edition2023ExtensionRegistry = new ExtensionRegistry
+            {
+              ProtobufTestMessages.Editions.TestMessagesEdition2023Extensions.ExtensionInt32,
+              ProtobufTestMessages.Editions.TestMessagesEdition2023Extensions.DelimitedExt
+            };
             IMessage message;
             try
             {
@@ -76,23 +93,53 @@
                         JsonParser parser = new JsonParser(new JsonParser.Settings(20, typeRegistry).WithIgnoreUnknownFields(ignoreUnknownFields));
                         message = request.MessageType switch
                         {
-                            "protobuf_test_messages.proto3.TestAllTypesProto3" => parser.Parse<ProtobufTestMessages.Proto3.TestAllTypesProto3>(request.JsonPayload),
-                            "protobuf_test_messages.proto2.TestAllTypesProto2" => parser.Parse<ProtobufTestMessages.Proto2.TestAllTypesProto2>(request.JsonPayload),
-                            _ => throw new Exception($" Protobuf request doesn't have specific payload type ({request.MessageType})"),
+                          "protobuf_test_messages.proto2.TestAllTypesProto2" =>
+                              parser.Parse<ProtobufTestMessages.Proto2.TestAllTypesProto2>(
+                                  request.JsonPayload),
+                          "protobuf_test_messages.proto3.TestAllTypesProto3" =>
+                              parser.Parse<ProtobufTestMessages.Proto3.TestAllTypesProto3>(
+                                  request.JsonPayload),
+                          "protobuf_test_messages.editions.TestAllTypesEdition2023" =>
+                              parser.Parse<ProtobufTestMessages.Editions.TestAllTypesEdition2023>(
+                                  request.JsonPayload),
+                          "protobuf_test_messages.editions.proto2.TestAllTypesProto2" =>
+                              parser.Parse<ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2>(
+                                  request.JsonPayload),
+                          "protobuf_test_messages.editions.proto3.TestAllTypesProto3" =>
+                              parser.Parse<ProtobufTestMessages.Editions.Proto3.TestAllTypesProto3>(
+                                  request.JsonPayload),
+                          _ => throw new Exception(
+                              $" Protobuf request doesn't have specific payload type ({request.MessageType})"),
                         };
                         break;
                     case ConformanceRequest.PayloadOneofCase.ProtobufPayload:
-                        message = request.MessageType switch
-                        {
-                            "protobuf_test_messages.proto3.TestAllTypesProto3" => ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser.ParseFrom(request.ProtobufPayload),
-                            "protobuf_test_messages.proto2.TestAllTypesProto2" => ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser
-                                                                .WithExtensionRegistry(proto2ExtensionRegistry)
-                                                                .ParseFrom(request.ProtobufPayload),
-                            _ => throw new Exception($" Protobuf request doesn't have specific payload type ({request.MessageType})"),
-                        };
-                        break;
-					case ConformanceRequest.PayloadOneofCase.TextPayload:
-						return new ConformanceResponse { Skipped = "CSharp doesn't support text format" };
+                      message = request.MessageType switch
+                      {
+                        "protobuf_test_messages.proto2.TestAllTypesProto2" =>
+                            ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser
+                                .WithExtensionRegistry(proto2ExtensionRegistry)
+                                .ParseFrom(request.ProtobufPayload),
+                        "protobuf_test_messages.proto3.TestAllTypesProto3" =>
+                            ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser.ParseFrom(
+                                request.ProtobufPayload),
+                        "protobuf_test_messages.editions.TestAllTypesEdition2023" =>
+                            ProtobufTestMessages.Editions.TestAllTypesEdition2023.Parser
+                                .WithExtensionRegistry(edition2023ExtensionRegistry)
+                                .ParseFrom(request.ProtobufPayload),
+                        "protobuf_test_messages.editions.proto2.TestAllTypesProto2" =>
+                            ProtobufTestMessages.Editions.Proto2.TestAllTypesProto2.Parser
+                                .WithExtensionRegistry(editionsProto2ExtensionRegistry)
+                                .ParseFrom(request.ProtobufPayload),
+                        "protobuf_test_messages.editions.proto3.TestAllTypesProto3" =>
+                            ProtobufTestMessages.Editions.Proto3.TestAllTypesProto3.Parser
+                                .ParseFrom(request.ProtobufPayload),
+                        _ => throw new Exception(
+                            $" Protobuf request doesn't have specific payload type ({request.MessageType})"),
+                      };
+                      break;
+                    case ConformanceRequest.PayloadOneofCase.TextPayload:
+                      return new ConformanceResponse { Skipped =
+                                                           "CSharp doesn't support text format" };
                     default:
                         throw new Exception("Unsupported request payload: " + request.PayloadCase);
                 }
@@ -115,7 +162,7 @@
                     case global::Conformance.WireFormat.Protobuf:
                         return new ConformanceResponse { ProtobufPayload = message.ToByteString() };
                     default:
-                        throw new Exception("Unsupported request output format: " + request.RequestedOutputFormat);
+                        return new ConformanceResponse { Skipped = "CSharp doesn't support text format" };
                 }
             }
             catch (InvalidOperationException e)