             132, 1,
         ]
         let inputGroupData = Data(inputGroup)
-
-        // Normal decode should put everything into unknowns.
-        let msg5 = try ProtobufUnittest_TestAllTypes(serializedData: inputGroupData)
-        XCTAssertTrue(msg5.unknownFields.data.isEmpty)
-        XCTAssertEqual(msg5.optionalGroup.unknownFields.data, inputCurrentLevelData)
-
-        let msg6 = try ProtobufUnittest_TestAllTypes(serializedData: inputGroupData,
-                                                      options: discardOptions)
-        XCTAssertTrue(msg6.unknownFields.data.isEmpty)
-        XCTAssertTrue(msg6.optionalGroup.unknownFields.data.isEmpty)
+        do {
+            let msg1 = try ProtobufUnittest_TestAllExtensions(
+              serializedData: inputGroupData,
+              extensions: ProtobufUnittest_Unittest_Extensions)
+            XCTAssertTrue(msg1.unknownFields.data.isEmpty)
+            XCTAssertEqual(msg1.ProtobufUnittest_optionalGroupExtension.unknownFields.data,
+                           inputCurrentLevelData)
+
+            let msg2 = try ProtobufUnittest_TestAllExtensions(
+              serializedData: inputGroupData,
+              extensions: ProtobufUnittest_Unittest_Extensions,
+              options: discardOptions)
+            XCTAssertTrue(msg2.unknownFields.data.isEmpty)
+            XCTAssertTrue(msg2.ProtobufUnittest_optionalGroupExtension.unknownFields.data.isEmpty)
+        }
+
+        // Unknown fields nested within a group extension field:
+        //   [protobuf_unittest.optionalgroup_extension] {
+        //     2: 1
+        //     3: 0x0000000000000002
+        //     4: "\003"
+        //     5 {
+        //       7: 4
+        //     }
+        //     6: 0x00000005
+        //   }
+        do {
+            let msg1 = try ProtobufUnittest_TestAllTypes(serializedData: inputGroupData)
+            XCTAssertTrue(msg1.unknownFields.data.isEmpty)
+            XCTAssertEqual(msg1.optionalGroup.unknownFields.data, inputCurrentLevelData)
+
+            let msg2 = try ProtobufUnittest_TestAllTypes(serializedData: inputGroupData,
+                                                          options: discardOptions)
+            XCTAssertTrue(msg2.unknownFields.data.isEmpty)
+            XCTAssertTrue(msg2.optionalGroup.unknownFields.data.isEmpty)
+        }
 
         // An unknown enum value. proto2 syntax unknown enums uses a different code
         // path to end up in unknown fiels, so ensure that is honoring the option.

            146, 1, UInt8(inputCurrentLevel.count),
        ] + inputCurrentLevel
        let inputSubMessageData = Data(inputSubMessage)

        // Normal decode should put everything into unknowns.
        let msg3 = try ProtobufUnittest_TestAllTypes(serializedData: inputSubMessageData)
        XCTAssertTrue(msg3.unknownFields.data.isEmpty)
        XCTAssertEqual(msg3.optionalNestedMessage.unknownFields.data, inputCurrentLevelData)

        let msg4 = try ProtobufUnittest_TestAllTypes(serializedData: inputSubMessageData,
                                                      options: discardOptions)
        XCTAssertTrue(msg4.unknownFields.data.isEmpty)
        XCTAssertTrue(msg4.optionalNestedMessage.unknownFields.data.isEmpty)

        // Unknown fields nested within a group field:
        //   OptionalGroup {

            168, 1, 13
        ]
        let inputUnknownEnumData = Data(inputUnknownEnum)
        do {
            let msg1 = try ProtobufUnittest_TestAllTypes(serializedData: inputUnknownEnumData)
            XCTAssertEqual(msg1.unknownFields.data, inputUnknownEnumData)

            let msg2 = try ProtobufUnittest_TestAllTypes(serializedData: inputUnknownEnumData,
                                                          options: discardOptions)
            XCTAssertTrue(msg2.unknownFields.data.isEmpty)
        }
    }
}
