فهرست منبع

Revert "Add test for non protobuf identifier handling."

This reverts commit 8d80630516e797f62a6fa41174e5bc6694832eed.

I've seen this trip up in one case already, so going to just remove it. As
mentioned before, there is unittest coverage, this was more like integration
testing, but isn't worth the potential issues since source and live on lots of
file systems where bad things can happen with encodings.
Thomas Van Lenten 6 سال پیش
والد
کامیت
92e46a4ede

+ 0 - 1
Makefile

@@ -124,7 +124,6 @@ TEST_PROTOS= \
 	Protos/unittest_swift_extension4.proto \
 	Protos/unittest_swift_fieldorder.proto \
 	Protos/unittest_swift_groups.proto \
-	Protos/unittest_swift_größ.proto \
 	Protos/unittest_swift_naming.proto \
 	Protos/unittest_swift_naming_no_prefix.proto \
 	Protos/unittest_swift_naming_number_prefix.proto \

+ 0 - 27
Protos/unittest_swift_größ.proto

@@ -1,27 +0,0 @@
-// Protos/unittest_swift_größ.proto - test proto
-//
-// This source file is part of the Swift.org open source project
-//
-// Copyright (c) 2020 Apple Inc. and the Swift project authors
-// Licensed under Apache License v2.0 with Runtime Library Exception
-//
-// See http://swift.org/LICENSE.txt for license information
-// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
-//
-// -----------------------------------------------------------------------------
-///
-/// Test Swift reserved words used as enum or message names
-///
-// -----------------------------------------------------------------------------
-
-syntax = "proto2";
-
-// No package or Swift prefix.
-
-message ToExtend {
-  extensions 1 to 5000;
-}
-
-extend ToExtend {
-  optional int32 added = 101;
-}

+ 0 - 113
Reference/unittest_swift_größ.pb.swift

@@ -1,113 +0,0 @@
-// DO NOT EDIT.
-//
-// Generated by the Swift generator plugin for the protocol buffer compiler.
-// Source: unittest_swift_größ.proto
-//
-// For information on using the generated types, please see the documentation:
-//   https://github.com/apple/swift-protobuf/
-
-// Protos/unittest_swift_größ.proto - test proto
-//
-// This source file is part of the Swift.org open source project
-//
-// Copyright (c) 2020 Apple Inc. and the Swift project authors
-// Licensed under Apache License v2.0 with Runtime Library Exception
-//
-// See http://swift.org/LICENSE.txt for license information
-// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
-//
-// -----------------------------------------------------------------------------
-///
-/// Test Swift reserved words used as enum or message names
-///
-// -----------------------------------------------------------------------------
-
-import Foundation
-import SwiftProtobuf
-
-// If the compiler emits an error on this type, it is because this file
-// was generated by a version of the `protoc` Swift plug-in that is
-// incompatible with the version of SwiftProtobuf to which you are linking.
-// Please ensure that you are building against the same version of the API
-// that was used to generate this file.
-fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
-  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
-  typealias Version = _2
-}
-
-struct ToExtend: SwiftProtobuf.ExtensibleMessage {
-  // SwiftProtobuf.Message conformance is added in an extension below. See the
-  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
-  // methods supported on all messages.
-
-  var unknownFields = SwiftProtobuf.UnknownStorage()
-
-  init() {}
-
-  var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
-}
-
-// MARK: - Extension support defined in unittest_swift_größ.proto.
-
-extension ToExtend {
-
-  var added: Int32 {
-    get {return getExtensionValue(ext: Extensions_added) ?? 0}
-    set {setExtensionValue(ext: Extensions_added, value: newValue)}
-  }
-  /// Returns true if extension `Extensions_added`
-  /// has been explicitly set.
-  var hasAdded: Bool {
-    return hasExtensionValue(ext: Extensions_added)
-  }
-  /// Clears the value of extension `Extensions_added`.
-  /// Subsequent reads from it will return its default value.
-  mutating func clearAdded() {
-    clearExtensionValue(ext: Extensions_added)
-  }
-
-}
-
-/// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
-/// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
-/// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
-/// a larger `SwiftProtobuf.SimpleExtensionMap`.
-let UnittestSwiftGröß_Extensions: SwiftProtobuf.SimpleExtensionMap = [
-  Extensions_added
-]
-
-let Extensions_added = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, ToExtend>(
-  _protobuf_fieldNumber: 101,
-  fieldName: "added"
-)
-
-// MARK: - Code below here is support for the SwiftProtobuf runtime.
-
-extension ToExtend: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
-  static let protoMessageName: String = "ToExtend"
-  static let _protobuf_nameMap = SwiftProtobuf._NameMap()
-
-  public var isInitialized: Bool {
-    if !_protobuf_extensionFieldValues.isInitialized {return false}
-    return true
-  }
-
-  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
-    while let fieldNumber = try decoder.nextFieldNumber() {
-      if (1 <= fieldNumber && fieldNumber < 5001) {
-        try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: ToExtend.self, fieldNumber: fieldNumber)
-      }
-    }
-  }
-
-  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
-    try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 5001)
-    try unknownFields.traverse(visitor: &visitor)
-  }
-
-  static func ==(lhs: ToExtend, rhs: ToExtend) -> Bool {
-    if lhs.unknownFields != rhs.unknownFields {return false}
-    if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
-    return true
-  }
-}

+ 0 - 8
SwiftProtobuf.xcodeproj/project.pbxproj

@@ -539,9 +539,6 @@
 		F48FDD281E4D18060061D5C1 /* Test_TextFormat_proto3.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCCA0E751DB123F800957D74 /* Test_TextFormat_proto3.swift */; };
 		F48FDD291E4D18080061D5C1 /* Test_TextFormat_proto2_extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C5890A51DFF5EC8001CFC34 /* Test_TextFormat_proto2_extensions.swift */; };
 		F48FDD2A1E4D18080061D5C1 /* Test_TextFormat_proto3.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCCA0E751DB123F800957D74 /* Test_TextFormat_proto3.swift */; };
-		F498732323F307930077F336 /* unittest_swift_größ.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F498732223F307930077F336 /* unittest_swift_größ.pb.swift */; };
-		F498732423F307930077F336 /* unittest_swift_größ.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F498732223F307930077F336 /* unittest_swift_größ.pb.swift */; };
-		F498732523F307930077F336 /* unittest_swift_größ.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F498732223F307930077F336 /* unittest_swift_größ.pb.swift */; };
 		F49B576B2252771700350FFD /* TextFormatEncodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49B576A2252771700350FFD /* TextFormatEncodingOptions.swift */; };
 		F49B576C2252771700350FFD /* TextFormatEncodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49B576A2252771700350FFD /* TextFormatEncodingOptions.swift */; };
 		F49B576D2252771700350FFD /* TextFormatEncodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F49B576A2252771700350FFD /* TextFormatEncodingOptions.swift */; };
@@ -796,7 +793,6 @@
 		F482B6911E857BBC00A25EF8 /* unittest_swift_naming_no_prefix.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = unittest_swift_naming_no_prefix.pb.swift; sourceTree = "<group>"; };
 		F482B6B21E89940E00A25EF8 /* Version.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Version.swift; sourceTree = "<group>"; };
 		F48769F723020B7D00D44224 /* descriptor.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = descriptor.pb.swift; sourceTree = "<group>"; };
-		F498732223F307930077F336 /* unittest_swift_größ.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "unittest_swift_größ.pb.swift"; sourceTree = "<group>"; };
 		F49B576A2252771700350FFD /* TextFormatEncodingOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFormatEncodingOptions.swift; sourceTree = "<group>"; };
 		F4A07B2A1E4A3E500035678A /* test_messages_proto3.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = test_messages_proto3.pb.swift; sourceTree = "<group>"; };
 		F4A1A8AB1E65E2EA0022E078 /* map_proto2_unittest.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = map_proto2_unittest.pb.swift; sourceTree = "<group>"; };
@@ -1172,7 +1168,6 @@
 				F4D315441DEC8110005D4A80 /* unittest_swift_extension3.pb.swift */,
 				F4D315521DECA0E5005D4A80 /* unittest_swift_extension4.pb.swift */,
 				__PBXFileRef_Tests/ProtobufTests/unittest_swift_fieldorder.pb.swift /* unittest_swift_fieldorder.pb.swift */,
-				F498732223F307930077F336 /* unittest_swift_größ.pb.swift */,
 				__PBXFileRef_Tests/ProtobufTests/unittest_swift_groups.pb.swift /* unittest_swift_groups.pb.swift */,
 				F482B6911E857BBC00A25EF8 /* unittest_swift_naming_no_prefix.pb.swift */,
 				F47CF9A023E88DD000C7B24C /* unittest_swift_naming_number_prefix.pb.swift */,
@@ -1432,7 +1427,6 @@
 				9C8CDA3A1D7A28F600E207CA /* Test_RecursiveMap.swift in Sources */,
 				9C60CBE91DF8AC3F00F7B14E /* Test_TextFormat_Map_proto3.swift in Sources */,
 				9C8CDA3B1D7A28F600E207CA /* Test_Required.swift in Sources */,
-				F498732423F307930077F336 /* unittest_swift_größ.pb.swift in Sources */,
 				9C8CDA3C1D7A28F600E207CA /* Test_Reserved.swift in Sources */,
 				9C8CDA3D1D7A28F600E207CA /* Test_Struct.swift in Sources */,
 				9C8CDA3E1D7A28F600E207CA /* Test_Timestamp.swift in Sources */,
@@ -1730,7 +1724,6 @@
 				9C60CBEC1DF9DEEA00F7B14E /* Test_TextFormat_proto2.swift in Sources */,
 				9C5890A71DFF5FFC001CFC34 /* Test_TextFormat_proto2_extensions.swift in Sources */,
 				BCCA0E7A1DB124B800957D74 /* Test_TextFormat_proto3.swift in Sources */,
-				F498732323F307930077F336 /* unittest_swift_größ.pb.swift in Sources */,
 				9CCD5F931E008203002D1940 /* Test_TextFormat_WKT_proto3.swift in Sources */,
 				F44F943A1DBFBB7400BC5B85 /* Test_BasicFields_Access_Proto3.swift in Sources */,
 				F44F94351DBF9AEA00BC5B85 /* Test_BasicFields_Access_Proto2.swift in Sources */,
@@ -1939,7 +1932,6 @@
 				9C60CBEE1DF9DEEA00F7B14E /* Test_TextFormat_proto2.swift in Sources */,
 				F44F93F81DAEA8C900BC5B85 /* unittest.pb.swift in Sources */,
 				F44F93E81DAEA8C900BC5B85 /* unittest_proto3_arena.pb.swift in Sources */,
-				F498732523F307930077F336 /* unittest_swift_größ.pb.swift in Sources */,
 				9C60CBEA1DF8AC3F00F7B14E /* Test_TextFormat_Map_proto3.swift in Sources */,
 				F44F93F21DAEA8C900BC5B85 /* unittest_swift_performance.pb.swift in Sources */,
 				F44F93B41DAEA8C900BC5B85 /* Test_Api.swift in Sources */,

+ 1 - 2
Tests/LinuxMain.swift

@@ -780,8 +780,7 @@ extension Test_ValidIdentifiers {
     static var allTests = [
         ("testFieldNames", testFieldNames),
         ("testOneofNames", testOneofNames),
-        ("testEnumCaseNames", testEnumCaseNames),
-        ("testExtensionMapNaming", testExtensionMapNaming)
+        ("testEnumCaseNames", testEnumCaseNames)
     ]
 }
 

+ 0 - 5
Tests/SwiftProtobufTests/Test_Naming.swift

@@ -910,9 +910,4 @@ class Test_ValidIdentifiers: XCTestCase {
     msg.enumField = ._2
     msg.enumField = ._3Value
   }
-
-  func testExtensionMapNaming() {
-    // Symbol should exist based on the unittest_swift_größ.proto name.
-    let _ = UnittestSwiftGröß_Extensions
-  }
 }

+ 0 - 113
Tests/SwiftProtobufTests/unittest_swift_größ.pb.swift

@@ -1,113 +0,0 @@
-// DO NOT EDIT.
-//
-// Generated by the Swift generator plugin for the protocol buffer compiler.
-// Source: unittest_swift_größ.proto
-//
-// For information on using the generated types, please see the documentation:
-//   https://github.com/apple/swift-protobuf/
-
-// Protos/unittest_swift_größ.proto - test proto
-//
-// This source file is part of the Swift.org open source project
-//
-// Copyright (c) 2020 Apple Inc. and the Swift project authors
-// Licensed under Apache License v2.0 with Runtime Library Exception
-//
-// See http://swift.org/LICENSE.txt for license information
-// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
-//
-// -----------------------------------------------------------------------------
-///
-/// Test Swift reserved words used as enum or message names
-///
-// -----------------------------------------------------------------------------
-
-import Foundation
-import SwiftProtobuf
-
-// If the compiler emits an error on this type, it is because this file
-// was generated by a version of the `protoc` Swift plug-in that is
-// incompatible with the version of SwiftProtobuf to which you are linking.
-// Please ensure that you are building against the same version of the API
-// that was used to generate this file.
-fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
-  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
-  typealias Version = _2
-}
-
-struct ToExtend: SwiftProtobuf.ExtensibleMessage {
-  // SwiftProtobuf.Message conformance is added in an extension below. See the
-  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
-  // methods supported on all messages.
-
-  var unknownFields = SwiftProtobuf.UnknownStorage()
-
-  init() {}
-
-  var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
-}
-
-// MARK: - Extension support defined in unittest_swift_größ.proto.
-
-extension ToExtend {
-
-  var added: Int32 {
-    get {return getExtensionValue(ext: Extensions_added) ?? 0}
-    set {setExtensionValue(ext: Extensions_added, value: newValue)}
-  }
-  /// Returns true if extension `Extensions_added`
-  /// has been explicitly set.
-  var hasAdded: Bool {
-    return hasExtensionValue(ext: Extensions_added)
-  }
-  /// Clears the value of extension `Extensions_added`.
-  /// Subsequent reads from it will return its default value.
-  mutating func clearAdded() {
-    clearExtensionValue(ext: Extensions_added)
-  }
-
-}
-
-/// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
-/// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
-/// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
-/// a larger `SwiftProtobuf.SimpleExtensionMap`.
-let UnittestSwiftGröß_Extensions: SwiftProtobuf.SimpleExtensionMap = [
-  Extensions_added
-]
-
-let Extensions_added = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, ToExtend>(
-  _protobuf_fieldNumber: 101,
-  fieldName: "added"
-)
-
-// MARK: - Code below here is support for the SwiftProtobuf runtime.
-
-extension ToExtend: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
-  static let protoMessageName: String = "ToExtend"
-  static let _protobuf_nameMap = SwiftProtobuf._NameMap()
-
-  public var isInitialized: Bool {
-    if !_protobuf_extensionFieldValues.isInitialized {return false}
-    return true
-  }
-
-  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
-    while let fieldNumber = try decoder.nextFieldNumber() {
-      if (1 <= fieldNumber && fieldNumber < 5001) {
-        try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: ToExtend.self, fieldNumber: fieldNumber)
-      }
-    }
-  }
-
-  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
-    try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 5001)
-    try unknownFields.traverse(visitor: &visitor)
-  }
-
-  static func ==(lhs: ToExtend, rhs: ToExtend) -> Bool {
-    if lhs.unknownFields != rhs.unknownFields {return false}
-    if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
-    return true
-  }
-}