diff options
author | Joe George <joe@zeroc.com> | 2019-06-12 15:05:41 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2019-06-12 15:05:41 -0400 |
commit | 21b4cc1ccae3d8995b78cd07d9de118f89b8e248 (patch) | |
tree | 99a8470c2ff3522ef229e7a37b95a8e2402fd93a | |
parent | Fix typo (diff) | |
download | ice-21b4cc1ccae3d8995b78cd07d9de118f89b8e248.tar.bz2 ice-21b4cc1ccae3d8995b78cd07d9de118f89b8e248.tar.xz ice-21b4cc1ccae3d8995b78cd07d9de118f89b8e248.zip |
Run swiftformat over all Swift files
119 files changed, 1835 insertions, 1866 deletions
diff --git a/swift/.swiftformat b/swift/.swiftformat new file mode 100644 index 00000000000..1c94cf5c4f3 --- /dev/null +++ b/swift/.swiftformat @@ -0,0 +1 @@ +--commas "inline" diff --git a/swift/src/Ice/ConnectionI.swift b/swift/src/Ice/ConnectionI.swift index f7f969b03af..136ffd6a3bd 100644 --- a/swift/src/Ice/ConnectionI.swift +++ b/swift/src/Ice/ConnectionI.swift @@ -14,13 +14,13 @@ public extension Connection { let sentCB = createSentCallback(sentOn: sentOn, sentFlags: sentFlags, sent: sent) return Promise<Void> { seal in impl.handle.flushBatchRequestsAsync(compress.rawValue, - exception: { error in seal.reject(error) }, - sent: { - seal.fulfill(()) - if let sentCB = sentCB { - sentCB($0) - } - }) + exception: { error in seal.reject(error) }, + sent: { + seal.fulfill(()) + if let sentCB = sentCB { + sentCB($0) + } + }) } } @@ -30,9 +30,9 @@ public extension Connection { let impl = self as! ConnectionI return Promise<Void> { seal in impl.handle.heartbeatAsync(exception: { error in seal.reject(error) }, - sent: createSentCallback(sentOn: sentOn, - sentFlags: sentFlags, - sent: sent)) + sent: createSentCallback(sentOn: sentOn, + sentFlags: sentFlags, + sent: sent)) } } diff --git a/swift/src/Ice/ConnectionInfoFactory.swift b/swift/src/Ice/ConnectionInfoFactory.swift index de2ead8095d..bb0766c3b7a 100644 --- a/swift/src/Ice/ConnectionInfoFactory.swift +++ b/swift/src/Ice/ConnectionInfoFactory.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import IceObjc import Foundation +import IceObjc private class ConnectionInfoI: ConnectionInfo { var underlying: ConnectionInfo? diff --git a/swift/src/Ice/Exception.swift b/swift/src/Ice/Exception.swift index 3ab86c4f059..474c9fa7e34 100644 --- a/swift/src/Ice/Exception.swift +++ b/swift/src/Ice/Exception.swift @@ -86,7 +86,7 @@ open class UserException: Exception { public class RuntimeError: LocalException { private let message: String - override public var description: String { + public override var description: String { return message } diff --git a/swift/src/Ice/ObjectAdapterI.swift b/swift/src/Ice/ObjectAdapterI.swift index 350b5309274..81289f872dd 100644 --- a/swift/src/Ice/ObjectAdapterI.swift +++ b/swift/src/Ice/ObjectAdapterI.swift @@ -137,24 +137,24 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEBlobjectF func createProxy(_ id: Identity) throws -> ObjectPrx { precondition(!id.name.isEmpty, "Identity cannot have an empty name") return try autoreleasepool { - return try ObjectPrxI(handle: handle.createProxy(name: id.name, category: id.category), - communicator: communicator) + try ObjectPrxI(handle: handle.createProxy(name: id.name, category: id.category), + communicator: communicator) } } func createDirectProxy(_ id: Identity) throws -> ObjectPrx { precondition(!id.name.isEmpty, "Identity cannot have an empty name") return try autoreleasepool { - return try ObjectPrxI(handle: handle.createDirectProxy(name: id.name, category: id.category), - communicator: communicator) + try ObjectPrxI(handle: handle.createDirectProxy(name: id.name, category: id.category), + communicator: communicator) } } func createIndirectProxy(_ id: Identity) throws -> ObjectPrx { precondition(!id.name.isEmpty, "Identity cannot have an empty name") return try autoreleasepool { - return try ObjectPrxI(handle: handle.createIndirectProxy(name: id.name, category: id.category), - communicator: communicator) + try ObjectPrxI(handle: handle.createIndirectProxy(name: id.name, category: id.category), + communicator: communicator) } } diff --git a/swift/test/Ice/acm/Client.swift b/swift/test/Ice/acm/Client.swift index 1c4f5a3221f..344d3f36819 100644 --- a/swift/test/Ice/acm/Client.swift +++ b/swift/test/Ice/acm/Client.swift @@ -2,17 +2,16 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Client: TestHelperI { - override func run(args: [String]) throws { - + override func run(args: [String]) throws { let properties = try Ice.createProperties(args) properties.setProperty(key: "Ice.Warn.Connections", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/acm/Server.swift b/swift/test/Ice/acm/Server.swift index fac21ebc502..53271f272eb 100644 --- a/swift/test/Ice/acm/Server.swift +++ b/swift/test/Ice/acm/Server.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Server: TestHelperI { @@ -12,7 +12,7 @@ class Server: TestHelperI { properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.ACM.Timeout", value: "1") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/acm/TestI.swift b/swift/test/Ice/acm/TestI.swift index 04d2a4b0528..e30a60938cf 100644 --- a/swift/test/Ice/acm/TestI.swift +++ b/swift/test/Ice/acm/TestI.swift @@ -36,7 +36,8 @@ class RemoteCommunicatorI: RemoteCommunicator { return try uncheckedCast( prx: current.adapter!.addWithUUID(RemoteObjectAdapterDisp(RemoteObjectAdapterI(adapter: adapter))), - type: RemoteObjectAdapterPrx.self) + type: RemoteObjectAdapterPrx.self + ) } func shutdown(current: Ice.Current) throws { diff --git a/swift/test/Ice/adapterDeactivation/AllTests.swift b/swift/test/Ice/adapterDeactivation/AllTests.swift index 01ff839cee9..86024ac5ff3 100644 --- a/swift/test/Ice/adapterDeactivation/AllTests.swift +++ b/swift/test/Ice/adapterDeactivation/AllTests.swift @@ -6,7 +6,6 @@ import Ice import TestCommon func allTests(_ helper: TestHelper) throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -48,7 +47,7 @@ func allTests(_ helper: TestHelper) throws { do { output.write("testing connection closure... ") - for _ in 0..<10 { + for _ in 0 ..< 10 { var initData = Ice.InitializationData() initData.properties = communicator.getProperties().clone() let comm = try Ice.initialize(initData) @@ -67,19 +66,19 @@ func allTests(_ helper: TestHelper) throws { let endpt = adapter.getPublishedEndpoints()[0] try test(endpt.toString() == "tcp -h localhost -p 12345 -t 30000") let prx = try communicator.stringToProxy("dummy:tcp -h localhost -p 12346 -t 20000:" + - "tcp -h localhost -p 12347 -t 10000")! + "tcp -h localhost -p 12347 -t 10000")! try adapter.setPublishedEndpoints(prx.ice_getEndpoints()) try test(adapter.getPublishedEndpoints().count == 2) var id = Ice.Identity() id.name = "dummy" - try test(adapter.createProxy(id).ice_getEndpoints().elementsEqual(prx.ice_getEndpoints()) { $0 == $1}) + try test(adapter.createProxy(id).ice_getEndpoints().elementsEqual(prx.ice_getEndpoints()) { $0 == $1 }) try test(adapter.getPublishedEndpoints().elementsEqual(prx.ice_getEndpoints()) { $0 == $1 }) try adapter.refreshPublishedEndpoints() try test(adapter.getPublishedEndpoints().count == 1) try test(adapter.getPublishedEndpoints()[0] == endpt) communicator.getProperties().setProperty(key: "PAdapter.PublishedEndpoints", - value: "tcp -h localhost -p 12345 -t 20000") + value: "tcp -h localhost -p 12345 -t 20000") try adapter.refreshPublishedEndpoints() try test(adapter.getPublishedEndpoints().count == 1) try test(adapter.getPublishedEndpoints()[0].toString() == "tcp -h localhost -p 12345 -t 20000") diff --git a/swift/test/Ice/adapterDeactivation/Client.swift b/swift/test/Ice/adapterDeactivation/Client.swift index a19a4253464..cbca6f8fce7 100644 --- a/swift/test/Ice/adapterDeactivation/Client.swift +++ b/swift/test/Ice/adapterDeactivation/Client.swift @@ -7,7 +7,7 @@ import TestCommon class Client: TestHelperI { override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/adapterDeactivation/Collocated.swift b/swift/test/Ice/adapterDeactivation/Collocated.swift index ddb9abfad0a..6695d431a28 100644 --- a/swift/test/Ice/adapterDeactivation/Collocated.swift +++ b/swift/test/Ice/adapterDeactivation/Collocated.swift @@ -2,13 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Collocated: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/adapterDeactivation/Server.swift b/swift/test/Ice/adapterDeactivation/Server.swift index ae1f4dd6e12..08c68bf29a6 100644 --- a/swift/test/Ice/adapterDeactivation/Server.swift +++ b/swift/test/Ice/adapterDeactivation/Server.swift @@ -2,13 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Server: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/adapterDeactivation/TestI.swift b/swift/test/Ice/adapterDeactivation/TestI.swift index ba33dbd9ef1..23373babd71 100644 --- a/swift/test/Ice/adapterDeactivation/TestI.swift +++ b/swift/test/Ice/adapterDeactivation/TestI.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import Ice import Foundation +import Ice import TestCommon class TestI: TestIntf { @@ -31,11 +31,11 @@ class CookieI: Cookie { } class RouterI: Ice.Router { - func getClientProxy(current: Ice.Current) throws -> (returnValue: ObjectPrx?, hasRoutingTable: Bool?) { + func getClientProxy(current _: Ice.Current) throws -> (returnValue: ObjectPrx?, hasRoutingTable: Bool?) { return (nil, false) } - func addProxies(proxies: [ObjectPrx?], current: Current) throws -> [ObjectPrx?] { + func addProxies(proxies _: [ObjectPrx?], current _: Current) throws -> [ObjectPrx?] { return [] } @@ -79,7 +79,7 @@ class ServantLocatorI: Ice.ServantLocator { return (TestIntfDisp(TestI()), CookieI()) } - func finished(curr current: Ice.Current, servant: Ice.Disp, cookie: Swift.AnyObject?) throws { + func finished(curr current: Ice.Current, servant _: Ice.Disp, cookie: Swift.AnyObject?) throws { try withLock(&_lock) { try _helper.test(!_deactivated) } diff --git a/swift/test/Ice/admin/AllTests.swift b/swift/test/Ice/admin/AllTests.swift index c403354e6f4..10f89a1a084 100644 --- a/swift/test/Ice/admin/AllTests.swift +++ b/swift/test/Ice/admin/AllTests.swift @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class RemoteLoggerI: Ice.RemoteLogger { var _helper: TestHelper @@ -19,7 +19,7 @@ class RemoteLoggerI: Ice.RemoteLogger { _helper = helper } - func `init`(prefix: String, logMessages: [Ice.LogMessage], current: Ice.Current) throws { + func `init`(prefix: String, logMessages: [Ice.LogMessage], current _: Ice.Current) throws { withLock(&_lock) { _prefix = prefix _initMessages += logMessages @@ -28,7 +28,7 @@ class RemoteLoggerI: Ice.RemoteLogger { } } - func log(message: Ice.LogMessage, current: Ice.Current) throws { + func log(message: Ice.LogMessage, current _: Ice.Current) throws { withLock(&_lock) { _logMessages.append(message) _receivedCalls += 1 @@ -265,9 +265,10 @@ func allTests(_ helper: TestHelper) throws { let setProps = [ "Prop1": "10", // Changed "Prop2": "20", // Changed - "Prop3": "", // Removed - "Prop4": "4", // Added - "Prop5": "5"] // Added + "Prop3": "", // Removed + "Prop4": "4", // Added + "Prop5": "5" // Added + ] try pa.setProperties(setProps) try test(pa.getProperty("Prop1") == "10") try test(pa.getProperty("Prop2") == "20") @@ -294,7 +295,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "NullLogger": "1"] + "NullLogger": "1" + ] let com = try factory.createCommunicator(props)! @@ -314,7 +316,7 @@ func allTests(_ helper: TestHelper) throws { try test(logMessages.count == 4) try test(prefix == "NullLogger") try test(logMessages[0].traceCategory == "testCat" && - logMessages[0].message == "trace") + logMessages[0].message == "trace") try test(logMessages[1].message == "warning") try test(logMessages[2].message == "error") try test(logMessages[3].message == "print") @@ -337,7 +339,7 @@ func allTests(_ helper: TestHelper) throws { for msg in logMessages { try test(msg.type == Ice.LogMessageType.ErrorMessage || - msg.type == Ice.LogMessageType.WarningMessage) + msg.type == Ice.LogMessageType.WarningMessage) } // @@ -356,7 +358,7 @@ func allTests(_ helper: TestHelper) throws { for msg in logMessages { try test(msg.type == Ice.LogMessageType.ErrorMessage || - (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory == "testCat")) + (msg.type == Ice.LogMessageType.TraceMessage && msg.traceCategory == "testCat")) } // @@ -495,7 +497,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "Ice.Admin.Facets": "Properties"] + "Ice.Admin.Facets": "Properties" + ] let com = try factory.createCommunicator(props)! let obj = try com.getAdmin()! @@ -514,7 +517,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "Ice.Admin.Facets": "Process"] + "Ice.Admin.Facets": "Process" + ] let com = try factory.createCommunicator(props)! let obj = try com.getAdmin()! let pa = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") @@ -532,7 +536,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "Ice.Admin.Facets": "TestFacet"] + "Ice.Admin.Facets": "TestFacet" + ] let com = try factory.createCommunicator(props)! let obj = try com.getAdmin()! @@ -551,7 +556,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "Ice.Admin.Facets": "Properties TestFacet"] + "Ice.Admin.Facets": "Properties TestFacet" + ] let com = try factory.createCommunicator(props)! let obj = try com.getAdmin()! @@ -572,7 +578,8 @@ func allTests(_ helper: TestHelper) throws { let props = [ "Ice.Admin.Endpoints": "tcp -h 127.0.0.1", "Ice.Admin.InstanceName": "Test", - "Ice.Admin.Facets": "TestFacet, Process"] + "Ice.Admin.Facets": "TestFacet, Process" + ] let com = try factory.createCommunicator(props)! let obj = try com.getAdmin()! let pa = try checkedCast(prx: obj, type: Ice.PropertiesAdminPrx.self, facet: "Properties") diff --git a/swift/test/Ice/admin/Client.swift b/swift/test/Ice/admin/Client.swift index b2ce730ae1f..e28df06a089 100644 --- a/swift/test/Ice/admin/Client.swift +++ b/swift/test/Ice/admin/Client.swift @@ -7,7 +7,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/admin/Server.swift b/swift/test/Ice/admin/Server.swift index b2d3212f803..454886b75b3 100644 --- a/swift/test/Ice/admin/Server.swift +++ b/swift/test/Ice/admin/Server.swift @@ -7,12 +7,12 @@ import TestCommon class Server: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", - value: "\(self.getTestEndpoint(num: 0)) -t 10000") + value: "\(getTestEndpoint(num: 0)) -t 10000") let adapter = try communicator.createObjectAdapter("TestAdapter") let id = try Ice.stringToIdentity("factory") try adapter.add(servant: RemoteCommunicatorFactoryDisp(RemoteCommunicatorFactoryI()), diff --git a/swift/test/Ice/admin/TestI.swift b/swift/test/Ice/admin/TestI.swift index 07adc55b588..545d30e5089 100644 --- a/swift/test/Ice/admin/TestI.swift +++ b/swift/test/Ice/admin/TestI.swift @@ -2,13 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class TestFacetI: TestFacet { - func op(current: Ice.Current) { - } + func op(current _: Ice.Current) {} } class RemoteCommunicatorI: RemoteCommunicator { @@ -20,37 +19,37 @@ class RemoteCommunicatorI: RemoteCommunicator { _communicator = communicator } - func getAdmin(current: Ice.Current) throws -> Ice.ObjectPrx? { + func getAdmin(current _: Ice.Current) throws -> Ice.ObjectPrx? { return try _communicator.getAdmin() } - func getChanges(current: Ice.Current) throws -> [String: String] { + func getChanges(current _: Ice.Current) throws -> [String: String] { return withLock(&_lock) { - return _changes + _changes } } - func print(message: String, current: Ice.Current) throws { + func print(message: String, current _: Ice.Current) throws { _communicator.getLogger().print(message) } - func trace(category: String, message: String, current: Ice.Current) throws { + func trace(category: String, message: String, current _: Ice.Current) throws { _communicator.getLogger().trace(category: category, message: message) } - func warning(message: String, current: Ice.Current) throws { + func warning(message: String, current _: Ice.Current) throws { _communicator.getLogger().warning(message) } - func error(message: String, current: Ice.Current) throws { + func error(message: String, current _: Ice.Current) throws { _communicator.getLogger().error(message) } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _communicator.shutdown() } - func waitForShutdown(current: Ice.Current) throws { + func waitForShutdown(current _: Ice.Current) throws { // // Note that we are executing in a thread of the *main* communicator, // not the one that is being shut down. @@ -58,7 +57,7 @@ class RemoteCommunicatorI: RemoteCommunicator { _communicator.waitForShutdown() } - func destroy(current: Ice.Current) throws { + func destroy(current _: Ice.Current) throws { _communicator.destroy() } @@ -70,23 +69,19 @@ class RemoteCommunicatorI: RemoteCommunicator { } class NullLogger: Ice.Logger { - func print(_ message: String) { - } + func print(_: String) {} - func trace(category: String, message: String) { - } + func trace(category _: String, message _: String) {} - func warning(_ message: String) { - } + func warning(_: String) {} - func error(_ message: String) { - } + func error(_: String) {} func getPrefix() -> String { return "NullLogger" } - func cloneWithPrefix(_ prefix: String) -> Logger { + func cloneWithPrefix(_: String) -> Logger { return self } } @@ -123,7 +118,7 @@ class RemoteCommunicatorFactoryI: RemoteCommunicatorFactory { // let servant = RemoteCommunicatorI(communicator: communicator) - if let propDisp = communicator.findAdminFacet("Properties") as? PropertiesAdminDisp, + if let propDisp = communicator.findAdminFacet("Properties") as? PropertiesAdminDisp, let propFacet = propDisp.servant as? NativePropertiesAdmin { _ = propFacet.addUpdateCallback { changes in servant.updated(changes: changes) diff --git a/swift/test/Ice/ami/Client.swift b/swift/test/Ice/ami/Client.swift index b2ce730ae1f..e28df06a089 100644 --- a/swift/test/Ice/ami/Client.swift +++ b/swift/test/Ice/ami/Client.swift @@ -7,7 +7,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/ami/Collocated.swift b/swift/test/Ice/ami/Collocated.swift index bdec62b40a9..16c17fb8918 100644 --- a/swift/test/Ice/ami/Collocated.swift +++ b/swift/test/Ice/ami/Collocated.swift @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Collocated: TestHelperI { public override func run(args: [String]) throws { @@ -26,7 +26,7 @@ class Collocated: TestHelperI { // properties.setProperty(key: "Ice.TCP.RcvSize", value: "50000") - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/ami/Server.swift b/swift/test/Ice/ami/Server.swift index 4457d7863bc..460ea5f4e0f 100644 --- a/swift/test/Ice/ami/Server.swift +++ b/swift/test/Ice/ami/Server.swift @@ -2,13 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - let properties = try createTestProperties(args) // @@ -29,17 +28,17 @@ class Server: TestHelperI { var initData = Ice.InitializationData() initData.properties = properties - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", - value: getTestEndpoint(num: 0)) + value: getTestEndpoint(num: 0)) communicator.getProperties().setProperty(key: "ControllerAdapter.Endpoints", - value: getTestEndpoint(num: 1)) + value: getTestEndpoint(num: 1)) communicator.getProperties().setProperty(key: "ControllerAdapter.ThreadPool.Size", - value: "1") + value: "1") let adapter = try communicator.createObjectAdapter("TestAdapter") let adapter2 = try communicator.createObjectAdapter("ControllerAdapter") diff --git a/swift/test/Ice/ami/TestI.swift b/swift/test/Ice/ami/TestI.swift index fa3246b449f..b857c98170b 100644 --- a/swift/test/Ice/ami/TestI.swift +++ b/swift/test/Ice/ami/TestI.swift @@ -2,10 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import Ice -import TestCommon import Foundation +import Ice import PromiseKit +import TestCommon class TestI: TestIntf { var _batchCount: Int32 @@ -21,37 +21,37 @@ class TestI: TestIntf { _helper = helper } - func op(current: Current) throws {} + func op(current _: Current) throws {} - func opWithPayload(seq: ByteSeq, current: Current) throws {} + func opWithPayload(seq _: ByteSeq, current _: Current) throws {} - func opWithResult(current: Current) throws -> Int32 { + func opWithResult(current _: Current) throws -> Int32 { return 15 } - func opWithUE(current: Current) throws { + func opWithUE(current _: Current) throws { throw TestIntfException() } - func opWithResultAndUE(current: Current) throws -> Int32 { + func opWithResultAndUE(current _: Current) throws -> Int32 { throw TestIntfException() } - func opWithArgs(current: Current) throws -> (one: Int32, - two: Int32, - three: Int32, - four: Int32, - five: Int32, - six: Int32, - seven: Int32, - eight: Int32, - nine: Int32, - ten: Int32, - eleven: Int32) { + func opWithArgs(current _: Current) throws -> (one: Int32, + two: Int32, + three: Int32, + four: Int32, + five: Int32, + six: Int32, + seven: Int32, + eight: Int32, + nine: Int32, + ten: Int32, + eleven: Int32) { return (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) } - func startDispatchAsync(current: Current) -> Promise<Void> { + func startDispatchAsync(current _: Current) -> Promise<Void> { return withLock(&_lock) { if _shutdown { return Promise.value(()) @@ -70,20 +70,20 @@ class TestI: TestIntf { } } - func opBatch(current: Current) throws { + func opBatch(current _: Current) throws { withLock(&_lock) { _batchCount += 1 _semaphore.signal() } } - func opBatchCount(current: Current) throws -> Int32 { + func opBatchCount(current _: Current) throws -> Int32 { return withLock(&_lock) { - return _batchCount + _batchCount } } - func waitForBatch(count: Int32, current: Current) throws -> Bool { + func waitForBatch(count: Int32, current _: Current) throws -> Bool { while _batchCount < count { if _semaphore.wait(timeout: .now() + .seconds(5)) == .timedOut { try _helper.test(false) @@ -96,18 +96,18 @@ class TestI: TestIntf { func close(mode: CloseMode, current: Current) throws { if let con = current.con, - let closeMode = ConnectionClose(rawValue: mode.rawValue) { + let closeMode = ConnectionClose(rawValue: mode.rawValue) { try con.close(closeMode) } } - func sleep(ms: Int32, current: Current) throws { + func sleep(ms: Int32, current _: Current) throws { withLock(&_lock) { Thread.sleep(forTimeInterval: TimeInterval(ms) / 1000) } } - func finishDispatch(current: Current) throws { + func finishDispatch(current _: Current) throws { withLock(&_lock) { if _shutdown { return @@ -131,35 +131,33 @@ class TestI: TestIntf { current.adapter!.getCommunicator().shutdown() } - func supportsAMD(current: Current) throws -> Bool { + func supportsAMD(current _: Current) throws -> Bool { return true } - func supportsFunctionalTests(current: Current) throws -> Bool { + func supportsFunctionalTests(current _: Current) throws -> Bool { return false } } class TestII: OuterInnerTestIntf { - - func op(i: Int32, current: Ice.Current) throws -> (returnValue: Int32, j: Int32) { + func op(i: Int32, current _: Ice.Current) throws -> (returnValue: Int32, j: Int32) { return (i, i) } } class TestControllerI: TestIntfController { - var _adapter: Ice.ObjectAdapter init(adapter: Ice.ObjectAdapter) { _adapter = adapter } - func holdAdapter(current: Ice.Current) { + func holdAdapter(current _: Ice.Current) { _adapter.hold() } - func resumeAdapter(current: Ice.Current) throws { + func resumeAdapter(current _: Ice.Current) throws { try _adapter.activate() } } diff --git a/swift/test/Ice/binding/AllTests.swift b/swift/test/Ice/binding/AllTests.swift index 6faee18cfd3..56310188772 100644 --- a/swift/test/Ice/binding/AllTests.swift +++ b/swift/test/Ice/binding/AllTests.swift @@ -6,7 +6,7 @@ import TestCommon func createTestIntfPrx(_ adapters: [RemoteObjectAdapterPrx]) throws -> TestIntfPrx { var endpoints: [Ice.Endpoint] = [] - var obj: TestIntfPrx! = nil + var obj: TestIntfPrx! for adapter in adapters { obj = try adapter.getTestIntf()! for e in obj.ice_getEndpoints() { @@ -56,7 +56,10 @@ func allTests(_ helper: TestHelper) throws { try test3.ice_ping() try test(false) } catch is Ice.ConnectFailedException { - } catch is Ice.ConnectTimeoutException {} + // expected + } catch is Ice.ConnectTimeoutException { + // expected + } } output.writeLine("ok") @@ -84,7 +87,7 @@ func allTests(_ helper: TestHelper) throws { try test(test2.ice_getConnection() === test3.ice_getConnection()) let adapterName = try test1.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -133,7 +136,7 @@ func allTests(_ helper: TestHelper) throws { try test(test2.ice_getConnection() === test3.ice_getConnection()) let adapterName = try test1.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -152,11 +155,11 @@ func allTests(_ helper: TestHelper) throws { output.write("testing binding with multiple random endpoints... ") do { - var adapters = [ try com.createObjectAdapter(name: "AdapterRandom11", endpoints: "default")!, - try com.createObjectAdapter(name: "AdapterRandom12", endpoints: "default")!, - try com.createObjectAdapter(name: "AdapterRandom13", endpoints: "default")!, - try com.createObjectAdapter(name: "AdapterRandom14", endpoints: "default")!, - try com.createObjectAdapter(name: "AdapterRandom15", endpoints: "default")!] + var adapters = [try com.createObjectAdapter(name: "AdapterRandom11", endpoints: "default")!, + try com.createObjectAdapter(name: "AdapterRandom12", endpoints: "default")!, + try com.createObjectAdapter(name: "AdapterRandom13", endpoints: "default")!, + try com.createObjectAdapter(name: "AdapterRandom14", endpoints: "default")!, + try com.createObjectAdapter(name: "AdapterRandom15", endpoints: "default")!] var count: Int32 = 20 var adapterCount = adapters.count @@ -168,9 +171,9 @@ func allTests(_ helper: TestHelper) throws { adapterCount -= 1 } - for _ in 0..<10 { + for _ in 0 ..< 10 { var adpts: [RemoteObjectAdapterPrx] = [] - for _ in 0..<Int.random(in: 1...adapters.count) { + for _ in 0 ..< Int.random(in: 1 ... adapters.count) { adpts.append(adapters.randomElement()!) } proxies.append(try createTestIntfPrx(adpts)) @@ -229,7 +232,7 @@ func allTests(_ helper: TestHelper) throws { try test(test2.ice_getConnection() === test3.ice_getConnection()) let adapterName = try test1.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -275,7 +278,7 @@ func allTests(_ helper: TestHelper) throws { try test(test2.ice_getConnection() === test3.ice_getConnection()) let adapterName = try test1.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try test1.ice_getConnection()!.close(.GracefullyWithWait) } @@ -303,7 +306,7 @@ func allTests(_ helper: TestHelper) throws { var names = ["Adapter21", "Adapter22", "Adapter23"] while names.count > 0 { let adapterName = try obj.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -316,7 +319,7 @@ func allTests(_ helper: TestHelper) throws { while names.count > 0 { let adapterName = try obj.getAdapterName() - names.removeAll(where: { $0 == adapterName}) + names.removeAll(where: { $0 == adapterName }) try obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -363,7 +366,9 @@ func allTests(_ helper: TestHelper) throws { do { _ = try obj.getAdapterName() } catch is Ice.ConnectFailedException { + // expected } catch is Ice.ConnectTimeoutException { + // expected } var endpoints = obj.ice_getEndpoints() @@ -412,7 +417,7 @@ func allTests(_ helper: TestHelper) throws { try test(!test1.ice_isConnectionCached()) try test(!test2.ice_isConnectionCached()) try test(test1.ice_getConnection() != nil && - test2.ice_getConnection() != nil) + test2.ice_getConnection() != nil) try test(test1.ice_getConnection() === test2.ice_getConnection()) try test1.ice_ping() @@ -424,7 +429,10 @@ func allTests(_ helper: TestHelper) throws { try test(test3.ice_getConnection() === test1.ice_getConnection()) try test(false) } catch is Ice.ConnectFailedException { - } catch is Ice.ConnectTimeoutException {} + // expected + } catch is Ice.ConnectTimeoutException { + // expected + } } output.writeLine("ok") @@ -535,7 +543,9 @@ func allTests(_ helper: TestHelper) throws { do { _ = try obj.getAdapterName() } catch is Ice.ConnectFailedException { + // expected } catch is Ice.ConnectTimeoutException { + // expected } let endpoints = obj.ice_getEndpoints() @@ -612,7 +622,10 @@ func allTests(_ helper: TestHelper) throws { do { _ = try obj.getAdapterName() } catch is Ice.ConnectFailedException { - } catch is Ice.ConnectTimeoutException {} + // expected + } catch is Ice.ConnectTimeoutException { + // expected + } let endpoints = obj.ice_getEndpoints() @@ -670,7 +683,7 @@ func allTests(_ helper: TestHelper) throws { try com.createObjectAdapter(name: "Adapter82", endpoints: "tcp")!] let obj = try createTestIntfPrx(adapters) - for _ in 0..<5 { + for _ in 0 ..< 5 { try test(obj.getAdapterName() == "Adapter82") try obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -685,7 +698,7 @@ func allTests(_ helper: TestHelper) throws { try com.deactivateObjectAdapter(adapters[1]) - for _ in 0..<5 { + for _ in 0 ..< 5 { try test(obj.getAdapterName() == "Adapter81") try obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -693,7 +706,7 @@ func allTests(_ helper: TestHelper) throws { // Reactive tcp OA. _ = try com.createObjectAdapter(name: "Adapter83", endpoints: obj.ice_getEndpoints()[1].toString()) - for _ in 0..<5 { + for _ in 0 ..< 5 { try test(obj.getAdapterName() == "Adapter83") try obj.ice_getConnection()!.close(.GracefullyWithWait) } @@ -703,7 +716,9 @@ func allTests(_ helper: TestHelper) throws { try testSecure.ice_ping() try test(false) } catch is Ice.ConnectFailedException { + // expected } catch is Ice.ConnectTimeoutException { + // expected } try deactivate(communicator: com, adapters: adapters) @@ -764,7 +779,7 @@ func allTests(_ helper: TestHelper) throws { let serverProps = [anyipv4, anyipv6, anyboth, localipv4, localipv6] var ipv6NotSupported = false - for p in serverProps { + for p in serverProps { var serverInitData = Ice.InitializationData() serverInitData.properties = p let serverCommunicator = try Ice.initialize(serverInitData) @@ -811,12 +826,12 @@ func allTests(_ helper: TestHelper) throws { } catch is Ice.SocketException { try test( (p === ipv4 && q === ipv6) || (p === ipv6 && q === ipv4) || - (p === bothPreferIPv4 && q === ipv6) || (p === bothPreferIPv6 && q === ipv4) || - (p === bothPreferIPv6 && q === ipv6 && ipv6NotSupported) || - (p === anyipv4 && q === ipv6) || (p === anyipv6 && q === ipv4) || - (p === localipv4 && q === ipv6) || (p === localipv6 && q === ipv4) || - (p === ipv6 && q === bothPreferIPv4) || (p === ipv6 && q === bothPreferIPv6) || - (p === bothPreferIPv6 && q === ipv6)) + (p === bothPreferIPv4 && q === ipv6) || (p === bothPreferIPv6 && q === ipv4) || + (p === bothPreferIPv6 && q === ipv6 && ipv6NotSupported) || + (p === anyipv4 && q === ipv6) || (p === anyipv6 && q === ipv4) || + (p === localipv4 && q === ipv6) || (p === localipv6 && q === ipv4) || + (p === ipv6 && q === bothPreferIPv4) || (p === ipv6 && q === bothPreferIPv6) || + (p === bothPreferIPv6 && q === ipv6)) } clientCommunicator.destroy() } diff --git a/swift/test/Ice/binding/Client.swift b/swift/test/Ice/binding/Client.swift index b2ce730ae1f..e28df06a089 100644 --- a/swift/test/Ice/binding/Client.swift +++ b/swift/test/Ice/binding/Client.swift @@ -7,7 +7,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/binding/Server.swift b/swift/test/Ice/binding/Server.swift index c45fa06fb05..54ceb26808b 100644 --- a/swift/test/Ice/binding/Server.swift +++ b/swift/test/Ice/binding/Server.swift @@ -2,17 +2,16 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - let properties = try createTestProperties(args) properties.setProperty(key: "Ice.ServerIdleTime", value: "30") - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/binding/TestI.swift b/swift/test/Ice/binding/TestI.swift index 4e9f7e5f696..c05c7f632e8 100644 --- a/swift/test/Ice/binding/TestI.swift +++ b/swift/test/Ice/binding/TestI.swift @@ -36,7 +36,8 @@ class RemoteCommunicatorI: RemoteCommunicator { let adapter = try communicator.createObjectAdapterWithEndpoints(name: name, endpoints: endpoints) return try uncheckedCast( prx: current.adapter!.addWithUUID(RemoteObjectAdapterDisp(RemoteObjectAdapterI(adapter))), - type: RemoteObjectAdapterPrx.self) + type: RemoteObjectAdapterPrx.self + ) } catch let ex as Ice.SocketException { retry -= 1 if retry == 0 { @@ -46,7 +47,7 @@ class RemoteCommunicatorI: RemoteCommunicator { } } - func deactivateObjectAdapter(adapter: RemoteObjectAdapterPrx?, current: Ice.Current) throws { + func deactivateObjectAdapter(adapter: RemoteObjectAdapterPrx?, current _: Ice.Current) throws { try adapter!.deactivate() // Collocated call. } @@ -56,7 +57,7 @@ class RemoteCommunicatorI: RemoteCommunicator { } class RemoteObjectAdapterI: RemoteObjectAdapter { - init(_ adapter: Ice.ObjectAdapter ) throws { + init(_ adapter: Ice.ObjectAdapter) throws { _adapter = adapter _testIntf = try uncheckedCast(prx: _adapter.add(servant: TestIntfDisp(TestI()), id: Ice.stringToIdentity("test")), @@ -64,11 +65,11 @@ class RemoteObjectAdapterI: RemoteObjectAdapter { try _adapter.activate() } - func getTestIntf(current: Ice.Current) throws -> TestIntfPrx? { + func getTestIntf(current _: Ice.Current) throws -> TestIntfPrx? { return _testIntf } - func deactivate(current: Ice.Current) throws { + func deactivate(current _: Ice.Current) throws { _adapter.destroy() } diff --git a/swift/test/Ice/defaultServant/Client.swift b/swift/test/Ice/defaultServant/Client.swift index b2ce730ae1f..e28df06a089 100644 --- a/swift/test/Ice/defaultServant/Client.swift +++ b/swift/test/Ice/defaultServant/Client.swift @@ -7,7 +7,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/enums/Client.swift b/swift/test/Ice/enums/Client.swift index 9468ff355ad..0ed3358d87a 100644 --- a/swift/test/Ice/enums/Client.swift +++ b/swift/test/Ice/enums/Client.swift @@ -7,7 +7,7 @@ import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/enums/Server.swift b/swift/test/Ice/enums/Server.swift index 98361086fab..d442c5739d1 100644 --- a/swift/test/Ice/enums/Server.swift +++ b/swift/test/Ice/enums/Server.swift @@ -2,13 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/enums/TestI.swift b/swift/test/Ice/enums/TestI.swift index 4a564809ea6..148c229f4bf 100644 --- a/swift/test/Ice/enums/TestI.swift +++ b/swift/test/Ice/enums/TestI.swift @@ -5,35 +5,35 @@ import Ice class TestI: TestIntf { - func opByte(b1: ByteEnum, current: Ice.Current) throws -> (returnValue: ByteEnum, b2: ByteEnum) { + func opByte(b1: ByteEnum, current _: Ice.Current) throws -> (returnValue: ByteEnum, b2: ByteEnum) { return (b1, b1) } - func opShort(s1: ShortEnum, current: Ice.Current) throws -> (returnValue: ShortEnum, s2: ShortEnum) { + func opShort(s1: ShortEnum, current _: Ice.Current) throws -> (returnValue: ShortEnum, s2: ShortEnum) { return (s1, s1) } - func opInt(i1: IntEnum, current: Ice.Current) throws -> (returnValue: IntEnum, i2: IntEnum) { + func opInt(i1: IntEnum, current _: Ice.Current) throws -> (returnValue: IntEnum, i2: IntEnum) { return (i1, i1) } - func opSimple(s1: SimpleEnum, current: Ice.Current) throws -> (returnValue: SimpleEnum, s2: SimpleEnum) { + func opSimple(s1: SimpleEnum, current _: Ice.Current) throws -> (returnValue: SimpleEnum, s2: SimpleEnum) { return (s1, s1) } - func opByteSeq(b1: [ByteEnum], current: Ice.Current) throws -> (returnValue: [ByteEnum], b2: [ByteEnum]) { + func opByteSeq(b1: [ByteEnum], current _: Ice.Current) throws -> (returnValue: [ByteEnum], b2: [ByteEnum]) { return (b1, b1) } - func opShortSeq(s1: [ShortEnum], current: Ice.Current) throws -> (returnValue: [ShortEnum], s2: [ShortEnum]) { + func opShortSeq(s1: [ShortEnum], current _: Ice.Current) throws -> (returnValue: [ShortEnum], s2: [ShortEnum]) { return (s1, s1) } - func opIntSeq(i1: [IntEnum], current: Ice.Current) throws -> (returnValue: [IntEnum], i2: [IntEnum]) { + func opIntSeq(i1: [IntEnum], current _: Ice.Current) throws -> (returnValue: [IntEnum], i2: [IntEnum]) { return (i1, i1) } - func opSimpleSeq(s1: [SimpleEnum], current: Ice.Current) throws -> (returnValue: [SimpleEnum], s2: [SimpleEnum]) { + func opSimpleSeq(s1: [SimpleEnum], current _: Ice.Current) throws -> (returnValue: [SimpleEnum], s2: [SimpleEnum]) { return (s1, s1) } diff --git a/swift/test/Ice/exceptions/AllTests.swift b/swift/test/Ice/exceptions/AllTests.swift index 71624b3578c..43541c6957d 100644 --- a/swift/test/Ice/exceptions/AllTests.swift +++ b/swift/test/Ice/exceptions/AllTests.swift @@ -3,20 +3,17 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class ServantLocatorI: Ice.ServantLocator { - - func locate(_ curr: Current) throws -> (returnValue: Disp?, cookie: AnyObject?) { + func locate(_: Current) throws -> (returnValue: Disp?, cookie: AnyObject?) { return (nil, nil) } - func finished(curr: Current, servant: Disp, cookie: AnyObject?) throws { - } + func finished(curr _: Current, servant _: Disp, cookie _: AnyObject?) throws {} - func deactivate(_ category: String) { - } + func deactivate(_: String) {} } func allTests(_ helper: TestHelper) throws -> ThrowerPrx { @@ -207,24 +204,21 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { do { try thrower.throwUndeclaredA(1) try test(false) - } catch is Ice.UnknownUserException { - } catch { + } catch is Ice.UnknownUserException {} catch { try test(false) } do { try thrower.throwUndeclaredB(a: 1, b: 2) try test(false) - } catch is Ice.UnknownUserException { - } catch { + } catch is Ice.UnknownUserException {} catch { try test(false) } do { try thrower.throwUndeclaredC(a: 1, b: 2, c: 3) try test(false) - } catch is Ice.UnknownUserException { - } catch { + } catch is Ice.UnknownUserException {} catch { try test(false) } output.writeLine("ok") @@ -236,16 +230,14 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { do { _ = try thrower.throwMemoryLimitException(ByteSeq()) try test(false) - } catch is Ice.MemoryLimitException { - } catch { + } catch is Ice.MemoryLimitException {} catch { try test(false) } do { _ = try thrower.throwMemoryLimitException(ByteSeq(repeating: 0, count: 20 * 1024)) // 20KB try test(false) - } catch is Ice.ConnectionLostException { - } catch is Ice.UnknownLocalException { + } catch is Ice.ConnectionLostException {} catch is Ice.UnknownLocalException { // Expected with JS bidir server } catch { try test(false) @@ -315,17 +307,14 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { do { try thrower.throwLocalException() try test(false) - } catch is Ice.UnknownLocalException { - } catch { + } catch is Ice.UnknownLocalException {} catch { try test(false) } do { try thrower.throwLocalExceptionIdempotent() try test(false) - } catch is Ice.UnknownLocalException { - } catch is Ice.OperationNotExistException { - } catch { + } catch is Ice.UnknownLocalException {} catch is Ice.OperationNotExistException {} catch { try test(false) } output.writeLine("ok") @@ -334,8 +323,7 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { do { try thrower.throwNonIceException() try test(false) - } catch is Ice.UnknownException { - } catch { + } catch is Ice.UnknownException {} catch { try test(false) } output.writeLine("ok") @@ -350,8 +338,7 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { do { try thrower.throwAfterException() try test(false) - } catch is A { - } catch { + } catch is A {} catch { try test(false) } output.writeLine("ok") @@ -556,7 +543,7 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { output.write("catching object not exist exception with new AMI mapping... ") try Promise<Void> { seal in - let id = try Ice.stringToIdentity("does not exist") + let id = try Ice.stringToIdentity("does not exist") let thrower2 = uncheckedCast(prx: thrower.ice_identity(id), type: ThrowerPrx.self) firstly { thrower2.throwAasAAsync(1) @@ -709,7 +696,7 @@ func allTests(_ helper: TestHelper) throws -> ThrowerPrx { try test(false) }.catch { e in do { - try test( e is Ice.UnknownUserException) + try test(e is Ice.UnknownUserException) seal.fulfill(()) } catch { seal.reject(error) diff --git a/swift/test/Ice/exceptions/Client.swift b/swift/test/Ice/exceptions/Client.swift index 878411be83a..c03d8601f5d 100644 --- a/swift/test/Ice/exceptions/Client.swift +++ b/swift/test/Ice/exceptions/Client.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { @@ -14,8 +14,8 @@ public class Client: TestHelperI { var initData = Ice.InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceExceptions"] - let communicator = try self.initialize(initData) - communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", value: self.getTestEndpoint(num: 0)) + let communicator = try initialize(initData) + communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", value: getTestEndpoint(num: 0)) defer { communicator.destroy() } diff --git a/swift/test/Ice/exceptions/Collocated.swift b/swift/test/Ice/exceptions/Collocated.swift index 8ca47a8a677..38b484f412f 100644 --- a/swift/test/Ice/exceptions/Collocated.swift +++ b/swift/test/Ice/exceptions/Collocated.swift @@ -7,7 +7,7 @@ import TestCommon class Collocated: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.MessageSizeMax", value: "10") // 10KB max @@ -16,7 +16,7 @@ class Collocated: TestHelperI { initData.properties = properties initData.classResolverPrefix = ["IceExceptions"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/exceptions/Server.swift b/swift/test/Ice/exceptions/Server.swift index 682ef6da0de..efa9686d7cc 100644 --- a/swift/test/Ice/exceptions/Server.swift +++ b/swift/test/Ice/exceptions/Server.swift @@ -21,7 +21,7 @@ class EmptyI: Empty {} class Server: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.MessageSizeMax", value: "10") // 10KB max @@ -30,7 +30,7 @@ class Server: TestHelperI { initData.properties = properties initData.classResolverPrefix = ["IceExceptions"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/exceptions/ServerAMD.swift b/swift/test/Ice/exceptions/ServerAMD.swift index 3ec3c3f4c6a..5a5f6ad5ad6 100644 --- a/swift/test/Ice/exceptions/ServerAMD.swift +++ b/swift/test/Ice/exceptions/ServerAMD.swift @@ -21,7 +21,7 @@ class EmptyI: Empty {} class ServerAMD: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.MessageSizeMax", value: "10") // 10KB max @@ -30,7 +30,7 @@ class ServerAMD: TestHelperI { initData.properties = properties initData.classResolverPrefix = ["IceExceptionsAMD"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/exceptions/TestAMDI.swift b/swift/test/Ice/exceptions/TestAMDI.swift index 4910a9a61bc..63e55dd08d6 100644 --- a/swift/test/Ice/exceptions/TestAMDI.swift +++ b/swift/test/Ice/exceptions/TestAMDI.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class RuntimeError: Error {} @@ -16,21 +16,21 @@ class ThrowerI: Thrower { } } - func supportsUndeclaredExceptionsAsync(current: Current) -> Promise<Bool> { + func supportsUndeclaredExceptionsAsync(current _: Current) -> Promise<Bool> { return Promise.value(true) } - func supportsAssertExceptionAsync(current: Current) -> Promise<Bool> { + func supportsAssertExceptionAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } - func throwAasAAsync(a: Int32, current: Current) -> Promise<Void> { - return Promise<Void> {seal in + func throwAasAAsync(a: Int32, current _: Current) -> Promise<Void> { + return Promise<Void> { seal in seal.reject(A(aMem: a)) } } - func throwAorDasAorDAsync(a: Int32, current: Current) -> Promise<Void> { + func throwAorDasAorDAsync(a: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in if a > 0 { seal.reject(A(aMem: a)) @@ -40,122 +40,122 @@ class ThrowerI: Thrower { } } - func throwBasAAsync(a: Int32, b: Int32, current: Current) -> Promise<Void> { + func throwBasAAsync(a: Int32, b: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(B(aMem: a, bMem: b)) } } - func throwCasAAsync(a: Int32, b: Int32, c: Int32, current: Current) -> Promise<Void> { - return Promise<Void> {seal in + func throwCasAAsync(a: Int32, b: Int32, c: Int32, current _: Current) -> Promise<Void> { + return Promise<Void> { seal in seal.reject(C(aMem: a, bMem: b, cMem: c)) } } - func throwBasBAsync(a: Int32, b: Int32, current: Current) -> Promise<Void> { + func throwBasBAsync(a: Int32, b: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(B(aMem: a, bMem: b)) } } - func throwCasBAsync(a: Int32, b: Int32, c: Int32, current: Current) -> Promise<Void> { + func throwCasBAsync(a: Int32, b: Int32, c: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(C(aMem: a, bMem: b, cMem: c)) } } - func throwCasCAsync(a: Int32, b: Int32, c: Int32, current: Current) -> Promise<Void> { + func throwCasCAsync(a: Int32, b: Int32, c: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(C(aMem: a, bMem: b, cMem: c)) } } - func throwModAAsync(a: Int32, a2: Int32, current: Current) -> Promise<Void> { + func throwModAAsync(a: Int32, a2: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(ModA(aMem: a, a2Mem: a2)) } } - func throwUndeclaredAAsync(a: Int32, current: Current) -> Promise<Void> { + func throwUndeclaredAAsync(a: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(A(aMem: a)) } } - func throwUndeclaredBAsync(a: Int32, b: Int32, current: Current) -> Promise<Void> { + func throwUndeclaredBAsync(a: Int32, b: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(B(aMem: a, bMem: b)) } } - func throwUndeclaredCAsync(a: Int32, b: Int32, c: Int32, current: Current) -> Promise<Void> { + func throwUndeclaredCAsync(a: Int32, b: Int32, c: Int32, current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(C(aMem: a, bMem: b, cMem: c)) } } - func throwLocalExceptionAsync(current: Current) -> Promise<Void> { + func throwLocalExceptionAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(Ice.TimeoutException()) } } - func throwNonIceExceptionAsync(current: Current) -> Promise<Void> { + func throwNonIceExceptionAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(RuntimeError()) } } - func throwAssertExceptionAsync(current: Current) -> Promise<Void> { + func throwAssertExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func throwMemoryLimitExceptionAsync(seq: ByteSeq, current: Current) -> Promise<ByteSeq> { + func throwMemoryLimitExceptionAsync(seq _: ByteSeq, current _: Current) -> Promise<ByteSeq> { return Promise<ByteSeq> { seal in // 20KB is over the configured 10KB message size max. seal.fulfill(ByteSeq(repeating: 0, count: 1024 * 20)) } } - func throwLocalExceptionIdempotentAsync(current: Current) -> Promise<Void> { + func throwLocalExceptionIdempotentAsync(current _: Current) -> Promise<Void> { return Promise { seal in seal.reject(Ice.TimeoutException()) } } - func throwAfterResponseAsync(current: Current) -> Promise<Void> { + func throwAfterResponseAsync(current _: Current) -> Promise<Void> { return Promise { seal in seal.fulfill(()) throw Ice.RuntimeError("") } } - func throwAfterExceptionAsync(current: Current) -> Promise<Void> { + func throwAfterExceptionAsync(current _: Current) -> Promise<Void> { return Promise { seal in seal.reject(A(aMem: 12345)) throw Ice.RuntimeError("") } } - func throwEAsync(current: Current) -> Promise<Void> { + func throwEAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(E(data: "E")) } } - func throwFAsync(current: Current) -> Promise<Void> { + func throwFAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(F(data: "F")) } } - func throwGAsync(current: Current) -> Promise<Void> { + func throwGAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(G(data: "G")) } } - func throwHAsync(current: Current) -> Promise<Void> { + func throwHAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(H(data: "H")) } diff --git a/swift/test/Ice/exceptions/TestI.swift b/swift/test/Ice/exceptions/TestI.swift index 198fc544679..08235a48e6a 100644 --- a/swift/test/Ice/exceptions/TestI.swift +++ b/swift/test/Ice/exceptions/TestI.swift @@ -8,24 +8,23 @@ import TestCommon class RuntimeError: Error {} class ThrowerI: Thrower { - func shutdown(current: Ice.Current) throws { current.adapter!.getCommunicator().shutdown() } - func supportsUndeclaredExceptions(current: Current) throws -> Bool { + func supportsUndeclaredExceptions(current _: Current) throws -> Bool { return true } - func supportsAssertException(current: Current) throws -> Bool { + func supportsAssertException(current _: Current) throws -> Bool { return false } - func throwAasA(a: Int32, current: Ice.Current) throws { + func throwAasA(a: Int32, current _: Ice.Current) throws { throw A(aMem: a) } - func throwAorDasAorD(a: Int32, current: Ice.Current) throws { + func throwAorDasAorD(a: Int32, current _: Ice.Current) throws { if a > 0 { throw A(aMem: a) } else { @@ -37,7 +36,7 @@ class ThrowerI: Thrower { try throwBasB(a: a, b: b, current: current) } - func throwBasB(a: Int32, b: Int32, current: Ice.Current) throws { + func throwBasB(a: Int32, b: Int32, current _: Ice.Current) throws { let ex = B() ex.aMem = a ex.bMem = b @@ -52,52 +51,51 @@ class ThrowerI: Thrower { try throwCasC(a: a, b: b, c: c, current: current) } - func throwCasC(a: Int32, b: Int32, c: Int32, current: Ice.Current) throws { + func throwCasC(a: Int32, b: Int32, c: Int32, current _: Ice.Current) throws { throw C(aMem: a, bMem: b, cMem: c) } - func throwModA(a: Int32, a2: Int32, current: Current) throws { + func throwModA(a _: Int32, a2 _: Int32, current _: Current) throws { throw ModA(aMem: 1, a2Mem: 1) } - func throwLocalException(current: Ice.Current) throws { + func throwLocalException(current _: Ice.Current) throws { throw Ice.TimeoutException() } - func throwNonIceException(current: Ice.Current) throws { + func throwNonIceException(current _: Ice.Current) throws { throw RuntimeError() } - func throwAssertException(current: Ice.Current) throws { - } + func throwAssertException(current _: Ice.Current) throws {} - func throwMemoryLimitException(seq: ByteSeq, current: Ice.Current) throws -> ByteSeq { + func throwMemoryLimitException(seq _: ByteSeq, current _: Ice.Current) throws -> ByteSeq { return ByteSeq(repeating: 0, count: 1024 * 20) // 20KB is over the configured 10KB message size max. } - func throwLocalExceptionIdempotent(current: Ice.Current) throws { + func throwLocalExceptionIdempotent(current _: Ice.Current) throws { throw Ice.TimeoutException() } - func throwUndeclaredA(a: Int32, current: Ice.Current) throws { + func throwUndeclaredA(a: Int32, current _: Ice.Current) throws { throw A(aMem: a) } - func throwUndeclaredB(a: Int32, b: Int32, current: Ice.Current) throws { + func throwUndeclaredB(a: Int32, b: Int32, current _: Ice.Current) throws { throw B(aMem: a, bMem: b) } - func throwUndeclaredC(a: Int32, b: Int32, c: Int32, current: Ice.Current) throws { + func throwUndeclaredC(a: Int32, b: Int32, c: Int32, current _: Ice.Current) throws { throw C(aMem: a, bMem: b, cMem: c) } - func throwAfterResponse(current: Ice.Current) throws { + func throwAfterResponse(current _: Ice.Current) throws { // // Only relevant for AMD. // } - func throwAfterException(current: Ice.Current) throws { + func throwAfterException(current _: Ice.Current) throws { // // Only relevant for AMD. // diff --git a/swift/test/Ice/facets/AllTests.swift b/swift/test/Ice/facets/AllTests.swift index ddd475352cd..2d80d5ccc8d 100644 --- a/swift/test/Ice/facets/AllTests.swift +++ b/swift/test/Ice/facets/AllTests.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class EmptyI: Empty {} diff --git a/swift/test/Ice/facets/Client.swift b/swift/test/Ice/facets/Client.swift index c55b3d83c28..6f64f7dcfff 100644 --- a/swift/test/Ice/facets/Client.swift +++ b/swift/test/Ice/facets/Client.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { @@ -13,8 +13,8 @@ public class Client: TestHelperI { properties.setProperty(key: "Ice.MessageSizeMax", value: "10") // 10KB max var initData = Ice.InitializationData() initData.properties = properties - let communicator = try self.initialize(initData) - communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", value: self.getTestEndpoint(num: 0)) + let communicator = try initialize(initData) + communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", value: getTestEndpoint(num: 0)) defer { communicator.destroy() } diff --git a/swift/test/Ice/facets/Collocated.swift b/swift/test/Ice/facets/Collocated.swift index 95f6047ba6d..c8fc27f35b7 100644 --- a/swift/test/Ice/facets/Collocated.swift +++ b/swift/test/Ice/facets/Collocated.swift @@ -7,7 +7,7 @@ import TestCommon class Collocated: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/facets/Server.swift b/swift/test/Ice/facets/Server.swift index da4ea827302..a9e6ec22225 100644 --- a/swift/test/Ice/facets/Server.swift +++ b/swift/test/Ice/facets/Server.swift @@ -7,8 +7,7 @@ import TestCommon class Server: TestHelperI { public override func run(args: [String]) throws { - - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/facets/TestI.swift b/swift/test/Ice/facets/TestI.swift index b15d8c1f952..907db71d082 100644 --- a/swift/test/Ice/facets/TestI.swift +++ b/swift/test/Ice/facets/TestI.swift @@ -5,100 +5,97 @@ import Ice class AI: A { - func callA(current: Ice.Current) throws -> String { + func callA(current _: Ice.Current) throws -> String { return "A" } } class BI: B { - - func callA(current: Ice.Current) throws -> String { + func callA(current _: Ice.Current) throws -> String { return "A" } - func callB(current: Ice.Current) throws -> String { + func callB(current _: Ice.Current) throws -> String { return "B" } } class CI: C { - func callA(current: Ice.Current) throws -> String { + func callA(current _: Ice.Current) throws -> String { return "A" } - func callC(current: Ice.Current) throws -> String { + func callC(current _: Ice.Current) throws -> String { return "C" } } class DI: D { - func callA(current: Ice.Current) throws -> String { + func callA(current _: Ice.Current) throws -> String { return "A" } - func callB(current: Ice.Current) throws -> String { + func callB(current _: Ice.Current) throws -> String { return "B" } - func callC(current: Ice.Current) throws -> String { + func callC(current _: Ice.Current) throws -> String { return "C" } - func callD(current: Ice.Current) throws -> String { + func callD(current _: Ice.Current) throws -> String { return "D" } } class EI: E { - func callE(current: Ice.Current) throws -> String { + func callE(current _: Ice.Current) throws -> String { return "E" } } class FI: F { - func callE(current: Ice.Current) throws -> String { + func callE(current _: Ice.Current) throws -> String { return "E" } - func callF(current: Ice.Current) throws -> String { + func callF(current _: Ice.Current) throws -> String { return "F" } } class GI: G { - var _communicator: Ice.Communicator public init(communicator: Ice.Communicator) { _communicator = communicator } - func callG(current: Ice.Current) throws -> String { + func callG(current _: Ice.Current) throws -> String { return "G" } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _communicator.shutdown() } } class HI: H { - let _communicator: Ice.Communicator init(communicator: Ice.Communicator) { _communicator = communicator } - func callG(current: Ice.Current) throws -> String { + func callG(current _: Ice.Current) throws -> String { return "G" } - func callH(current: Ice.Current) throws -> String { + func callH(current _: Ice.Current) throws -> String { return "H" } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _communicator.shutdown() } } diff --git a/swift/test/Ice/hold/Client.swift b/swift/test/Ice/hold/Client.swift index e05d10f4ce5..6287acd71eb 100644 --- a/swift/test/Ice/hold/Client.swift +++ b/swift/test/Ice/hold/Client.swift @@ -3,12 +3,12 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/hold/Server.swift b/swift/test/Ice/hold/Server.swift index f1d2d18639a..0130718d499 100644 --- a/swift/test/Ice/hold/Server.swift +++ b/swift/test/Ice/hold/Server.swift @@ -2,13 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/hold/TestI.swift b/swift/test/Ice/hold/TestI.swift index 678bc8858ba..315e41abf6c 100644 --- a/swift/test/Ice/hold/TestI.swift +++ b/swift/test/Ice/hold/TestI.swift @@ -2,18 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import Ice -import TestCommon import Dispatch import Foundation +import Ice +import TestCommon class HoldI: Hold { - var _adapter: Ice.ObjectAdapter var _helper: TestHelper var _last: Int32 = 0 var _lock = os_unfair_lock() - var _queue = DispatchQueue(label: "ice.hold.Server") + var _queue = DispatchQueue(label: "ice.hold.Server") init(adapter: Ice.ObjectAdapter, helper: TestHelper) { _adapter = adapter @@ -30,8 +29,7 @@ class HoldI: Hold { _queue.asyncAfter(deadline: .now() + .milliseconds(Int(seconds))) { do { try self.putOnHold(seconds: 0, current: current) - } catch is Ice.ObjectAdapterDeactivatedException { - } catch { + } catch is Ice.ObjectAdapterDeactivatedException {} catch { precondition(false) } } @@ -53,8 +51,8 @@ class HoldI: Hold { } } - func set(value: Int32, delay: Int32, current: Ice.Current) throws -> Int32 { - Thread.sleep(forTimeInterval: Double(delay/1000)) + func set(value: Int32, delay: Int32, current _: Ice.Current) throws -> Int32 { + Thread.sleep(forTimeInterval: Double(delay / 1000)) return withLock(&_lock) { let tmp = _last _last = value @@ -62,14 +60,14 @@ class HoldI: Hold { } } - func setOneway(value: Int32, expected: Int32, current: Ice.Current) throws { + func setOneway(value: Int32, expected: Int32, current _: Ice.Current) throws { try withLock(&_lock) { try self._helper.test(_last == expected) _last = value } } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _adapter.hold() _adapter.getCommunicator().shutdown() } diff --git a/swift/test/Ice/info/AllTests.swift b/swift/test/Ice/info/AllTests.swift index 10043bd488e..59b626a0f06 100644 --- a/swift/test/Ice/info/AllTests.swift +++ b/swift/test/Ice/info/AllTests.swift @@ -39,8 +39,8 @@ func allTests(_ helper: TestHelper) throws { do { let p1 = try communicator.stringToProxy( "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" + - "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" + - "opaque -e 1.8 -t 100 -v ABCD")! + "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" + + "opaque -e 1.8 -t 100 -v ABCD")! var endps = p1.ice_getEndpoints() @@ -54,14 +54,14 @@ func allTests(_ helper: TestHelper) throws { try test(!tcpEndpoint.datagram()) try test(tcpEndpoint.type() == Ice.TCPEndpointType && !tcpEndpoint.secure() || - tcpEndpoint.type() == Ice.SSLEndpointType && tcpEndpoint.secure() || - tcpEndpoint.type() == Ice.WSEndpointType && !tcpEndpoint.secure() || - tcpEndpoint.type() == Ice.WSSEndpointType && tcpEndpoint.secure()) + tcpEndpoint.type() == Ice.SSLEndpointType && tcpEndpoint.secure() || + tcpEndpoint.type() == Ice.WSEndpointType && !tcpEndpoint.secure() || + tcpEndpoint.type() == Ice.WSSEndpointType && tcpEndpoint.secure()) try test(tcpEndpoint.type() == Ice.TCPEndpointType && info is Ice.TCPEndpointInfo || - tcpEndpoint.type() == Ice.SSLEndpointType && info is Ice.SSLEndpointInfo || - tcpEndpoint.type() == Ice.WSEndpointType && info is Ice.WSEndpointInfo || - tcpEndpoint.type() == Ice.WSSEndpointType && info is Ice.WSEndpointInfo) + tcpEndpoint.type() == Ice.SSLEndpointType && info is Ice.SSLEndpointInfo || + tcpEndpoint.type() == Ice.WSEndpointType && info is Ice.WSEndpointInfo || + tcpEndpoint.type() == Ice.WSSEndpointType && info is Ice.WSEndpointInfo) let udpEndpoint = (endps[1].getInfo() as? Ice.UDPEndpointInfo)! try test(udpEndpoint.host == "udphost") @@ -92,13 +92,13 @@ func allTests(_ helper: TestHelper) throws { try test(endpoints.count == 2) var publishedEndpoints = adapter.getPublishedEndpoints() - try test(endpoints.elementsEqual(publishedEndpoints) { $0 == $1}) + try test(endpoints.elementsEqual(publishedEndpoints) { $0 == $1 }) var tcpEndpoint = getTCPEndpointInfo(endpoints[0].getInfo()!)! try test(tcpEndpoint.type() == Ice.TCPEndpointType || - tcpEndpoint.type() == Ice.SSLEndpointType || - tcpEndpoint.type() == Ice.WSEndpointType || - tcpEndpoint.type() == Ice.WSSEndpointType) + tcpEndpoint.type() == Ice.SSLEndpointType || + tcpEndpoint.type() == Ice.WSEndpointType || + tcpEndpoint.type() == Ice.WSSEndpointType) try test(tcpEndpoint.host == host) try test(tcpEndpoint.port > 0) @@ -112,7 +112,7 @@ func allTests(_ helper: TestHelper) throws { endpoints = [endpoints[0]] try adapter.setPublishedEndpoints(endpoints) publishedEndpoints = adapter.getPublishedEndpoints() - try test(endpoints.elementsEqual(publishedEndpoints) { $0 == $1}) + try test(endpoints.elementsEqual(publishedEndpoints) { $0 == $1 }) adapter.destroy() @@ -199,8 +199,7 @@ func allTests(_ helper: TestHelper) throws { try test(ctx["localPort"] == "\(ipInfo.remotePort)") if try base.ice_getConnection()!.type() == "ws" || - base.ice_getConnection()!.type() == "wss" { - + base.ice_getConnection()!.type() == "wss" { let headers = (info as? Ice.WSConnectionInfo)!.headers try test(headers["Upgrade"] == "websocket") diff --git a/swift/test/Ice/info/Client.swift b/swift/test/Ice/info/Client.swift index e05d10f4ce5..6287acd71eb 100644 --- a/swift/test/Ice/info/Client.swift +++ b/swift/test/Ice/info/Client.swift @@ -3,12 +3,12 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/info/Server.swift b/swift/test/Ice/info/Server.swift index efbb26039a5..3863ab33b1b 100644 --- a/swift/test/Ice/info/Server.swift +++ b/swift/test/Ice/info/Server.swift @@ -2,21 +2,21 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } communicator.getProperties().setProperty( - key: "TestAdapter.Endpoints", - value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))") + key: "TestAdapter.Endpoints", + value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))" + ) let adapter = try communicator.createObjectAdapter("TestAdapter") try adapter.add(servant: TestIntfDisp(TestI()), id: Ice.stringToIdentity("test")) try adapter.activate() diff --git a/swift/test/Ice/inheritance/Client.swift b/swift/test/Ice/inheritance/Client.swift index 5a926c5467e..48b4d34ba85 100644 --- a/swift/test/Ice/inheritance/Client.swift +++ b/swift/test/Ice/inheritance/Client.swift @@ -3,12 +3,12 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/inheritance/Collocated.swift b/swift/test/Ice/inheritance/Collocated.swift index 503c7975988..2c8fff7d9b5 100644 --- a/swift/test/Ice/inheritance/Collocated.swift +++ b/swift/test/Ice/inheritance/Collocated.swift @@ -7,14 +7,15 @@ import TestCommon class Collocated: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } communicator.getProperties().setProperty( key: "TestAdapter.Endpoints", - value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))") + value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))" + ) let adapter = try communicator.createObjectAdapter("TestAdapter") try adapter.add(servant: InitialDisp(InitialI(adapter)), id: Ice.stringToIdentity("initial")) try adapter.activate() diff --git a/swift/test/Ice/inheritance/Server.swift b/swift/test/Ice/inheritance/Server.swift index f466aebfb94..dc471283182 100644 --- a/swift/test/Ice/inheritance/Server.swift +++ b/swift/test/Ice/inheritance/Server.swift @@ -2,21 +2,21 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } communicator.getProperties().setProperty( key: "TestAdapter.Endpoints", - value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))") + value: "\(getTestEndpoint(num: 0)):\(getTestEndpoint(num: 0, prot: "udp"))" + ) let adapter = try communicator.createObjectAdapter("TestAdapter") try adapter.add(servant: InitialDisp(InitialI(adapter)), id: Ice.stringToIdentity("initial")) try adapter.activate() diff --git a/swift/test/Ice/inheritance/TestI.swift b/swift/test/Ice/inheritance/TestI.swift index a0054d1cc23..f07c494fde9 100644 --- a/swift/test/Ice/inheritance/TestI.swift +++ b/swift/test/Ice/inheritance/TestI.swift @@ -6,108 +6,105 @@ import Ice import TestCommon class CAI: MACAOperations { - func caop(p: MACAPrx?, current: Ice.Current) throws -> MACAPrx? { + func caop(p: MACAPrx?, current _: Ice.Current) throws -> MACAPrx? { return p } } class CBI: MBCBOperations { - func caop(p: MACAPrx?, current: Ice.Current) throws -> MACAPrx? { + func caop(p: MACAPrx?, current _: Ice.Current) throws -> MACAPrx? { return p } - func cbop(p: MBCBPrx?, current: Ice.Current) throws -> MBCBPrx? { + func cbop(p: MBCBPrx?, current _: Ice.Current) throws -> MBCBPrx? { return p } } class CCI: MACCOperations { - func caop(p: MACAPrx?, current: Ice.Current) throws -> MACAPrx? { + func caop(p: MACAPrx?, current _: Ice.Current) throws -> MACAPrx? { return p } - func ccop(p: MACCPrx?, current: Ice.Current) throws -> MACCPrx? { + func ccop(p: MACCPrx?, current _: Ice.Current) throws -> MACCPrx? { return p } - func cbop(p: MBCBPrx?, current: Ice.Current) throws -> MBCBPrx? { + func cbop(p: MBCBPrx?, current _: Ice.Current) throws -> MBCBPrx? { return p } } class CDI: MACDOperations { - func caop(p: MACAPrx?, current: Ice.Current) throws -> MACAPrx? { + func caop(p: MACAPrx?, current _: Ice.Current) throws -> MACAPrx? { return p } - func ccop(p: MACCPrx?, current: Ice.Current) throws -> MACCPrx? { + func ccop(p: MACCPrx?, current _: Ice.Current) throws -> MACCPrx? { return p } - func cdop(p: MACDPrx?, current: Ice.Current) throws -> MACDPrx? { + func cdop(p: MACDPrx?, current _: Ice.Current) throws -> MACDPrx? { return p } - func iaop(p: MAIAPrx?, current: Ice.Current) throws -> MAIAPrx? { + func iaop(p: MAIAPrx?, current _: Ice.Current) throws -> MAIAPrx? { return p } - func cbop(p: MBCBPrx?, current: Ice.Current) throws -> MBCBPrx? { + func cbop(p: MBCBPrx?, current _: Ice.Current) throws -> MBCBPrx? { return p } - func ib1op(p: MBIB1Prx?, current: Ice.Current) throws -> MBIB1Prx? { + func ib1op(p: MBIB1Prx?, current _: Ice.Current) throws -> MBIB1Prx? { return p } - func ib2op(p: MBIB2Prx?, current: Ice.Current) throws -> MBIB2Prx? { + func ib2op(p: MBIB2Prx?, current _: Ice.Current) throws -> MBIB2Prx? { return p } } class IAI: MAIA { - func iaop(p: MAIAPrx?, current: Ice.Current) throws -> MAIAPrx? { + func iaop(p: MAIAPrx?, current _: Ice.Current) throws -> MAIAPrx? { return p } } class IB1I: MBIB1 { - - func iaop(p: MAIAPrx?, current: Ice.Current) throws -> MAIAPrx? { + func iaop(p: MAIAPrx?, current _: Ice.Current) throws -> MAIAPrx? { return p } - func ib1op(p: MBIB1Prx?, current: Ice.Current) throws -> MBIB1Prx? { + func ib1op(p: MBIB1Prx?, current _: Ice.Current) throws -> MBIB1Prx? { return p } } class IB2I: MBIB2 { - - func iaop(p: MAIAPrx?, current: Ice.Current) throws -> MAIAPrx? { + func iaop(p: MAIAPrx?, current _: Ice.Current) throws -> MAIAPrx? { return p } - func ib2op(p: MBIB2Prx?, current: Ice.Current) throws -> MBIB2Prx? { + func ib2op(p: MBIB2Prx?, current _: Ice.Current) throws -> MBIB2Prx? { return p } } class ICI: MAIC { - - func iaop(p: MAIAPrx?, current: Ice.Current) throws -> MAIAPrx? { + func iaop(p: MAIAPrx?, current _: Ice.Current) throws -> MAIAPrx? { return p } - func icop(p: MAICPrx?, current: Ice.Current) throws -> MAICPrx? { + func icop(p: MAICPrx?, current _: Ice.Current) throws -> MAICPrx? { return p } - func ib1op(p: MBIB1Prx?, current: Ice.Current) throws -> MBIB1Prx? { + func ib1op(p: MBIB1Prx?, current _: Ice.Current) throws -> MBIB1Prx? { return p } - func ib2op(p: MBIB2Prx?, current: Ice.Current) throws -> MBIB2Prx? { + func ib2op(p: MBIB2Prx?, current _: Ice.Current) throws -> MBIB2Prx? { return p } } @@ -133,35 +130,35 @@ class InitialI: Initial { _ic = try uncheckedCast(prx: adapter.addWithUUID(MAICDisp(ICI())), type: MAICPrx.self) } - func caop(current: Ice.Current) throws -> MACAPrx? { + func caop(current _: Ice.Current) throws -> MACAPrx? { return _ca } - func cbop(current: Ice.Current) throws -> MBCBPrx? { + func cbop(current _: Ice.Current) throws -> MBCBPrx? { return _cb } - func ccop(current: Ice.Current) throws -> MACCPrx? { + func ccop(current _: Ice.Current) throws -> MACCPrx? { return _cc } - func cdop(current: Ice.Current) throws -> MACDPrx? { + func cdop(current _: Ice.Current) throws -> MACDPrx? { return _cd } - func iaop(current: Ice.Current) throws -> MAIAPrx? { + func iaop(current _: Ice.Current) throws -> MAIAPrx? { return _ia } - func ib1op(current: Ice.Current) throws -> MBIB1Prx? { + func ib1op(current _: Ice.Current) throws -> MBIB1Prx? { return _ib1 } - func ib2op(current: Ice.Current) throws -> MBIB2Prx? { + func ib2op(current _: Ice.Current) throws -> MBIB2Prx? { return _ib2 } - func icop(current: Ice.Current) throws -> MAICPrx? { + func icop(current _: Ice.Current) throws -> MAICPrx? { return _ic } diff --git a/swift/test/Ice/invoke/Client.swift b/swift/test/Ice/invoke/Client.swift index d46aec6c6aa..3fa999ddd18 100644 --- a/swift/test/Ice/invoke/Client.swift +++ b/swift/test/Ice/invoke/Client.swift @@ -3,17 +3,17 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) var initData = Ice.InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceInvoke"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/invoke/Server.swift b/swift/test/Ice/invoke/Server.swift index 65aac7dbedd..e2f93e303e1 100644 --- a/swift/test/Ice/invoke/Server.swift +++ b/swift/test/Ice/invoke/Server.swift @@ -2,14 +2,14 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class ServantLocatorI: Ice.ServantLocator { var _blobject: Ice.Disp - init (_ async: Bool) { + init(_ async: Bool) { if async { _blobject = Ice.BlobjectAsyncDisp(BlobjectAsyncI()) } else { @@ -17,25 +17,24 @@ class ServantLocatorI: Ice.ServantLocator { } } - func locate(_ curr: Ice.Current) -> (returnValue: Ice.Disp?, cookie: AnyObject?) { + func locate(_: Ice.Current) -> (returnValue: Ice.Disp?, cookie: AnyObject?) { return (_blobject, nil) } - func finished(curr: Ice.Current, servant: Ice.Disp, cookie: AnyObject?) {} + func finished(curr _: Ice.Current, servant _: Ice.Disp, cookie _: AnyObject?) {} - func deactivate(_ category: String) {} + func deactivate(_: String) {} } class Server: TestHelperI { public override func run(args: [String]) throws { - let async = args.contains("--async") - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) var initData = Ice.InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceInvoke"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/invoke/TestI.swift b/swift/test/Ice/invoke/TestI.swift index ce4ae76ab2c..2b18e880cac 100644 --- a/swift/test/Ice/invoke/TestI.swift +++ b/swift/test/Ice/invoke/TestI.swift @@ -3,11 +3,10 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class BlobjectI: Ice.Blobject { - func ice_invoke(inEncaps: Data, current: Ice.Current) throws -> (ok: Bool, outParams: Data) { let communicator = current.adapter!.getCommunicator() let inS = Ice.InputStream(communicator: communicator, bytes: inEncaps) diff --git a/swift/test/Ice/location/Client.swift b/swift/test/Ice/location/Client.swift index 7a03980edaa..01c6d81a178 100644 --- a/swift/test/Ice/location/Client.swift +++ b/swift/test/Ice/location/Client.swift @@ -3,18 +3,18 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) properties.setProperty(key: "Ice.Default.Locator", - value: "locator:\(self.getTestEndpoint(properties: properties, num: 0))") + value: "locator:\(getTestEndpoint(properties: properties, num: 0))") var initData = Ice.InitializationData() initData.properties = properties - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/location/Server.swift b/swift/test/Ice/location/Server.swift index f19aab1341f..4bb468638db 100644 --- a/swift/test/Ice/location/Server.swift +++ b/swift/test/Ice/location/Server.swift @@ -2,13 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch import Ice import TestCommon -import Dispatch class Server: TestHelperI { public override func run(args: [String]) throws { - // // Register the server manager. The server manager creates a new // 'server'(a server isn't a different process, it's just a new @@ -19,7 +18,7 @@ class Server: TestHelperI { var initData = Ice.InitializationData() initData.properties = properties - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/location/TestI.swift b/swift/test/Ice/location/TestI.swift index db06c5458d0..80eb1ebf2e3 100644 --- a/swift/test/Ice/location/TestI.swift +++ b/swift/test/Ice/location/TestI.swift @@ -6,11 +6,10 @@ import PromiseKit import TestCommon class HelloI: Hello { - func sayHello(current: Ice.Current) {} + func sayHello(current _: Ice.Current) {} } class TestI: TestIntf { - var _adapter1: Ice.ObjectAdapter var _adapter2: Ice.ObjectAdapter var _registry: ServerLocatorRegistry @@ -18,7 +17,6 @@ class TestI: TestIntf { init(adapter1: Ice.ObjectAdapter, adapter2: Ice.ObjectAdapter, registry: ServerLocatorRegistry) throws { - _adapter1 = adapter1 _adapter2 = adapter2 _registry = registry @@ -26,21 +24,21 @@ class TestI: TestIntf { try _registry.addObject(_adapter1.add(servant: HelloDisp(HelloI()), id: Ice.stringToIdentity("hello"))) } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _adapter1.getCommunicator().shutdown() } - func getHello(current: Ice.Current) throws -> HelloPrx? { + func getHello(current _: Ice.Current) throws -> HelloPrx? { return try uncheckedCast(prx: _adapter1.createIndirectProxy(Ice.stringToIdentity("hello")), type: HelloPrx.self) } - func getReplicatedHello(current: Ice.Current) throws -> HelloPrx? { + func getReplicatedHello(current _: Ice.Current) throws -> HelloPrx? { return try uncheckedCast(prx: _adapter1.createProxy(Ice.stringToIdentity("hello")), type: HelloPrx.self) } - func migrateHello(current: Ice.Current) throws { + func migrateHello(current _: Ice.Current) throws { let id = try Ice.stringToIdentity("hello") do { try _registry.addObject(_adapter2.add(servant: _adapter1.remove(id), id: id)) @@ -51,7 +49,6 @@ class TestI: TestIntf { } class ServerManagerI: ServerManager { - var _registry: ServerLocatorRegistry var _helper: TestHelper var _communicators = [Ice.Communicator]() @@ -62,7 +59,7 @@ class ServerManagerI: ServerManager { _helper = helper } - func startServer(current: Ice.Current) throws { + func startServer(current _: Ice.Current) throws { for c in _communicators { c.waitForShutdown() c.destroy() @@ -91,7 +88,7 @@ class ServerManagerI: ServerManager { // Use fixed port to ensure that OA re-activation doesn't re-use previous port from // another OA(e.g.: TestAdapter2 is re-activated using port of TestAdapter). // - for i in 1...10 { + for i in 1 ... 10 { var adapter: Ice.ObjectAdapter! var adapter2: Ice.ObjectAdapter! @@ -147,7 +144,6 @@ class ServerManagerI: ServerManager { } class ServerLocator: TestLocator { - var _registry: ServerLocatorRegistry var _registryPrx: Ice.LocatorRegistryPrx var _requestCount: Int32 @@ -183,7 +179,7 @@ class ServerLocator: TestLocator { } } - func findObjectByIdAsync(id: Ice.Identity, current: Ice.Current) -> Promise<ObjectPrx?> { + func findObjectByIdAsync(id: Ice.Identity, current _: Ice.Current) -> Promise<ObjectPrx?> { _requestCount += 1 // We add a small delay to make sure locator request queuing gets tested when // running the test on a fast machine @@ -197,22 +193,21 @@ class ServerLocator: TestLocator { } } - func getRegistry(current: Ice.Current) throws -> Ice.LocatorRegistryPrx? { + func getRegistry(current _: Ice.Current) throws -> Ice.LocatorRegistryPrx? { return _registryPrx } - func getRequestCount(current: Ice.Current) throws -> Int32 { + func getRequestCount(current _: Ice.Current) throws -> Int32 { return _requestCount } } class ServerLocatorRegistry: TestLocatorRegistry { - var _adapters = [String: Ice.ObjectPrx]() var _objects = [Ice.Identity: Ice.ObjectPrx]() var _lock = os_unfair_lock() - func setAdapterDirectProxyAsync(id: String, proxy: ObjectPrx?, current: Current) -> Promise<Void> { + func setAdapterDirectProxyAsync(id: String, proxy: ObjectPrx?, current _: Current) -> Promise<Void> { return Promise<Void> { seal in withLock(&_lock) { if let obj = proxy { @@ -228,7 +223,7 @@ class ServerLocatorRegistry: TestLocatorRegistry { func setReplicatedAdapterDirectProxyAsync(adapterId adapter: String, replicaGroupId replica: String, p: Ice.ObjectPrx?, - current: Ice.Current) -> Promise<Void> { + current _: Ice.Current) -> Promise<Void> { return Promise<Void> { seal in withLock(&_lock) { if let obj = p { @@ -243,7 +238,7 @@ class ServerLocatorRegistry: TestLocatorRegistry { } } - func setServerProcessProxyAsync(id: String, proxy: Ice.ProcessPrx?, current: Ice.Current) -> Promise<Void> { + func setServerProcessProxyAsync(id _: String, proxy _: Ice.ProcessPrx?, current _: Ice.Current) -> Promise<Void> { return Promise<Void> { seal in seal.fulfill(()) } @@ -255,7 +250,7 @@ class ServerLocatorRegistry: TestLocatorRegistry { } } - func addObject(obj: Ice.ObjectPrx?, current: Ice.Current) throws { + func addObject(obj: Ice.ObjectPrx?, current _: Ice.Current) throws { addObject(obj) } diff --git a/swift/test/Ice/objects/AllTests.swift b/swift/test/Ice/objects/AllTests.swift index 93f3a0a0eb0..ac10fc78e25 100644 --- a/swift/test/Ice/objects/AllTests.swift +++ b/swift/test/Ice/objects/AllTests.swift @@ -2,10 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice -import TestCommon import PromiseKit -import Foundation +import TestCommon func allTests(_ helper: TestHelper) throws -> InitialPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { @@ -180,7 +180,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { let top = Recursive() var p = top do { - for depth in 0..<1000 { + for depth in 0 ..< 1000 { p.v = Recursive() p = p.v! if (depth < 10 && (depth % 10) == 0) || diff --git a/swift/test/Ice/objects/Client.swift b/swift/test/Ice/objects/Client.swift index ebbcf9ccaf6..7fd5decd901 100644 --- a/swift/test/Ice/objects/Client.swift +++ b/swift/test/Ice/objects/Client.swift @@ -3,16 +3,16 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { - let properties = try self.createTestProperties(args) + let properties = try createTestProperties(args) var initData = InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceObjects"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/objects/TestI.swift b/swift/test/Ice/objects/TestI.swift index ea44bc79257..b86c709a875 100644 --- a/swift/test/Ice/objects/TestI.swift +++ b/swift/test/Ice/objects/TestI.swift @@ -6,31 +6,31 @@ import Ice import PromiseKit public class BI: B { - override public func ice_preMarshal() { - self.preMarshalInvoked = true + public override func ice_preMarshal() { + preMarshalInvoked = true } - override public func ice_postUnmarshal() { - self.postUnmarshalInvoked = true + public override func ice_postUnmarshal() { + postUnmarshalInvoked = true } } public class CI: C { - override public func ice_preMarshal() { + public override func ice_preMarshal() { preMarshalInvoked = true } - override public func ice_postUnmarshal() { + public override func ice_postUnmarshal() { postUnmarshalInvoked = true } } public class DI: D { - override public func ice_preMarshal() { + public override func ice_preMarshal() { preMarshalInvoked = true } - override public func ice_postUnmarshal() { + public override func ice_postUnmarshal() { postUnmarshalInvoked = true } } @@ -106,130 +106,130 @@ class InitialI: Initial { _d.theC = nil // Reference to a C. } - func getAll(current: Ice.Current) throws -> (b1: B?, b2: B?, theC: C?, theD: D?) { + func getAll(current _: Ice.Current) throws -> (b1: B?, b2: B?, theC: C?, theD: D?) { return (_b1, _b2, _c, _d) } - func getMB(current: Current) throws -> B? { + func getMB(current _: Current) throws -> B? { return _b1 } - func getB1(current: Ice.Current) throws -> B? { + func getB1(current _: Ice.Current) throws -> B? { return _b1 } - func getB2(current: Ice.Current) throws -> B? { + func getB2(current _: Ice.Current) throws -> B? { return _b2 } - func getC(current: Ice.Current) throws -> C? { + func getC(current _: Ice.Current) throws -> C? { return _c } - func getD(current: Ice.Current) throws -> D? { + func getD(current _: Ice.Current) throws -> D? { return _d } - func getE(current: Ice.Current) throws -> E? { + func getE(current _: Ice.Current) throws -> E? { return _e } - func getF(current: Ice.Current) throws -> F? { + func getF(current _: Ice.Current) throws -> F? { return _f } - func getI(current: Ice.Current) throws -> Ice.Value? { + func getI(current _: Ice.Current) throws -> Ice.Value? { return II() } - func getJ(current: Ice.Current) throws -> Ice.Value? { + func getJ(current _: Ice.Current) throws -> Ice.Value? { return JI() } - func getH(current: Ice.Current) throws -> Ice.Value? { + func getH(current _: Ice.Current) throws -> Ice.Value? { return HI() } - func getK(current: Ice.Current) throws -> K? { + func getK(current _: Ice.Current) throws -> K? { return K(value: L(data: "l")) } - func opValue(v1: Ice.Value?, current: Ice.Current) throws -> (returnValue: Ice.Value?, v2: Ice.Value?) { + func opValue(v1: Ice.Value?, current _: Ice.Current) throws -> (returnValue: Ice.Value?, v2: Ice.Value?) { return (v1, v1) } - func opValueSeq(v1: [Ice.Value?], current: Ice.Current) throws -> (returnValue: [Ice.Value?], v2: [Ice.Value?]) { + func opValueSeq(v1: [Ice.Value?], current _: Ice.Current) throws -> (returnValue: [Ice.Value?], v2: [Ice.Value?]) { return (v1, v1) } func opValueMap(v1: [String: Ice.Value?], - current: Ice.Current) throws -> (returnValue: [String: Ice.Value?], - v2: [String: Ice.Value?]) { + current _: Ice.Current) throws -> (returnValue: [String: Ice.Value?], + v2: [String: Ice.Value?]) { return (v1, v1) } - func setRecursive(p: Recursive?, current: Ice.Current) {} + func setRecursive(p _: Recursive?, current _: Ice.Current) {} - func supportsClassGraphDepthMax(current: Ice.Current) throws -> Bool { + func supportsClassGraphDepthMax(current _: Ice.Current) throws -> Bool { return true } - func getD1(d1: D1?, current: Ice.Current) throws -> D1? { + func getD1(d1: D1?, current _: Ice.Current) throws -> D1? { return d1 } - func throwEDerived(current: Ice.Current) throws { + func throwEDerived(current _: Ice.Current) throws { throw EDerived(a1: A1(name: "a1"), a2: A1(name: "a2"), a3: A1(name: "a3"), a4: A1(name: "a4")) } - func setG(theG: G?, current: Ice.Current) throws {} + func setG(theG _: G?, current _: Ice.Current) throws {} - func setI(theI: Ice.Value?, current: Ice.Current) throws {} + func setI(theI _: Ice.Value?, current _: Ice.Current) throws {} - func opBaseSeq(inSeq: [Base?], current: Ice.Current) throws -> (returnValue: [Base?], outSeq: [Base?]) { + func opBaseSeq(inSeq: [Base?], current _: Ice.Current) throws -> (returnValue: [Base?], outSeq: [Base?]) { return (inSeq, inSeq) } - func getCompact(current: Ice.Current) throws -> Compact? { + func getCompact(current _: Ice.Current) throws -> Compact? { return CompactExt() } - func shutdown(current: Ice.Current) throws { + func shutdown(current _: Ice.Current) throws { _adapter.getCommunicator().shutdown() } - func getInnerA(current: Ice.Current) throws -> InnerA? { + func getInnerA(current _: Ice.Current) throws -> InnerA? { return InnerA(theA: _b1) } - func getInnerSubA(current: Ice.Current) throws -> InnerSubA? { + func getInnerSubA(current _: Ice.Current) throws -> InnerSubA? { return InnerSubA(theA: InnerA(theA: _b1)) } - func throwInnerEx(current: Ice.Current) throws { + func throwInnerEx(current _: Ice.Current) throws { throw InnerEx(reason: "Inner::Ex") } - func throwInnerSubEx(current: Ice.Current) throws { + func throwInnerSubEx(current _: Ice.Current) throws { throw InnerSubEx(reason: "Inner::Sub::Ex") } - func getAMDMBAsync(current: Ice.Current) -> Promise<B?> { - return Promise<B?> {seal in + func getAMDMBAsync(current _: Ice.Current) -> Promise<B?> { + return Promise<B?> { seal in seal.fulfill(_b1) } } - func opM(v1: M?, current: Ice.Current) throws -> (returnValue: M?, v2: M?) { + func opM(v1: M?, current _: Ice.Current) throws -> (returnValue: M?, v2: M?) { return (v1, v1) } } class UnexpectedObjectExceptionTestI: Ice.Blobject { - func ice_invoke(inEncaps: Data, current: Ice.Current) throws -> (ok: Bool, outParams: Data) { + func ice_invoke(inEncaps _: Data, current: Ice.Current) throws -> (ok: Bool, outParams: Data) { let communicator = current.adapter!.getCommunicator() let ostr = Ice.OutputStream(communicator: communicator) _ = ostr.startEncapsulation(encoding: current.encoding, format: .DefaultFormat) diff --git a/swift/test/Ice/operations/BatchOneways.swift b/swift/test/Ice/operations/BatchOneways.swift index 2a530ff9c50..699fe698775 100644 --- a/swift/test/Ice/operations/BatchOneways.swift +++ b/swift/test/Ice/operations/BatchOneways.swift @@ -7,7 +7,6 @@ import Ice import TestCommon func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -18,7 +17,7 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) throws { _ = try p.opByteSOnewayCallCount() // Reset the call count - for _ in 0..<30 { + for _ in 0 ..< 30 { do { try batch.opByteSOneway(bs1) } catch is Ice.MemoryLimitException { @@ -73,10 +72,9 @@ func batchOneways(_ helper: TestHelper, _ p: MyClassPrx) throws { } catch is Ice.OperationNotExistException {} conn = try p.ice_getConnection() - if supportsCompress && - conn != nil && - p.ice_getCommunicator().getProperties().getProperty("Ice.Override.Compress") == "" { - + if supportsCompress, + conn != nil, + p.ice_getCommunicator().getProperties().getProperty("Ice.Override.Compress") == "" { let prx = try p.ice_getConnection()!.createProxy(p.ice_getIdentity()).ice_batchOneway() let batchC1 = uncheckedCast(prx: prx.ice_compress(false), type: MyClassPrx.self) diff --git a/swift/test/Ice/operations/BatchOnewaysAMI.swift b/swift/test/Ice/operations/BatchOnewaysAMI.swift index 40bc169782c..85277b4ddd7 100644 --- a/swift/test/Ice/operations/BatchOnewaysAMI.swift +++ b/swift/test/Ice/operations/BatchOnewaysAMI.swift @@ -4,11 +4,10 @@ import Darwin import Ice -import TestCommon import PromiseKit +import TestCommon func batchOnewaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -20,7 +19,7 @@ func batchOnewaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { batch.ice_flushBatchRequestsAsync() }.wait() - for _ in 0..<30 { + for _ in 0 ..< 30 { _ = batch.opByteSOnewayAsync(bs1) } diff --git a/swift/test/Ice/operations/Client.swift b/swift/test/Ice/operations/Client.swift index 23a773f8486..9ffb1d4b40e 100644 --- a/swift/test/Ice/operations/Client.swift +++ b/swift/test/Ice/operations/Client.swift @@ -14,7 +14,7 @@ public class Client: TestHelperI { properties.setProperty(key: "Ice.BatchAutoFlushSize", value: "100") initData.properties = properties initData.classResolverPrefix = ["IceOperations"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/operations/Oneways.swift b/swift/test/Ice/operations/Oneways.swift index c6c2d548d21..6c67113af3c 100644 --- a/swift/test/Ice/operations/Oneways.swift +++ b/swift/test/Ice/operations/Oneways.swift @@ -14,7 +14,7 @@ func oneways(_ helper: TestHelper, _ prx: MyClassPrx) throws { try p.opNonmutating() do { - _ = try p.opByte(p1: 0xff, p2: 0x0f) + _ = try p.opByte(p1: 0xFF, p2: 0x0F) try helper.test(false) } catch is Ice.TwowayOnlyException {} } diff --git a/swift/test/Ice/operations/TestAMDI.swift b/swift/test/Ice/operations/TestAMDI.swift index 29d80f4f38d..f97160a95c0 100644 --- a/swift/test/Ice/operations/TestAMDI.swift +++ b/swift/test/Ice/operations/TestAMDI.swift @@ -166,7 +166,10 @@ class MyDerivedClassI: ObjectI<MyDerivedClassTraits>, MyDerivedClass { func opShortIntLongSSAsync(p1: ShortSS, p2: IntSS, p3: LongSS, - current _: Current) -> Promise<(returnValue: LongSS, p4: ShortSS, p5: IntSS, p6: LongSS)> { + current _: Current) -> Promise<(returnValue: LongSS, + p4: ShortSS, + p5: IntSS, + p6: LongSS)> { return Promise.value((p3, p1, p2.reversed(), p3 + p3)) } diff --git a/swift/test/Ice/operations/TestI.swift b/swift/test/Ice/operations/TestI.swift index 0b361726027..3f8461b47f8 100644 --- a/swift/test/Ice/operations/TestI.swift +++ b/swift/test/Ice/operations/TestI.swift @@ -142,7 +142,10 @@ class MyDerivedClassI: ObjectI<MyDerivedClassTraits>, MyDerivedClass { func opShortIntLongS(p1: [Int16], p2: [Int32], p3: [Int64], - current _: Ice.Current) throws -> (returnValue: [Int64], p4: [Int16], p5: [Int32], p6: [Int64]) { + current _: Ice.Current) throws -> (returnValue: [Int64], + p4: [Int16], + p5: [Int32], + p6: [Int64]) { return (p3, p1, p2.reversed(), p3 + p3) } diff --git a/swift/test/Ice/operations/Twoways.swift b/swift/test/Ice/operations/Twoways.swift index 7728cd5f94d..a1aaf472bd4 100644 --- a/swift/test/Ice/operations/Twoways.swift +++ b/swift/test/Ice/operations/Twoways.swift @@ -6,7 +6,6 @@ import Ice import TestCommon func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -16,81 +15,81 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { let literals = try p.opStringLiterals() try test(s0 == "\\" && - s0 == sw0 && - s0 == literals[0] && - s0 == literals[11]) + s0 == sw0 && + s0 == literals[0] && + s0 == literals[11]) try test(s1 == "A" && - s1 == sw1 && - s1 == literals[1] && - s1 == literals[12]) + s1 == sw1 && + s1 == literals[1] && + s1 == literals[12]) try test(s2 == "Ice" && - s2 == sw2 && - s2 == literals[2] && - s2 == literals[13]) + s2 == sw2 && + s2 == literals[2] && + s2 == literals[13]) try test(s3 == "A21" && - s3 == sw3 && - s3 == literals[3] && - s3 == literals[14]) + s3 == sw3 && + s3 == literals[3] && + s3 == literals[14]) try test(s4 == "\\u0041 \\U00000041" && - s4 == sw4 && - s4 == literals[4] && - s4 == literals[15]) + s4 == sw4 && + s4 == literals[4] && + s4 == literals[15]) try test(s5 == "\u{00FF}" && - s5 == sw5 && - s5 == literals[5] && - s5 == literals[16]) + s5 == sw5 && + s5 == literals[5] && + s5 == literals[16]) try test(s6 == "\u{03FF}" && - s6 == sw6 && - s6 == literals[6] && - s6 == literals[17]) + s6 == sw6 && + s6 == literals[6] && + s6 == literals[17]) try test(s7 == "\u{05F0}" && - s7 == sw7 && - s7 == literals[7] && - s7 == literals[18]) + s7 == sw7 && + s7 == literals[7] && + s7 == literals[18]) try test(s8 == "\u{10000}" && - s8 == sw8 && - s8 == literals[8] && - s8 == literals[19]) + s8 == sw8 && + s8 == literals[8] && + s8 == literals[19]) try test(s9 == "\u{1F34C}" && - s9 == sw9 && - s9 == literals[9] && - s9 == literals[20]) + s9 == sw9 && + s9 == literals[9] && + s9 == literals[20]) try test(s10 == "\u{0DA7}" && - s10 == sw10 && - s10 == literals[10] && - s10 == literals[21]) + s10 == sw10 && + s10 == literals[10] && + s10 == literals[21]) try test(ss0 == "\'\"\u{003f}\\\u{0007}\u{0008}\u{000c}\n\r\t\u{000b}\u{0006}" && - ss0 == ss1 && - ss0 == ss2 && - ss0 == literals[22] && - ss0 == literals[23] && - ss0 == literals[24]) + ss0 == ss1 && + ss0 == ss2 && + ss0 == literals[22] && + ss0 == literals[23] && + ss0 == literals[24]) try test(ss3 == "\\\\U\\u\\" && - ss3 == literals[25]) + ss3 == literals[25]) try test(ss4 == "\\A\\" && - ss4 == literals[26]) + ss4 == literals[26]) try test(ss5 == "\\u0041\\" && - ss5 == literals[27]) + ss5 == literals[27]) try test(su0 == su1 && - su0 == su2 && - su0 == literals[28] && - su0 == literals[29] && - su0 == literals[30]) + su0 == su2 && + su0 == literals[28] && + su0 == literals[29] && + su0 == literals[30]) try p.ice_ping() @@ -113,9 +112,9 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let (r, b) = try p.opByte(p1: 0xff, p2: 0x0f) - try test(b == 0xf0) - try test(r == 0xff) + let (r, b) = try p.opByte(p1: 0xFF, p2: 0x0F) + try test(b == 0xF0) + try test(r == 0xFF) } do { @@ -217,7 +216,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { do { let bsi1 = ByteSeq([0x01, 0x11, 0x12, 0x22]) - let bsi2 = ByteSeq([0xf1, 0xf2, 0xf3, 0xf4]) + let bsi2 = ByteSeq([0xF1, 0xF2, 0xF3, 0xF4]) let (rso, bso) = try p.opByteS(p1: bsi1, p2: bsi2) try test(bso.count == 4) @@ -230,10 +229,10 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(rso[1] == 0x11) try test(rso[2] == 0x12) try test(rso[3] == 0x22) - try test(rso[4] == 0xf1) - try test(rso[5] == 0xf2) - try test(rso[6] == 0xf3) - try test(rso[7] == 0xf4) + try test(rso[4] == 0xF1) + try test(rso[5] == 0xF2) + try test(rso[6] == 0xF3) + try test(rso[7] == 0xF4) } do { @@ -318,17 +317,17 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { do { let s11 = ByteSeq([0x01, 0x11, 0x12]) - let s12 = ByteSeq([0xff]) + let s12 = ByteSeq([0xFF]) let bsi1 = [s11, s12] - let s21 = ByteSeq([0x0e]) - let s22 = ByteSeq([0xf2, 0xf1]) + let s21 = ByteSeq([0x0E]) + let s22 = ByteSeq([0xF2, 0xF1]) let bsi2 = [s21, s22] let (rso, bso) = try p.opByteSS(p1: bsi1, p2: bsi2) try test(bso.count == 2) try test(bso[0].count == 1) - try test(bso[0][0] == 0xff) + try test(bso[0][0] == 0xFF) try test(bso[1].count == 3) try test(bso[1][0] == 0x01) try test(bso[1][1] == 0x11) @@ -339,12 +338,12 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(rso[0][1] == 0x11) try test(rso[0][2] == 0x12) try test(rso[1].count == 1) - try test(rso[1][0] == 0xff) + try test(rso[1][0] == 0xFF) try test(rso[2].count == 1) - try test(rso[2][0] == 0x0e) + try test(rso[2][0] == 0x0E) try test(rso[3].count == 2) - try test(rso[3][0] == 0xf2) - try test(rso[3][1] == 0xf1) + try test(rso[3][0] == 0xF2) + try test(rso[3][1] == 0xF1) } do { @@ -546,7 +545,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let di1: [Int16: Int32] = [110: -1, 1100: 123123] + let di1: [Int16: Int32] = [110: -1, 1100: 123_123] let di2: [Int16: Int32] = [110: -1, 111: -100, 1101: 0] let (ro, `do`) = try p.opShortIntD(p1: di1, p2: di2) @@ -554,21 +553,21 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(ro.count == 4) try test(ro[110] == -1) try test(ro[111] == -100) - try test(ro[1100] == 123123) + try test(ro[1100] == 123_123) try test(ro[1101] == 0) } do { - let di1: [Int64: Float] = [999999110: -1.1, 999999111: 123123.2] - let di2: [Int64: Float] = [999999110: -1.1, 999999120: -100.4, 999999130: 0.5] + let di1: [Int64: Float] = [999_999_110: -1.1, 999_999_111: 123_123.2] + let di2: [Int64: Float] = [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5] let (ro, `do`) = try p.opLongFloatD(p1: di1, p2: di2) try test(`do` == di1) try test(ro.count == 4) - try test(ro[999999110] == -1.1) - try test(ro[999999120] == -100.4) - try test(ro[999999111] == 123123.2) - try test(ro[999999130] == 0.5) + try test(ro[999_999_110] == -1.1) + try test(ro[999_999_120] == -100.4) + try test(ro[999_999_111] == 123_123.2) + try test(ro[999_999_130] == 0.5) } do { @@ -661,7 +660,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let di1: [Int16: Int32] = [110: -1, 1100: 123123] + let di1: [Int16: Int32] = [110: -1, 1100: 123_123] let di2: [Int16: Int32] = [110: -1, 111: -100, 1101: 0] let di3: [Int16: Int32] = [100: -1001] @@ -677,14 +676,14 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(ro[0][1101] == 0) try test(ro[1].count == 2) try test(ro[1][110] == -1) - try test(ro[1][1100] == 123123) + try test(ro[1][1100] == 123_123) try test(`do`.count == 3) try test(`do`[0].count == 1) try test(`do`[0][100] == -1001) try test(`do`[1].count == 2) try test(`do`[1][110] == -1) - try test(`do`[1][1100] == 123123) + try test(`do`[1][1100] == 123_123) try test(`do`[2].count == 3) try test(`do`[2][110] == -1) try test(`do`[2][111] == -100) @@ -692,9 +691,9 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let di1: [Int64: Float] = [999999110: -1.1, 999999111: 123123.2] - let di2: [Int64: Float] = [999999110: -1.1, 999999120: -100.4, 999999130: 0.5] - let di3: [Int64: Float] = [999999140: 3.14] + let di1: [Int64: Float] = [999_999_110: -1.1, 999_999_111: 123_123.2] + let di2: [Int64: Float] = [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5] + let di3: [Int64: Float] = [999_999_140: 3.14] let dsi1 = [di1, di2] let dsi2 = [di3] @@ -703,24 +702,23 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(ro.count == 2) try test(ro[0].count == 3) - try test(ro[0][999999110] == -1.1) - try test(ro[0][999999120] == -100.4) - try test(ro[0][999999130] == 0.5) + try test(ro[0][999_999_110] == -1.1) + try test(ro[0][999_999_120] == -100.4) + try test(ro[0][999_999_130] == 0.5) try test(ro[1].count == 2) - try test(ro[1][999999110] == -1.1) - try test(ro[1][999999111] == 123123.2) + try test(ro[1][999_999_110] == -1.1) + try test(ro[1][999_999_111] == 123_123.2) try test(`do`.count == 3) try test(`do`[0].count == 1) - try test(`do`[0][999999140] == 3.14) + try test(`do`[0][999_999_140] == 3.14) try test(`do`[1].count == 2) - try test(`do`[1][999999110] == -1.1) - try test(`do`[1][999999111] == 123123.2) + try test(`do`[1][999_999_110] == -1.1) + try test(`do`[1][999_999_111] == 123_123.2) try test(`do`[2].count == 3) - try test(`do`[2][999999110] == -1.1) - try test(`do`[2][999999120] == -100.4) - try test(`do`[2][999999130] == 0.5) - + try test(`do`[2][999_999_110] == -1.1) + try test(`do`[2][999_999_120] == -100.4) + try test(`do`[2][999_999_130] == 0.5) } do { @@ -852,17 +850,17 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { do { let si1 = ByteSeq([0x01, 0x11]) let si2 = ByteSeq([0x12]) - let si3 = ByteSeq([0xf2, 0xf3]) + let si3 = ByteSeq([0xF2, 0xF3]) let sdi1: [UInt8: ByteSeq] = [0x01: si1, 0x22: si2] - let sdi2: [UInt8: ByteSeq] = [0xf1: si3] + let sdi2: [UInt8: ByteSeq] = [0xF1: si3] let (ro, `do`) = try p.opByteByteSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) - try test(`do`[0xf1]!.count == 2) - try test(`do`[0xf1]![0] == 0xf2) - try test(`do`[0xf1]![1] == 0xf3) + try test(`do`[0xF1]!.count == 2) + try test(`do`[0xF1]![0] == 0xF2) + try test(`do`[0xF1]![1] == 0xF3) try test(ro.count == 3) try test(ro[0x01]!.count == 2) @@ -870,9 +868,9 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(ro[0x01]![1] == 0x11) try test(ro[0x22]!.count == 1) try test(ro[0x22]![0] == 0x12) - try test(ro[0xf1]!.count == 2) - try test(ro[0xf1]![0] == 0xf2) - try test(ro[0xf1]![1] == 0xf3) + try test(ro[0xF1]!.count == 2) + try test(ro[0xF1]![0] == 0xF2) + try test(ro[0xF1]![1] == 0xF3) } do { @@ -955,34 +953,34 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let si1: [Int64] = [999999110, 999999111, 999999110] - let si2: [Int64] = [999999120, 999999130] - let si3: [Int64] = [999999110, 999999120] + let si1: [Int64] = [999_999_110, 999_999_111, 999_999_110] + let si2: [Int64] = [999_999_120, 999_999_130] + let si3: [Int64] = [999_999_110, 999_999_120] - let sdi1: [Int64: [Int64]] = [999999990: si1, 999999991: si2] - let sdi2: [Int64: [Int64]] = [999999992: si3] + let sdi1: [Int64: [Int64]] = [999_999_990: si1, 999_999_991: si2] + let sdi2: [Int64: [Int64]] = [999_999_992: si3] let (ro, `do`) = try p.opLongLongSD(p1: sdi1, p2: sdi2) try test(`do`.count == 1) - try test(`do`[999999992]!.count == 2) - try test(`do`[999999992]![0] == 999999110) - try test(`do`[999999992]![1] == 999999120) + try test(`do`[999_999_992]!.count == 2) + try test(`do`[999_999_992]![0] == 999_999_110) + try test(`do`[999_999_992]![1] == 999_999_120) try test(ro.count == 3) - try test(ro[999999990]!.count == 3) - try test(ro[999999990]![0] == 999999110) - try test(ro[999999990]![1] == 999999111) - try test(ro[999999990]![2] == 999999110) - try test(ro[999999991]!.count == 2) - try test(ro[999999991]![0] == 999999120) - try test(ro[999999991]![1] == 999999130) - try test(ro[999999992]!.count == 2) - try test(ro[999999992]![0] == 999999110) - try test(ro[999999992]![1] == 999999120) + try test(ro[999_999_990]!.count == 3) + try test(ro[999_999_990]![0] == 999_999_110) + try test(ro[999_999_990]![1] == 999_999_111) + try test(ro[999_999_990]![2] == 999_999_110) + try test(ro[999_999_991]!.count == 2) + try test(ro[999_999_991]![0] == 999_999_120) + try test(ro[999_999_991]![1] == 999_999_130) + try test(ro[999_999_992]!.count == 2) + try test(ro[999_999_992]![0] == 999_999_110) + try test(ro[999_999_992]![1] == 999_999_120) } do { - let si1: [Float] = [-1.1, 123123.2, 100.0] + let si1: [Float] = [-1.1, 123_123.2, 100.0] let si2: [Float] = [42.24, -1.61] let si3: [Float] = [-3.14, 3.14] @@ -999,7 +997,7 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(ro.count == 3) try test(ro["abc"]!.count == 3) try test(ro["abc"]![0] == -1.1) - try test(ro["abc"]![1] == 123123.2) + try test(ro["abc"]![1] == 123_123.2) try test(ro["abc"]![2] == 100.0) try test(ro["ABC"]!.count == 2) try test(ro["ABC"]![0] == 42.24) @@ -1010,9 +1008,9 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { } do { - let si1: [Double] = [1.1E10, 1.2E10, 1.3E10] - let si2: [Double] = [1.4E10, 1.5E10] - let si3: [Double] = [1.6E10, 1.7E10] + let si1: [Double] = [1.1e10, 1.2e10, 1.3e10] + let si2: [Double] = [1.4e10, 1.5e10] + let si3: [Double] = [1.6e10, 1.7e10] let sdi1 = ["Hello!!": si1, "Goodbye": si2] let sdi2 = ["": si3] @@ -1021,19 +1019,19 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { try test(`do`.count == 1) try test(`do`[""]!.count == 2) - try test(`do`[""]![0] == 1.6E10) - try test(`do`[""]![1] == 1.7E10) + try test(`do`[""]![0] == 1.6e10) + try test(`do`[""]![1] == 1.7e10) try test(ro.count == 3) try test(ro["Hello!!"]!.count == 3) - try test(ro["Hello!!"]![0] == 1.1E10) - try test(ro["Hello!!"]![1] == 1.2E10) - try test(ro["Hello!!"]![2] == 1.3E10) + try test(ro["Hello!!"]![0] == 1.1e10) + try test(ro["Hello!!"]![1] == 1.2e10) + try test(ro["Hello!!"]![2] == 1.3e10) try test(ro["Goodbye"]!.count == 2) - try test(ro["Goodbye"]![0] == 1.4E10) - try test(ro["Goodbye"]![1] == 1.5E10) + try test(ro["Goodbye"]![0] == 1.4e10) + try test(ro["Goodbye"]![1] == 1.5e10) try test(ro[""]!.count == 2) - try test(ro[""]![0] == 1.6E10) - try test(ro[""]![1] == 1.7E10) + try test(ro[""]![0] == 1.6e10) + try test(ro[""]![1] == 1.7e10) } do { @@ -1094,15 +1092,15 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { do { let lengths: [Int32] = [0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000] - for l in 0..<lengths.count { + for l in 0 ..< lengths.count { var s: [Int32] = [Int32]() - for i in 0..<lengths[l] { + for i in 0 ..< lengths[l] { s.append(i) } let r = try p.opIntS(s) try test(r.count == lengths[l]) - for j in 0..<r.count { + for j in 0 ..< r.count { try test(r[j] == -j) } } @@ -1191,8 +1189,8 @@ func twoways(_ helper: TestHelper, _ p: MyClassPrx, _ bprx: MBPrx) throws { do { try test(p.opByte1(0xFF) == 0xFF) try test(p.opShort1(0x7FFF) == 0x7FFF) - try test(p.opInt1(0x7FFFFFFF) == 0x7FFFFFFF) - try test(p.opLong1(0x7FFFFFFFFFFFFFFF) == 0x7FFFFFFFFFFFFFFF) + try test(p.opInt1(0x7FFF_FFFF) == 0x7FFF_FFFF) + try test(p.opLong1(0x7FFF_FFFF_FFFF_FFFF) == 0x7FFF_FFFF_FFFF_FFFF) try test(p.opFloat1(1.0) == 1.0) try test(p.opDouble1(1.0) == 1.0) try test(p.opString1("opString1") == "opString1") diff --git a/swift/test/Ice/operations/TwowaysAMI.swift b/swift/test/Ice/operations/TwowaysAMI.swift index 5ed637ffa20..57357246be2 100644 --- a/swift/test/Ice/operations/TwowaysAMI.swift +++ b/swift/test/Ice/operations/TwowaysAMI.swift @@ -3,11 +3,10 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { - func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -41,10 +40,10 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opByteAsync(p1: 0xff, p2: 0x0f) + p.opByteAsync(p1: 0xFF, p2: 0x0F) }.done { returnValue, p3 in - try test(returnValue == 0xff) - try test(p3 == 0xf0) + try test(returnValue == 0xFF) + try test(p3 == 0xF0) }.wait() try firstly { @@ -64,7 +63,7 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opFloatDoubleAsync(p1: 3.14, p2: 1.1E10) + p.opFloatDoubleAsync(p1: 3.14, p2: 1.1e10) }.done { returnValue, p3, p4 in try test(p3 == 3.14) try test(p4 == 1.1e10) @@ -80,7 +79,7 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { try firstly { p.opMyEnumAsync(MyEnum.enum2) - }.done {returnValue, p2 in + }.done { returnValue, p2 in try test(p2 == MyEnum.enum2) try test(returnValue == MyEnum.enum3) }.wait() @@ -124,7 +123,7 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { try firstly { p.opByteSAsync(p1: ByteSeq([0x01, 0x11, 0x12, 0x22]), - p2: ByteSeq([0xf1, 0xf2, 0xf3, 0xf4])) + p2: ByteSeq([0xF1, 0xF2, 0xF3, 0xF4])) }.done { returnValue, p3 in try test(p3.count == 4) try test(p3[0] == 0x22) @@ -136,10 +135,10 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { try test(returnValue[1] == 0x11) try test(returnValue[2] == 0x12) try test(returnValue[3] == 0x22) - try test(returnValue[4] == 0xf1) - try test(returnValue[5] == 0xf2) - try test(returnValue[6] == 0xf3) - try test(returnValue[7] == 0xf4) + try test(returnValue[4] == 0xF1) + try test(returnValue[5] == 0xF2) + try test(returnValue[6] == 0xF3) + try test(returnValue[7] == 0xF4) }.wait() try firstly { @@ -218,12 +217,12 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opByteSSAsync(p1: [ByteSeq([0x01, 0x11, 0x12]), ByteSeq([0xff])], - p2: [ByteSeq([0x0e]), ByteSeq([0xf2, 0xf1])]) + p.opByteSSAsync(p1: [ByteSeq([0x01, 0x11, 0x12]), ByteSeq([0xFF])], + p2: [ByteSeq([0x0E]), ByteSeq([0xF2, 0xF1])]) }.done { returnValue, p3 in try test(p3.count == 2) try test(p3[0].count == 1) - try test(p3[0][0] == 0xff) + try test(p3[0][0] == 0xFF) try test(p3[1].count == 3) try test(p3[1][0] == 0x01) try test(p3[1][1] == 0x11) @@ -234,12 +233,12 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { try test(returnValue[0][1] == 0x11) try test(returnValue[0][2] == 0x12) try test(returnValue[1].count == 1) - try test(returnValue[1][0] == 0xff) + try test(returnValue[1][0] == 0xFF) try test(returnValue[2].count == 1) - try test(returnValue[2][0] == 0x0e) + try test(returnValue[2][0] == 0x0E) try test(returnValue[3].count == 2) - try test(returnValue[3][0] == 0xf2) - try test(returnValue[3][1] == 0xf1) + try test(returnValue[3][0] == 0xF2) + try test(returnValue[3][1] == 0xF1) }.wait() try firstly { @@ -395,19 +394,19 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opShortIntDAsync(p1: [110: -1, 1100: 123123], + p.opShortIntDAsync(p1: [110: -1, 1100: 123_123], p2: [110: -1, 111: -100, 1101: 0]) }.done { returnValue, p3 in - try test(p3 == [110: -1, 1100: 123123]) - try test(returnValue == [110: -1, 111: -100, 1100: 123123, 1101: 0]) + try test(p3 == [110: -1, 1100: 123_123]) + try test(returnValue == [110: -1, 111: -100, 1100: 123_123, 1101: 0]) }.wait() try firstly { - p.opLongFloatDAsync(p1: [999999110: -1.1, 999999111: 123123.2], - p2: [999999110: -1.1, 999999120: -100.4, 999999130: 0.5]) + p.opLongFloatDAsync(p1: [999_999_110: -1.1, 999_999_111: 123_123.2], + p2: [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5]) }.done { returnValue, p3 in - try test(p3 == [999999110: -1.1, 999999111: 123123.2]) - try test(returnValue == [999999110: -1.1, 999999120: -100.4, 999999111: 123123.2, 999999130: 0.5]) + try test(p3 == [999_999_110: -1.1, 999_999_111: 123_123.2]) + try test(returnValue == [999_999_110: -1.1, 999_999_120: -100.4, 999_999_111: 123_123.2, 999_999_130: 0.5]) }.wait() try firstly { @@ -470,25 +469,25 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opShortIntDSAsync(p1: [[110: -1, 1100: 123123], [110: -1, 111: -100, 1101: 0]], + p.opShortIntDSAsync(p1: [[110: -1, 1100: 123_123], [110: -1, 111: -100, 1101: 0]], p2: [[100: -1001]]) }.done { returnValue, p3 in - try test(returnValue == [[110: -1, 111: -100, 1101: 0], [110: -1, 1100: 123123]]) + try test(returnValue == [[110: -1, 111: -100, 1101: 0], [110: -1, 1100: 123_123]]) try test(p3 == [[100: -1001], - [110: -1, 1100: 123123], + [110: -1, 1100: 123_123], [110: -1, 111: -100, 1101: 0]]) }.wait() try firstly { - p.opLongFloatDSAsync(p1: [[999999110: -1.1, 999999111: 123123.2], - [999999110: -1.1, 999999120: -100.4, 999999130: 0.5]], - p2: [[999999140: 3.14]]) + p.opLongFloatDSAsync(p1: [[999_999_110: -1.1, 999_999_111: 123_123.2], + [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5]], + p2: [[999_999_140: 3.14]]) }.done { returnValue, p3 in - try test(returnValue == [[999999110: -1.1, 999999120: -100.4, 999999130: 0.5], - [999999110: -1.1, 999999111: 123123.2]]) - try test(p3 == [[999999140: 3.14], - [999999110: -1.1, 999999111: 123123.2], - [999999110: -1.1, 999999120: -100.4, 999999130: 0.5]]) + try test(returnValue == [[999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5], + [999_999_110: -1.1, 999_999_111: 123_123.2]]) + try test(p3 == [[999_999_140: 3.14], + [999_999_110: -1.1, 999_999_111: 123_123.2], + [999_999_110: -1.1, 999_999_120: -100.4, 999_999_130: 0.5]]) }.wait() try firstly { @@ -554,13 +553,13 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { try firstly { p.opByteByteSDAsync(p1: [0x01: ByteSeq([0x01, 0x11]), 0x22: ByteSeq([0x12])], - p2: [0xf1: ByteSeq([0xf2, 0xf3])]) + p2: [0xF1: ByteSeq([0xF2, 0xF3])]) }.done { returnValue, p3 in - try test(p3 == [0xf1: ByteSeq([0xf2, 0xf3])]) + try test(p3 == [0xF1: ByteSeq([0xF2, 0xF3])]) try test(returnValue == [0x01: ByteSeq([0x01, 0x11]), 0x22: ByteSeq([0x12]), - 0xf1: ByteSeq([0xf2, 0xf3])]) + 0xF1: ByteSeq([0xF2, 0xF3])]) }.wait() try firstly { @@ -588,36 +587,36 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { }.wait() try firstly { - p.opLongLongSDAsync(p1: [999999990: [999999110, 999999111, 999999110], - 999999991: [999999120, 999999130]], - p2: [999999992: [999999110, 999999120]]) + p.opLongLongSDAsync(p1: [999_999_990: [999_999_110, 999_999_111, 999_999_110], + 999_999_991: [999_999_120, 999_999_130]], + p2: [999_999_992: [999_999_110, 999_999_120]]) }.done { returnValue, p3 in - try test(p3 == [999999992: [999999110, 999999120]]) - try test(returnValue == [999999990: [999999110, 999999111, 999999110], - 999999991: [999999120, 999999130], - 999999992: [999999110, 999999120]]) + try test(p3 == [999_999_992: [999_999_110, 999_999_120]]) + try test(returnValue == [999_999_990: [999_999_110, 999_999_111, 999_999_110], + 999_999_991: [999_999_120, 999_999_130], + 999_999_992: [999_999_110, 999_999_120]]) }.wait() try firstly { - p.opStringFloatSDAsync(p1: ["abc": [-1.1, 123123.2, 100.0], + p.opStringFloatSDAsync(p1: ["abc": [-1.1, 123_123.2, 100.0], "ABC": [42.24, -1.61]], p2: ["aBc": [-3.14, 3.14]]) }.done { returnValue, p3 in try test(p3 == ["aBc": [-3.14, 3.14]]) - try test(returnValue == ["abc": [-1.1, 123123.2, 100.0], + try test(returnValue == ["abc": [-1.1, 123_123.2, 100.0], "ABC": [42.24, -1.61], "aBc": [-3.14, 3.14]]) }.wait() try firstly { - p.opStringDoubleSDAsync(p1: ["Hello!!": [1.1E10, 1.2E10, 1.3E10], - "Goodbye": [1.4E10, 1.5E10]], - p2: ["": [1.6E10, 1.7E10]]) + p.opStringDoubleSDAsync(p1: ["Hello!!": [1.1e10, 1.2e10, 1.3e10], + "Goodbye": [1.4e10, 1.5e10]], + p2: ["": [1.6e10, 1.7e10]]) }.done { returnValue, p3 in - try test(p3 == ["": [1.6E10, 1.7E10]]) - try test(returnValue == ["Hello!!": [1.1E10, 1.2E10, 1.3E10], - "Goodbye": [1.4E10, 1.5E10], - "": [1.6E10, 1.7E10]]) + try test(p3 == ["": [1.6e10, 1.7e10]]) + try test(returnValue == ["Hello!!": [1.1e10, 1.2e10, 1.3e10], + "Goodbye": [1.4e10, 1.5e10], + "": [1.6e10, 1.7e10]]) }.wait() try firstly { @@ -646,16 +645,16 @@ func twowaysAMI(_ helper: TestHelper, _ p: MyClassPrx) throws { do { let lengths: [Int32] = [0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000] - for i in 0..<lengths.count { + for i in 0 ..< lengths.count { var s = [Int32]() - for j in 0..<lengths[i] { + for j in 0 ..< lengths[i] { s.append(j) } try firstly { p.opIntSAsync(s) }.done { r in - for j in 0..<r.count { + for j in 0 ..< r.count { try test(r[j] == -j) } }.wait() diff --git a/swift/test/Ice/optional/AllTests.swift b/swift/test/Ice/optional/AllTests.swift index d65f9e166a3..2550f38a8aa 100644 --- a/swift/test/Ice/optional/AllTests.swift +++ b/swift/test/Ice/optional/AllTests.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class TestValueReader: Ice.Value { public override func _iceRead(from istr: Ice.InputStream) throws { @@ -79,7 +79,6 @@ class DValueWriter: Ice.Value { } class DValueReader: Ice.Value { - var a: A? var helper: TestHelper? @@ -101,11 +100,11 @@ class DValueReader: Ice.Value { try istr.skip(4) let o: [String] = try istr.read() try helper!.test(o.count == 4 && - o[0] == "test1" && - o[1] == "test2" && - o[2] == "test3" && - o[3] == "test4") - try istr.read(tag: 1000, value: A.self) { self.a = $0} + o[0] == "test1" && + o[1] == "test2" && + o[2] == "test3" && + o[3] == "test4") + try istr.read(tag: 1000, value: A.self) { self.a = $0 } try istr.endSlice() // ::Test::B _ = try istr.startSlice() @@ -124,17 +123,17 @@ class DValueReader: Ice.Value { } class FValueReader: Ice.Value { - public required init() { _f = F() super.init() } + public override func _iceRead(from istr: Ice.InputStream) throws { _f = F() _ = istr.startValue() _ = try istr.startSlice() // Don't read af on purpose - //in.read(1, _f.af); + // in.read(1, _f.af); try istr.endSlice() _ = try istr.startSlice() try istr.read(A.self) { self._f.ae = $0 } @@ -150,7 +149,6 @@ class FValueReader: Ice.Value { } class FactoryI { - init(helper: TestHelper) { _enabled = false _helper = helper @@ -186,7 +184,7 @@ class FactoryI { let _helper: TestHelper } -func allTests(_ helper: TestHelper) throws -> InitialPrx { +func allTests(_ helper: TestHelper) throws -> InitialPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { try helper.test(value, file: file, line: line) } @@ -274,7 +272,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try test(mo1.shs![0] == 1) try test(mo1.es![0] == .MyEnumMember && - mo1.es![1] == .MyEnumMember) + mo1.es![1] == .MyEnumMember) try test(mo1.fss![0] == FixedStruct(m: 78)) try test(mo1.vss![0] == VarStruct(m: "hello")) @@ -367,7 +365,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try test(mo5.vs == mo1.vs) try test(mo5.shs == mo1.shs) try test(mo5.es![0] == .MyEnumMember && - mo1.es![1] == .MyEnumMember) + mo1.es![1] == .MyEnumMember) try test(mo5.fss![0] == FixedStruct(m: 78)) try test(mo5.vss![0] == VarStruct(m: "hello")) try test(mo5.oos![0]!.a! == 15) @@ -478,7 +476,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try test(mo9.shs == nil) try test(mo9.es![0] == .MyEnumMember && - mo9.es![1] == .MyEnumMember) + mo9.es![1] == .MyEnumMember) try test(mo9.fss == nil) try test(mo9.vss![0] == VarStruct(m: "hello")) try test(mo9.oos == nil) @@ -530,7 +528,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { _ = try istr.startEncapsulation() var v: Ice.Value? - try istr.read { v = $0 } + try istr.read { v = $0 } try istr.endEncapsulation() try test(v != nil && v is TestValueReader) } @@ -581,10 +579,10 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { g.gg2Opt = G2(a: 20) g.gg1 = G1(a: "gg1") g = try initial.opG(g) - try test("gg1Opt" == g.gg1Opt!.a) - try test(10 == g.gg2!.a) - try test(20 == g.gg2Opt!.a) - try test("gg1" == g.gg1!.a) + try test(g.gg1Opt!.a == "gg1Opt") + try test(g.gg2!.a == 10) + try test(g.gg2Opt!.a == 20) + try test(g.gg1!.a == "gg1") try initial.opVoid() @@ -610,7 +608,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { mc.fss = FixedStructSeq(repeating: FixedStruct(), count: 300) mc.ifsd = IntFixedStructDict() - for i: Int32 in 0..<300 { + for i: Int32 in 0 ..< 300 { mc.ifsd![i] = FixedStruct() } @@ -1494,7 +1492,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try Promise<Void> { seal in firstly { initial.opMyEnumAsync(nil) - }.done {p2, p3 in + }.done { p2, p3 in try test(p2 == nil && p3 == nil) seal.fulfill(()) }.catch { e in @@ -1505,7 +1503,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try Promise<Void> { seal in firstly { initial.opMyEnumAsync() - }.done {p2, p3 in + }.done { p2, p3 in try test(p2 == nil && p3 == nil) seal.fulfill(()) }.catch { e in @@ -1520,7 +1518,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try Promise<Void> { seal in firstly { initial.opMyEnumAsync(p1) - }.done {p2, p3 in + }.done { p2, p3 in try test(p2 == .MyEnumMember && p3 == .MyEnumMember) seal.fulfill(()) }.catch { e in @@ -1657,10 +1655,10 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { (p2, p3) = try initial.opFixedStruct(p1) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFixedStruct(nil) + (p2, p3) = try initial.opFixedStruct(nil) try test(p2 == nil && p3 == nil) - (p2, p3) = try initial.opFixedStruct() + (p2, p3) = try initial.opFixedStruct() try test(p2 == nil && p3 == nil) try Promise<Void> { seal in @@ -1734,7 +1732,6 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { istr = Ice.InputStream(communicator: communicator, bytes: result.outEncaps) _ = try istr.startEncapsulation() try istr.endEncapsulation() - } do { @@ -1769,7 +1766,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try test(p2 == nil && p3 == nil) seal.fulfill(()) }.catch { e in - seal.reject(e) + seal.reject(e) } }.wait() @@ -2056,7 +2053,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opByteSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2141,7 +2138,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opBoolSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2226,7 +2223,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opShortSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2311,7 +2308,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opIntSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2396,7 +2393,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opLongSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2481,7 +2478,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opFloatSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2566,7 +2563,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opDoubleSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() @@ -2651,7 +2648,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { }.wait() (p2, p3) = try initial.opStringSeq(nil) - try test(p2 == nil && p3 == nil); // Ensure out parameter is cleared. + try test(p2 == nil && p3 == nil) // Ensure out parameter is cleared. let ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() diff --git a/swift/test/Ice/optional/TestAMDI.swift b/swift/test/Ice/optional/TestAMDI.swift index 56ca6c2c0cf..677db51b09c 100644 --- a/swift/test/Ice/optional/TestAMDI.swift +++ b/swift/test/Ice/optional/TestAMDI.swift @@ -3,9 +3,9 @@ // import Foundation -import TestCommon import Ice import PromiseKit +import TestCommon class InitialI: Initial { func shutdownAsync(current: Current) -> Promise<Void> { @@ -15,23 +15,23 @@ class InitialI: Initial { } } - func pingPongAsync(o: Value?, current: Current) -> Promise<Value?> { + func pingPongAsync(o: Value?, current _: Current) -> Promise<Value?> { return Promise.value(o) } - func opOptionalExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current: Current) -> Promise<Void> { + func opOptionalExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current _: Current) -> Promise<Void> { return Promise { seal in seal.reject(OptionalException(req: false, a: a, b: b, o: o)) } } - func opDerivedExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current: Current) -> Promise<Void> { + func opDerivedExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current _: Current) -> Promise<Void> { return Promise { seal in seal.reject(DerivedException(req: false, a: a, b: b, o: o, ss: b, o2: o)) } } - func opRequiredExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current: Current) -> Promise<Void> { + func opRequiredExceptionAsync(a: Int32?, b: String?, o: OneOptional?, current _: Current) -> Promise<Void> { return Promise { seal in let e = RequiredException() e.a = a @@ -46,213 +46,215 @@ class InitialI: Initial { } } - func opByteAsync(p1: UInt8?, current: Current) -> Promise<(returnValue: UInt8?, p3: UInt8?)> { + func opByteAsync(p1: UInt8?, current _: Current) -> Promise<(returnValue: UInt8?, p3: UInt8?)> { return Promise.value((p1, p1)) } - func opBoolAsync(p1: Bool?, current: Current) -> Promise<(returnValue: Bool?, p3: Bool?)> { + func opBoolAsync(p1: Bool?, current _: Current) -> Promise<(returnValue: Bool?, p3: Bool?)> { return Promise.value((p1, p1)) } - func opShortAsync(p1: Int16?, current: Current) -> Promise<(returnValue: Int16?, p3: Int16?)> { + func opShortAsync(p1: Int16?, current _: Current) -> Promise<(returnValue: Int16?, p3: Int16?)> { return Promise.value((p1, p1)) } - func opIntAsync(p1: Int32?, current: Current) -> Promise<(returnValue: Int32?, p3: Int32?)> { + func opIntAsync(p1: Int32?, current _: Current) -> Promise<(returnValue: Int32?, p3: Int32?)> { return Promise.value((p1, p1)) } - func opLongAsync(p1: Int64?, current: Current) -> Promise<(returnValue: Int64?, p3: Int64?)> { + func opLongAsync(p1: Int64?, current _: Current) -> Promise<(returnValue: Int64?, p3: Int64?)> { return Promise.value((p1, p1)) } - func opFloatAsync(p1: Float?, current: Current) -> Promise<(returnValue: Float?, p3: Float?)> { + func opFloatAsync(p1: Float?, current _: Current) -> Promise<(returnValue: Float?, p3: Float?)> { return Promise.value((p1, p1)) } - func opDoubleAsync(p1: Double?, current: Current) -> Promise<(returnValue: Double?, p3: Double?)> { + func opDoubleAsync(p1: Double?, current _: Current) -> Promise<(returnValue: Double?, p3: Double?)> { return Promise.value((p1, p1)) } - func opStringAsync(p1: String?, current: Current) -> Promise<(returnValue: String?, p3: String?)> { + func opStringAsync(p1: String?, current _: Current) -> Promise<(returnValue: String?, p3: String?)> { return Promise.value((p1, p1)) } - func opMyEnumAsync(p1: MyEnum?, current: Current) -> Promise<(returnValue: MyEnum?, p3: MyEnum?)> { + func opMyEnumAsync(p1: MyEnum?, current _: Current) -> Promise<(returnValue: MyEnum?, p3: MyEnum?)> { return Promise.value((p1, p1)) } func opSmallStructAsync(p1: SmallStruct?, - current: Current) -> Promise<(returnValue: SmallStruct?, p3: SmallStruct?)> { + current _: Current) -> Promise<(returnValue: SmallStruct?, p3: SmallStruct?)> { return Promise.value((p1, p1)) } func opFixedStructAsync(p1: FixedStruct?, - current: Current) -> Promise<(returnValue: FixedStruct?, p3: FixedStruct?)> { + current _: Current) -> Promise<(returnValue: FixedStruct?, p3: FixedStruct?)> { return Promise.value((p1, p1)) } - func opVarStructAsync(p1: VarStruct?, current: Current) -> Promise<(returnValue: VarStruct?, p3: VarStruct?)> { + func opVarStructAsync(p1: VarStruct?, current _: Current) -> Promise<(returnValue: VarStruct?, p3: VarStruct?)> { return Promise.value((p1, p1)) } func opOneOptionalAsync(p1: OneOptional?, - current: Current) -> Promise<(returnValue: OneOptional?, p3: OneOptional?)> { + current _: Current) -> Promise<(returnValue: OneOptional?, p3: OneOptional?)> { return Promise.value((p1, p1)) } func opOneOptionalProxyAsync(p1: ObjectPrx?, - current: Current) -> Promise<(returnValue: ObjectPrx?, p3: ObjectPrx?)> { + current _: Current) -> Promise<(returnValue: ObjectPrx?, p3: ObjectPrx?)> { return Promise.value((p1, p1)) } - func opByteSeqAsync(p1: ByteSeq?, current: Current) -> Promise<(returnValue: ByteSeq?, p3: ByteSeq?)> { + func opByteSeqAsync(p1: ByteSeq?, current _: Current) -> Promise<(returnValue: ByteSeq?, p3: ByteSeq?)> { return Promise.value((p1, p1)) } - func opBoolSeqAsync(p1: BoolSeq?, current: Current) -> Promise<(returnValue: BoolSeq?, p3: BoolSeq?)> { + func opBoolSeqAsync(p1: BoolSeq?, current _: Current) -> Promise<(returnValue: BoolSeq?, p3: BoolSeq?)> { return Promise.value((p1, p1)) } - func opShortSeqAsync(p1: ShortSeq?, current: Current) -> Promise<(returnValue: ShortSeq?, p3: ShortSeq?)> { + func opShortSeqAsync(p1: ShortSeq?, current _: Current) -> Promise<(returnValue: ShortSeq?, p3: ShortSeq?)> { return Promise.value((p1, p1)) } - func opIntSeqAsync(p1: IntSeq?, current: Current) -> Promise<(returnValue: IntSeq?, p3: IntSeq?)> { + func opIntSeqAsync(p1: IntSeq?, current _: Current) -> Promise<(returnValue: IntSeq?, p3: IntSeq?)> { return Promise.value((p1, p1)) } - func opLongSeqAsync(p1: LongSeq?, current: Current) -> Promise<(returnValue: LongSeq?, p3: LongSeq?)> { + func opLongSeqAsync(p1: LongSeq?, current _: Current) -> Promise<(returnValue: LongSeq?, p3: LongSeq?)> { return Promise.value((p1, p1)) } - func opFloatSeqAsync(p1: FloatSeq?, current: Current) -> Promise<(returnValue: FloatSeq?, p3: FloatSeq?)> { + func opFloatSeqAsync(p1: FloatSeq?, current _: Current) -> Promise<(returnValue: FloatSeq?, p3: FloatSeq?)> { return Promise.value((p1, p1)) } - func opDoubleSeqAsync(p1: DoubleSeq?, current: Current) -> Promise<(returnValue: DoubleSeq?, p3: DoubleSeq?)> { + func opDoubleSeqAsync(p1: DoubleSeq?, current _: Current) -> Promise<(returnValue: DoubleSeq?, p3: DoubleSeq?)> { return Promise.value((p1, p1)) } - func opStringSeqAsync(p1: StringSeq?, current: Current) -> Promise<(returnValue: StringSeq?, p3: StringSeq?)> { + func opStringSeqAsync(p1: StringSeq?, current _: Current) -> Promise<(returnValue: StringSeq?, p3: StringSeq?)> { return Promise.value((p1, p1)) } func opSmallStructSeqAsync(p1: SmallStructSeq?, - current: Current) -> Promise<(returnValue: SmallStructSeq?, p3: SmallStructSeq?)> { + current _: Current) -> Promise<(returnValue: SmallStructSeq?, p3: SmallStructSeq?)> { return Promise.value((p1, p1)) } func opSmallStructListAsync(p1: SmallStructList?, - current: Current) -> Promise<(returnValue: SmallStructList?, p3: SmallStructList?)> { + current _: Current) -> Promise<(returnValue: SmallStructList?, p3: SmallStructList?)> { return Promise.value((p1, p1)) } func opFixedStructSeqAsync(p1: FixedStructSeq?, - current: Current) -> Promise<(returnValue: FixedStructSeq?, p3: FixedStructSeq?)> { + current _: Current) -> Promise<(returnValue: FixedStructSeq?, p3: FixedStructSeq?)> { return Promise.value((p1, p1)) } func opFixedStructListAsync(p1: FixedStructList?, - current: Current) -> Promise<(returnValue: FixedStructList?, p3: FixedStructList?)> { + current _: Current) -> Promise<(returnValue: FixedStructList?, p3: FixedStructList?)> { return Promise.value((p1, p1)) } func opVarStructSeqAsync(p1: VarStructSeq?, - current: Current) -> Promise<(returnValue: VarStructSeq?, p3: VarStructSeq?)> { + current _: Current) -> Promise<(returnValue: VarStructSeq?, p3: VarStructSeq?)> { return Promise.value((p1, p1)) } func opSerializableAsync(p1: Serializable?, - current: Current) -> Promise<(returnValue: Serializable?, p3: Serializable?)> { + current _: Current) -> Promise<(returnValue: Serializable?, p3: Serializable?)> { return Promise.value((p1, p1)) } - func opIntIntDictAsync(p1: IntIntDict?, current: Current) -> Promise<(returnValue: IntIntDict?, p3: IntIntDict?)> { + func opIntIntDictAsync(p1: IntIntDict?, current _: Current) -> Promise<(returnValue: IntIntDict?, + p3: IntIntDict?)> { return Promise.value((p1, p1)) } func opStringIntDictAsync(p1: StringIntDict?, - current: Current) -> Promise<(returnValue: StringIntDict?, p3: StringIntDict?)> { + current _: Current) -> Promise<(returnValue: StringIntDict?, p3: StringIntDict?)> { return Promise.value((p1, p1)) } func opIntOneOptionalDictAsync(p1: IntOneOptionalDict?, - current: Current) -> Promise<(returnValue: IntOneOptionalDict?, - p3: IntOneOptionalDict?)> { + current _: Current) -> Promise<(returnValue: IntOneOptionalDict?, + p3: IntOneOptionalDict?)> { return Promise.value((p1, p1)) } - func opClassAndUnknownOptionalAsync(p: A?, current: Current) -> Promise<Void> { + func opClassAndUnknownOptionalAsync(p _: A?, current _: Current) -> Promise<Void> { return Promise.value(()) } - func sendOptionalClassAsync(req: Bool, o: OneOptional?, current: Current) -> Promise<Void> { + func sendOptionalClassAsync(req _: Bool, o _: OneOptional?, current _: Current) -> Promise<Void> { return Promise.value(()) } - func returnOptionalClassAsync(req: Bool, current: Current) -> Promise<OneOptional?> { + func returnOptionalClassAsync(req _: Bool, current _: Current) -> Promise<OneOptional?> { return Promise.value(OneOptional()) } - func opGAsync(g: G?, current: Current) -> Promise<G?> { + func opGAsync(g: G?, current _: Current) -> Promise<G?> { return Promise.value(g) } - func opVoidAsync(current: Current) -> Promise<Void> { + func opVoidAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func opMStruct1Async(current: Current) -> Promise<SmallStruct?> { + func opMStruct1Async(current _: Current) -> Promise<SmallStruct?> { return Promise.value(SmallStruct()) } - func opMStruct2Async(p1: SmallStruct?, current: Current) -> Promise<(returnValue: SmallStruct?, p2: SmallStruct?)> { + func opMStruct2Async(p1: SmallStruct?, current _: Current) -> Promise<(returnValue: SmallStruct?, + p2: SmallStruct?)> { return Promise.value((p1, p1)) } - func opMSeq1Async(current: Current) -> Promise<StringSeq?> { + func opMSeq1Async(current _: Current) -> Promise<StringSeq?> { return Promise.value([]) } - func opMSeq2Async(p1: StringSeq?, current: Current) -> Promise<(returnValue: StringSeq?, p2: StringSeq?)> { + func opMSeq2Async(p1: StringSeq?, current _: Current) -> Promise<(returnValue: StringSeq?, p2: StringSeq?)> { return Promise.value((p1, p1)) } - func opMDict1Async(current: Current) -> Promise<StringIntDict?> { + func opMDict1Async(current _: Current) -> Promise<StringIntDict?> { return Promise.value([:]) } func opMDict2Async(p1: StringIntDict?, - current: Current) -> Promise<(returnValue: StringIntDict?, p2: StringIntDict?)> { + current _: Current) -> Promise<(returnValue: StringIntDict?, p2: StringIntDict?)> { return Promise.value((p1, p1)) } - func opMG1Async(current: Current) -> Promise<G?> { + func opMG1Async(current _: Current) -> Promise<G?> { return Promise.value(G()) } - func opMG2Async(p1: G?, current: Current) -> Promise<(returnValue: G?, p2: G?)> { + func opMG2Async(p1: G?, current _: Current) -> Promise<(returnValue: G?, p2: G?)> { return Promise.value((p1, p1)) } - func supportsRequiredParamsAsync(current: Current) -> Promise<Bool> { + func supportsRequiredParamsAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } - func supportsJavaSerializableAsync(current: Current) -> Promise<Bool> { + func supportsJavaSerializableAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } - func supportsCsharpSerializableAsync(current: Current) -> Promise<Bool> { + func supportsCsharpSerializableAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } - func supportsCppStringViewAsync(current: Current) -> Promise<Bool> { + func supportsCppStringViewAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } - func supportsNullOptionalAsync(current: Current) -> Promise<Bool> { + func supportsNullOptionalAsync(current _: Current) -> Promise<Bool> { return Promise.value(false) } } diff --git a/swift/test/Ice/optional/TestI.swift b/swift/test/Ice/optional/TestI.swift index 42ff2ff4849..c57d4ee0168 100644 --- a/swift/test/Ice/optional/TestI.swift +++ b/swift/test/Ice/optional/TestI.swift @@ -3,36 +3,36 @@ // import Foundation -import TestCommon import Ice +import TestCommon class InitialI: Initial { func shutdown(current: Ice.Current) throws { current.adapter!.getCommunicator().shutdown() } - func pingPong(o: Ice.Value?, current: Ice.Current) throws -> Ice.Value? { + func pingPong(o: Ice.Value?, current _: Ice.Current) throws -> Ice.Value? { return o } func opOptionalException(a: Int32?, b: String?, o: OneOptional?, - current: Ice.Current) throws { + current _: Ice.Current) throws { throw OptionalException(req: false, a: a, b: b, o: o) } func opDerivedException(a: Int32?, b: String?, o: OneOptional?, - current: Ice.Current) throws { + current _: Ice.Current) throws { throw DerivedException(req: false, a: a, b: b, o: o, ss: b, o2: o) } func opRequiredException(a: Int32?, b: String?, o: OneOptional?, - current: Ice.Current) throws { + current _: Ice.Current) throws { let e = RequiredException() e.a = a e.b = b @@ -45,213 +45,217 @@ class InitialI: Initial { } func opByte(p1: UInt8?, - current: Ice.Current) throws -> (returnValue: UInt8?, p3: UInt8?) { + current _: Ice.Current) throws -> (returnValue: UInt8?, p3: UInt8?) { return (p1, p1) } - func opBool(p1: Bool?, current: Ice.Current) throws -> (returnValue: Bool?, p3: Bool?) { + func opBool(p1: Bool?, current _: Ice.Current) throws -> (returnValue: Bool?, p3: Bool?) { return (p1, p1) } - func opShort(p1: Int16?, current: Ice.Current) throws -> (returnValue: Int16?, p3: Int16?) { + func opShort(p1: Int16?, current _: Ice.Current) throws -> (returnValue: Int16?, p3: Int16?) { return (p1, p1) } - func opInt(p1: Int32?, current: Ice.Current) throws -> (returnValue: Int32?, p3: Int32?) { + func opInt(p1: Int32?, current _: Ice.Current) throws -> (returnValue: Int32?, p3: Int32?) { return (p1, p1) } - func opLong(p1: Int64?, current: Ice.Current) throws -> (returnValue: Int64?, p3: Int64?) { + func opLong(p1: Int64?, current _: Ice.Current) throws -> (returnValue: Int64?, p3: Int64?) { return (p1, p1) } - func opFloat(p1: Float?, current: Ice.Current) throws -> (returnValue: Float?, p3: Float?) { + func opFloat(p1: Float?, current _: Ice.Current) throws -> (returnValue: Float?, p3: Float?) { return (p1, p1) } - func opDouble(p1: Double?, current: Ice.Current) throws -> (returnValue: Double?, p3: Double?) { + func opDouble(p1: Double?, current _: Ice.Current) throws -> (returnValue: Double?, p3: Double?) { return (p1, p1) } - func opString(p1: String?, current: Ice.Current) throws -> (returnValue: String?, p3: String?) { + func opString(p1: String?, current _: Ice.Current) throws -> (returnValue: String?, p3: String?) { return (p1, p1) } - func opCustomString(p1: String?, current: Current) throws -> (returnValue: String?, p3: String?) { + func opCustomString(p1: String?, current _: Current) throws -> (returnValue: String?, p3: String?) { return (p1, p1) } - func opMyEnum(p1: MyEnum?, current: Ice.Current) throws -> (returnValue: MyEnum?, p3: MyEnum?) { + func opMyEnum(p1: MyEnum?, current _: Ice.Current) throws -> (returnValue: MyEnum?, p3: MyEnum?) { return (p1, p1) } - func opSmallStruct(p1: SmallStruct?, current: Ice.Current) throws -> (returnValue: SmallStruct?, p3: SmallStruct?) { + func opSmallStruct(p1: SmallStruct?, current _: Ice.Current) throws -> (returnValue: SmallStruct?, + p3: SmallStruct?) { return (p1, p1) } - func opFixedStruct(p1: FixedStruct?, current: Ice.Current) throws -> (returnValue: FixedStruct?, p3: FixedStruct?) { + func opFixedStruct(p1: FixedStruct?, current _: Ice.Current) throws -> (returnValue: FixedStruct?, + p3: FixedStruct?) { return (p1, p1) } - func opVarStruct(p1: VarStruct?, current: Ice.Current) throws -> (returnValue: VarStruct?, p3: VarStruct?) { + func opVarStruct(p1: VarStruct?, current _: Ice.Current) throws -> (returnValue: VarStruct?, p3: VarStruct?) { return (p1, p1) } - func opOneOptional(p1: OneOptional?, current: Ice.Current) throws -> (returnValue: OneOptional?, p3: OneOptional?) { + func opOneOptional(p1: OneOptional?, current _: Ice.Current) throws -> (returnValue: OneOptional?, + p3: OneOptional?) { return (p1, p1) } - func opOneOptionalProxy(p1: Ice.ObjectPrx?, current: Ice.Current) throws -> (returnValue: Ice.ObjectPrx?, - p3: Ice.ObjectPrx?) { + func opOneOptionalProxy(p1: Ice.ObjectPrx?, current _: Ice.Current) throws -> (returnValue: Ice.ObjectPrx?, + p3: Ice.ObjectPrx?) { return (p1, p1) } - func opByteSeq(p1: ByteSeq?, current: Ice.Current) throws -> (returnValue: ByteSeq?, p3: ByteSeq?) { + func opByteSeq(p1: ByteSeq?, current _: Ice.Current) throws -> (returnValue: ByteSeq?, p3: ByteSeq?) { return (p1, p1) } - func opBoolSeq(p1: BoolSeq?, current: Ice.Current) throws -> (returnValue: BoolSeq?, p3: BoolSeq?) { + func opBoolSeq(p1: BoolSeq?, current _: Ice.Current) throws -> (returnValue: BoolSeq?, p3: BoolSeq?) { return (p1, p1) } - func opShortSeq(p1: ShortSeq?, current: Ice.Current) throws -> (returnValue: ShortSeq?, p3: ShortSeq?) { + func opShortSeq(p1: ShortSeq?, current _: Ice.Current) throws -> (returnValue: ShortSeq?, p3: ShortSeq?) { return (p1, p1) } - func opIntSeq(p1: IntSeq?, current: Ice.Current) throws -> (returnValue: IntSeq?, p3: IntSeq?) { + func opIntSeq(p1: IntSeq?, current _: Ice.Current) throws -> (returnValue: IntSeq?, p3: IntSeq?) { return (p1, p1) } - func opLongSeq(p1: LongSeq?, current: Ice.Current) throws -> (returnValue: LongSeq?, p3: LongSeq?) { + func opLongSeq(p1: LongSeq?, current _: Ice.Current) throws -> (returnValue: LongSeq?, p3: LongSeq?) { return (p1, p1) } - func opFloatSeq(p1: FloatSeq?, current: Ice.Current) throws -> (returnValue: FloatSeq?, p3: FloatSeq?) { + func opFloatSeq(p1: FloatSeq?, current _: Ice.Current) throws -> (returnValue: FloatSeq?, p3: FloatSeq?) { return (p1, p1) } - func opDoubleSeq(p1: DoubleSeq?, current: Ice.Current) throws -> (returnValue: DoubleSeq?, p3: DoubleSeq?) { + func opDoubleSeq(p1: DoubleSeq?, current _: Ice.Current) throws -> (returnValue: DoubleSeq?, p3: DoubleSeq?) { return (p1, p1) } - func opStringSeq(p1: StringSeq?, current: Ice.Current) throws -> (returnValue: StringSeq?, - p3: StringSeq?) { + func opStringSeq(p1: StringSeq?, current _: Ice.Current) throws -> (returnValue: StringSeq?, + p3: StringSeq?) { return (p1, p1) } - func opSmallStructSeq(p1: SmallStructSeq?, current: Ice.Current) throws -> (returnValue: SmallStructSeq?, - p3: SmallStructSeq?) { - return (p1, p1) + func opSmallStructSeq(p1: SmallStructSeq?, current _: Ice.Current) throws -> (returnValue: SmallStructSeq?, + p3: SmallStructSeq?) { + return (p1, p1) } - func opSmallStructList(p1: SmallStructList?, current: Ice.Current) throws -> (returnValue: SmallStructList?, - p3: SmallStructList?) { - return (p1, p1) + func opSmallStructList(p1: SmallStructList?, current _: Ice.Current) throws -> (returnValue: SmallStructList?, + p3: SmallStructList?) { + return (p1, p1) } - func opFixedStructSeq(p1: FixedStructSeq?, current: Ice.Current) throws -> (returnValue: FixedStructSeq?, - p3: FixedStructSeq?) { + func opFixedStructSeq(p1: FixedStructSeq?, current _: Ice.Current) throws -> (returnValue: FixedStructSeq?, + p3: FixedStructSeq?) { return (p1, p1) } - func opFixedStructList(p1: FixedStructList?, current: Ice.Current) throws -> (returnValue: FixedStructList?, - p3: FixedStructList?) { - return (p1, p1) + func opFixedStructList(p1: FixedStructList?, current _: Ice.Current) throws -> (returnValue: FixedStructList?, + p3: FixedStructList?) { + return (p1, p1) } - func opVarStructSeq(p1: VarStructSeq?, current: Ice.Current) throws -> (returnValue: VarStructSeq?, - p3: VarStructSeq?) { - return (p1, p1) + func opVarStructSeq(p1: VarStructSeq?, current _: Ice.Current) throws -> (returnValue: VarStructSeq?, + p3: VarStructSeq?) { + return (p1, p1) } - func opSerializable(p1: Serializable?, current: Current) throws -> (returnValue: Serializable?, p3: Serializable?) { + func opSerializable(p1: Serializable?, current _: Current) throws -> (returnValue: Serializable?, + p3: Serializable?) { return (p1, p1) } - func opIntIntDict(p1: [Int32: Int32]?, current: Ice.Current) throws -> (returnValue: [Int32: Int32]?, - p3: [Int32: Int32]?) { + func opIntIntDict(p1: [Int32: Int32]?, current _: Ice.Current) throws -> (returnValue: [Int32: Int32]?, + p3: [Int32: Int32]?) { return (p1, p1) } - func opStringIntDict(p1: [String: Int32]?, current: Ice.Current) throws -> (returnValue: [String: Int32]?, - p3: [String: Int32]?) { + func opStringIntDict(p1: [String: Int32]?, current _: Ice.Current) throws -> (returnValue: [String: Int32]?, + p3: [String: Int32]?) { return (p1, p1) } func opCustomIntStringDict(p1: IntStringDict?, - current: Current) throws -> (returnValue: IntStringDict?, p3: IntStringDict?) { + current _: Current) throws -> (returnValue: IntStringDict?, p3: IntStringDict?) { return (p1, p1) } func opIntOneOptionalDict(p1: [Int32: OneOptional?]?, - current: Ice.Current) throws -> (returnValue: [Int32: OneOptional?]?, - p3: [Int32: OneOptional?]?) { + current _: Ice.Current) throws -> (returnValue: [Int32: OneOptional?]?, + p3: [Int32: OneOptional?]?) { return (p1, p1) } - func opClassAndUnknownOptional(p: A?, current: Ice.Current) throws {} + func opClassAndUnknownOptional(p _: A?, current _: Ice.Current) throws {} - func sendOptionalClass(req: Bool, o: OneOptional?, current: Ice.Current) throws {} + func sendOptionalClass(req _: Bool, o _: OneOptional?, current _: Ice.Current) throws {} - func returnOptionalClass(req: Bool, current: Ice.Current) throws -> OneOptional? { + func returnOptionalClass(req _: Bool, current _: Ice.Current) throws -> OneOptional? { return OneOptional(a: 53) } - func opG(g: G?, current: Ice.Current) throws -> G? { + func opG(g: G?, current _: Ice.Current) throws -> G? { return g } - func opVoid(current: Ice.Current) throws {} + func opVoid(current _: Ice.Current) throws {} - func supportsRequiredParams(current: Ice.Current) throws -> Bool { + func supportsRequiredParams(current _: Ice.Current) throws -> Bool { return false } - func supportsJavaSerializable(current: Ice.Current) throws -> Bool { + func supportsJavaSerializable(current _: Ice.Current) throws -> Bool { return false } - func supportsCsharpSerializable(current: Ice.Current) throws -> Bool { + func supportsCsharpSerializable(current _: Ice.Current) throws -> Bool { return false } - func supportsCppStringView(current: Ice.Current) throws -> Bool { + func supportsCppStringView(current _: Ice.Current) throws -> Bool { return false } - func supportsNullOptional(current: Ice.Current) throws -> Bool { + func supportsNullOptional(current _: Ice.Current) throws -> Bool { return false } - func opMStruct1(current: Current) throws -> SmallStruct? { + func opMStruct1(current _: Current) throws -> SmallStruct? { return SmallStruct() } - func opMStruct2(p1: SmallStruct?, current: Current) throws -> (returnValue: SmallStruct?, p2: SmallStruct?) { + func opMStruct2(p1: SmallStruct?, current _: Current) throws -> (returnValue: SmallStruct?, p2: SmallStruct?) { return (p1, p1) } - func opMSeq1(current: Current) throws -> StringSeq? { + func opMSeq1(current _: Current) throws -> StringSeq? { return [] } - func opMSeq2(p1: StringSeq?, current: Current) throws -> (returnValue: StringSeq?, p2: StringSeq?) { + func opMSeq2(p1: StringSeq?, current _: Current) throws -> (returnValue: StringSeq?, p2: StringSeq?) { return (p1, p1) } - func opMDict1(current: Current) throws -> StringIntDict? { + func opMDict1(current _: Current) throws -> StringIntDict? { return [:] } - func opMDict2(p1: StringIntDict?, current: Current) throws -> (returnValue: StringIntDict?, p2: StringIntDict?) { + func opMDict2(p1: StringIntDict?, current _: Current) throws -> (returnValue: StringIntDict?, p2: StringIntDict?) { return (p1, p1) } - func opMG1(current: Current) throws -> G? { + func opMG1(current _: Current) throws -> G? { return G() } - func opMG2(p1: G?, current: Current) throws -> (returnValue: G?, p2: G?) { + func opMG2(p1: G?, current _: Current) throws -> (returnValue: G?, p2: G?) { return (p1, p1) } } diff --git a/swift/test/Ice/proxy/Client.swift b/swift/test/Ice/proxy/Client.swift index d42d0fb6ca2..c9c20481403 100644 --- a/swift/test/Ice/proxy/Client.swift +++ b/swift/test/Ice/proxy/Client.swift @@ -8,7 +8,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { do { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/proxy/Collocated.swift b/swift/test/Ice/proxy/Collocated.swift index 88f17e2d2f1..eedb2228048 100644 --- a/swift/test/Ice/proxy/Collocated.swift +++ b/swift/test/Ice/proxy/Collocated.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Collocated: TestHelperI { @@ -15,7 +15,7 @@ class Collocated: TestHelperI { properties.setProperty(key: "Ice.ThreadPool.Client.SizeWarn", value: "0") properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/proxy/Server.swift b/swift/test/Ice/proxy/Server.swift index 724dca6fece..bff8f84188b 100644 --- a/swift/test/Ice/proxy/Server.swift +++ b/swift/test/Ice/proxy/Server.swift @@ -16,7 +16,7 @@ class Server: TestHelperI { properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/proxy/ServerAMD.swift b/swift/test/Ice/proxy/ServerAMD.swift index 1b73068b0c4..94baebc10d9 100644 --- a/swift/test/Ice/proxy/ServerAMD.swift +++ b/swift/test/Ice/proxy/ServerAMD.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class ServerAMD: TestHelperI { @@ -17,7 +17,7 @@ class ServerAMD: TestHelperI { properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/retry/AllTests.swift b/swift/test/Ice/retry/AllTests.swift index 891d52a1d76..1b72f9b594c 100644 --- a/swift/test/Ice/retry/AllTests.swift +++ b/swift/test/Ice/retry/AllTests.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public func allTests(helper: TestHelper) throws -> RetryPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { @@ -64,8 +64,7 @@ public func allTests(helper: TestHelper) throws -> RetryPrx { output.write("calling AMI operation to kill connection with second proxy... ") do { try retry2.opAsync(true).wait() - } catch is Ice.ConnectionLostException { - } catch is Ice.UnknownLocalException {} + } catch is Ice.ConnectionLostException {} catch is Ice.UnknownLocalException {} output.writeLine("ok") output.write("calling regular AMI operation with first proxy again... ") @@ -112,7 +111,7 @@ public func allTests(helper: TestHelper) throws -> RetryPrx { _ = try retry2.ice_invocationTimeout(500).opIdempotent(4) try test(false) } catch is Ice.InvocationTimeoutException { - _ = try retry2.opIdempotent(-1);// Reset the counter + _ = try retry2.opIdempotent(-1) // Reset the counter } do { diff --git a/swift/test/Ice/retry/Client.swift b/swift/test/Ice/retry/Client.swift index 9c9a77199de..8394bce6a88 100644 --- a/swift/test/Ice/retry/Client.swift +++ b/swift/test/Ice/retry/Client.swift @@ -15,7 +15,7 @@ class Client: TestHelperI { // This test kills connections, so we don't want warnings. // properties.setProperty(key: "Ice.Warn.Connections", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/retry/Collocated.swift b/swift/test/Ice/retry/Collocated.swift index 7fa231ed6bc..c2d5fdb0031 100644 --- a/swift/test/Ice/retry/Collocated.swift +++ b/swift/test/Ice/retry/Collocated.swift @@ -2,8 +2,8 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import PromiseKit import Ice +import PromiseKit import TestCommon class Collocated: TestHelperI { @@ -13,7 +13,7 @@ class Collocated: TestHelperI { let properties = try Ice.createProperties(args) properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/retry/Server.swift b/swift/test/Ice/retry/Server.swift index 33482b0cb15..c4f898bf6b0 100644 --- a/swift/test/Ice/retry/Server.swift +++ b/swift/test/Ice/retry/Server.swift @@ -12,7 +12,7 @@ class Server: TestHelperI { let properties = try Ice.createProperties(args) properties.setProperty(key: "Ice.Warn.Dispatch", value: "0") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/retry/TestI.swift b/swift/test/Ice/retry/TestI.swift index 2d0638e3bc9..4623e85b244 100644 --- a/swift/test/Ice/retry/TestI.swift +++ b/swift/test/Ice/retry/TestI.swift @@ -21,7 +21,7 @@ class RetryI: Retry { } } - func opIdempotent(c: Int32, current: Ice.Current) throws -> Int32 { + func opIdempotent(c: Int32, current _: Ice.Current) throws -> Int32 { if c > _counter { _counter += 1 throw Ice.ConnectionLostException(error: 1) @@ -31,11 +31,11 @@ class RetryI: Retry { return counter } - func opNotIdempotent(current: Ice.Current) throws { + func opNotIdempotent(current _: Ice.Current) throws { throw Ice.ConnectionLostException(error: 1) } - func opSystemException(current: Ice.Current) throws { + func opSystemException(current _: Ice.Current) throws { throw Ice.RuntimeError("") } diff --git a/swift/test/Ice/scope/AllTests.swift b/swift/test/Ice/scope/AllTests.swift index 539cb47112d..ecd09756adf 100644 --- a/swift/test/Ice/scope/AllTests.swift +++ b/swift/test/Ice/scope/AllTests.swift @@ -295,7 +295,7 @@ func allTests(helper: TestHelper) throws { do { let obj = try communicator.stringToProxy("i1:\(helper.getTestEndpoint())")! - let i = try checkedCast(prx: obj, type: IPrx.self)! + let i = try checkedCast(prx: obj, type: IPrx.self)! try i.shutdown() } output.writeLine("ok") diff --git a/swift/test/Ice/scope/Client.swift b/swift/test/Ice/scope/Client.swift index b925be9b7d2..3e88b2c4cab 100644 --- a/swift/test/Ice/scope/Client.swift +++ b/swift/test/Ice/scope/Client.swift @@ -10,7 +10,7 @@ public class Client: TestHelperI { var initData = Ice.InitializationData() initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceScope"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/scope/Server.swift b/swift/test/Ice/scope/Server.swift index 8166e79a796..36f9b40eb04 100644 --- a/swift/test/Ice/scope/Server.swift +++ b/swift/test/Ice/scope/Server.swift @@ -7,7 +7,6 @@ import TestCommon class Server: TestHelperI { public override func run(args: [String]) throws { - var initData = Ice.InitializationData() initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceScope"] diff --git a/swift/test/Ice/scope/TestI.swift b/swift/test/Ice/scope/TestI.swift index 611e3a6038d..28024fd8943 100644 --- a/swift/test/Ice/scope/TestI.swift +++ b/swift/test/Ice/scope/TestI.swift @@ -2,32 +2,32 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class I1: I { - func opS(s1: S, current: Current) throws -> (returnValue: S, s2: S) { + func opS(s1: S, current _: Current) throws -> (returnValue: S, s2: S) { return (s1, s1) } - func opSSeq(s1: SSeq, current: Current) throws -> (returnValue: SSeq, s2: SSeq) { + func opSSeq(s1: SSeq, current _: Current) throws -> (returnValue: SSeq, s2: SSeq) { return (s1, s1) } - func opSMap(s1: SMap, current: Current) throws -> (returnValue: SMap, s2: SMap) { + func opSMap(s1: SMap, current _: Current) throws -> (returnValue: SMap, s2: SMap) { return (s1, s1) } - func opC(c1: C?, current: Current) throws -> (returnValue: C?, c2: C?) { + func opC(c1: C?, current _: Current) throws -> (returnValue: C?, c2: C?) { return (c1, c1) } - func opCSeq(s1: CSeq, current: Current) throws -> (returnValue: CSeq, s2: CSeq) { + func opCSeq(s1: CSeq, current _: Current) throws -> (returnValue: CSeq, s2: CSeq) { return (s1, s1) } - func opCMap(c1: CMap, current: Current) throws -> (returnValue: CMap, c2: CMap) { + func opCMap(c1: CMap, current _: Current) throws -> (returnValue: CMap, c2: CMap) { return (c1, c1) } @@ -37,27 +37,27 @@ class I1: I { } class I2: InnerI { - func opS(s1: InnerInner2S, current: Current) throws -> (returnValue: InnerInner2S, s2: InnerInner2S) { + func opS(s1: InnerInner2S, current _: Current) throws -> (returnValue: InnerInner2S, s2: InnerInner2S) { return (s1, s1) } - func opSSeq(s1: InnerInner2SSeq, current: Current) throws -> (returnValue: InnerInner2SSeq, s2: InnerInner2SSeq) { + func opSSeq(s1: InnerInner2SSeq, current _: Current) throws -> (returnValue: InnerInner2SSeq, s2: InnerInner2SSeq) { return (s1, s1) } - func opSMap(s1: InnerInner2SMap, current: Current) throws -> (returnValue: InnerInner2SMap, s2: InnerInner2SMap) { + func opSMap(s1: InnerInner2SMap, current _: Current) throws -> (returnValue: InnerInner2SMap, s2: InnerInner2SMap) { return (s1, s1) } - func opC(c1: InnerInner2C?, current: Current) throws -> (returnValue: InnerInner2C?, c2: InnerInner2C?) { + func opC(c1: InnerInner2C?, current _: Current) throws -> (returnValue: InnerInner2C?, c2: InnerInner2C?) { return (c1, c1) } - func opCSeq(c1: InnerInner2CSeq, current: Current) throws -> (returnValue: InnerInner2CSeq, c2: InnerInner2CSeq) { + func opCSeq(c1: InnerInner2CSeq, current _: Current) throws -> (returnValue: InnerInner2CSeq, c2: InnerInner2CSeq) { return (c1, c1) } - func opCMap(c1: InnerInner2CMap, current: Current) throws -> (returnValue: InnerInner2CMap, c2: InnerInner2CMap) { + func opCMap(c1: InnerInner2CMap, current _: Current) throws -> (returnValue: InnerInner2CMap, c2: InnerInner2CMap) { return (c1, c1) } @@ -67,27 +67,27 @@ class I2: InnerI { } class I3: InnerInner2I { - func opS(s1: InnerInner2S, current: Current) throws -> (returnValue: InnerInner2S, s2: InnerInner2S) { + func opS(s1: InnerInner2S, current _: Current) throws -> (returnValue: InnerInner2S, s2: InnerInner2S) { return (s1, s1) } - func opSSeq(s1: InnerInner2SSeq, current: Current) throws -> (returnValue: InnerInner2SSeq, s2: InnerInner2SSeq) { + func opSSeq(s1: InnerInner2SSeq, current _: Current) throws -> (returnValue: InnerInner2SSeq, s2: InnerInner2SSeq) { return (s1, s1) } - func opSMap(s1: InnerInner2SMap, current: Current) throws -> (returnValue: InnerInner2SMap, s2: InnerInner2SMap) { + func opSMap(s1: InnerInner2SMap, current _: Current) throws -> (returnValue: InnerInner2SMap, s2: InnerInner2SMap) { return (s1, s1) } - func opC(c1: InnerInner2C?, current: Current) throws -> (returnValue: InnerInner2C?, c2: InnerInner2C?) { + func opC(c1: InnerInner2C?, current _: Current) throws -> (returnValue: InnerInner2C?, c2: InnerInner2C?) { return (c1, c1) } - func opCSeq(c1: InnerInner2CSeq, current: Current) throws -> (returnValue: InnerInner2CSeq, c2: InnerInner2CSeq) { + func opCSeq(c1: InnerInner2CSeq, current _: Current) throws -> (returnValue: InnerInner2CSeq, c2: InnerInner2CSeq) { return (c1, c1) } - func opCMap(c1: InnerInner2CMap, current: Current) throws -> (returnValue: InnerInner2CMap, c2: InnerInner2CMap) { + func opCMap(c1: InnerInner2CMap, current _: Current) throws -> (returnValue: InnerInner2CMap, c2: InnerInner2CMap) { return (c1, c1) } @@ -97,27 +97,27 @@ class I3: InnerInner2I { } class I4: InnerTestInner2I { - func opS(s1: S, current: Current) throws -> (returnValue: S, s2: S) { + func opS(s1: S, current _: Current) throws -> (returnValue: S, s2: S) { return (s1, s1) } - func opSSeq(s1: SSeq, current: Current) throws -> (returnValue: SSeq, s2: SSeq) { + func opSSeq(s1: SSeq, current _: Current) throws -> (returnValue: SSeq, s2: SSeq) { return (s1, s1) } - func opSMap(s1: SMap, current: Current) throws -> (returnValue: SMap, s2: SMap) { + func opSMap(s1: SMap, current _: Current) throws -> (returnValue: SMap, s2: SMap) { return (s1, s1) } - func opC(c1: C?, current: Current) throws -> (returnValue: C?, c2: C?) { + func opC(c1: C?, current _: Current) throws -> (returnValue: C?, c2: C?) { return (c1, c1) } - func opCSeq(c1: CSeq, current: Current) throws -> (returnValue: CSeq, c2: CSeq) { + func opCSeq(c1: CSeq, current _: Current) throws -> (returnValue: CSeq, c2: CSeq) { return (c1, c1) } - func opCMap(c1: CMap, current: Current) throws -> (returnValue: CMap, c2: CMap) { + func opCMap(c1: CMap, current _: Current) throws -> (returnValue: CMap, c2: CMap) { return (c1, c1) } diff --git a/swift/test/Ice/servantLocator/Collocated.swift b/swift/test/Ice/servantLocator/Collocated.swift index 79833404042..97507da4bda 100644 --- a/swift/test/Ice/servantLocator/Collocated.swift +++ b/swift/test/Ice/servantLocator/Collocated.swift @@ -8,7 +8,7 @@ import TestCommon class Collocated: TestHelperI { public override func run(args: [String]) throws { var initData = Ice.InitializationData() - initData.properties = try createTestProperties(args) + initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceServantLocator"] let communicator = try initialize(initData) defer { @@ -25,6 +25,6 @@ class Collocated: TestHelperI { try adapter.add(servant: TestIntfDisp(TestI()), id: Ice.stringToIdentity("asm")) try adapter.add(servant: TestActivationDisp(TestActivationI(self)), id: Ice.stringToIdentity("test/activation")) try adapter.activate() - _ = try allTests(self) + _ = try allTests(self) } } diff --git a/swift/test/Ice/servantLocator/ServantLocatorI.swift b/swift/test/Ice/servantLocator/ServantLocatorI.swift index d7230b3ab46..60da3a4da18 100644 --- a/swift/test/Ice/servantLocator/ServantLocatorI.swift +++ b/swift/test/Ice/servantLocator/ServantLocatorI.swift @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class CookieI: Cookie { func message() -> String { @@ -58,7 +58,7 @@ class ServantLocatorI: Ice.ServantLocator { return (TestIntfDisp(TestI()), CookieI()) } - func finished(curr: Ice.Current, servant: Ice.Disp, cookie: AnyObject?) throws { + func finished(curr: Ice.Current, servant _: Ice.Disp, cookie: AnyObject?) throws { try withLock(&_lock) { try _helper.test(!_deactivated) } @@ -79,7 +79,7 @@ class ServantLocatorI: Ice.ServantLocator { try _helper.test((cookie as! Cookie).message() == "blahblah") } - func deactivate(_ category: String) { + func deactivate(_: String) { withLock(&_lock) { precondition(!_deactivated) self._deactivated = true diff --git a/swift/test/Ice/servantLocator/TestAMDI.swift b/swift/test/Ice/servantLocator/TestAMDI.swift index 6718718c2ca..1b4121f2d33 100644 --- a/swift/test/Ice/servantLocator/TestAMDI.swift +++ b/swift/test/Ice/servantLocator/TestAMDI.swift @@ -6,31 +6,31 @@ import PromiseKit import TestCommon class TestI: TestIntf { - func requestFailedExceptionAsync(current: Current) -> Promise<Void> { + func requestFailedExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func unknownUserExceptionAsync(current: Current) -> Promise<Void> { + func unknownUserExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func unknownLocalExceptionAsync(current: Current) -> Promise<Void> { + func unknownLocalExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func unknownExceptionAsync(current: Current) -> Promise<Void> { + func unknownExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func localExceptionAsync(current: Current) -> Promise<Void> { + func localExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func userExceptionAsync(current: Current) -> Promise<Void> { + func userExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func csExceptionAsync(current: Current) -> Promise<Void> { + func csExceptionAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } @@ -40,7 +40,7 @@ class TestI: TestIntf { } } - func impossibleExceptionAsync(throw t: Bool, current: Current) -> Promise<String> { + func impossibleExceptionAsync(throw t: Bool, current _: Current) -> Promise<String> { return Promise<String> { seal in if t { seal.reject(TestImpossibleException()) @@ -54,7 +54,7 @@ class TestI: TestIntf { } } - func intfUserExceptionAsync(throw t: Bool, current: Current) -> Promise<String> { + func intfUserExceptionAsync(throw t: Bool, current _: Current) -> Promise<String> { return Promise<String> { seal in if t { seal.reject(TestIntfUserException()) @@ -68,11 +68,11 @@ class TestI: TestIntf { } } - func asyncResponseAsync(current: Current) -> Promise<Void> { + func asyncResponseAsync(current _: Current) -> Promise<Void> { return Promise.value(()) } - func asyncExceptionAsync(current: Current) -> Promise<Void> { + func asyncExceptionAsync(current _: Current) -> Promise<Void> { return Promise<Void> { seal in seal.reject(TestIntfUserException()) } diff --git a/swift/test/Ice/servantLocator/TestI.swift b/swift/test/Ice/servantLocator/TestI.swift index 68f1bd5a644..efe0be34c45 100644 --- a/swift/test/Ice/servantLocator/TestI.swift +++ b/swift/test/Ice/servantLocator/TestI.swift @@ -2,26 +2,26 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class TestI: TestIntf { - func requestFailedException(current: Current) throws {} + func requestFailedException(current _: Current) throws {} - func unknownUserException(current: Current) throws {} + func unknownUserException(current _: Current) throws {} - func unknownLocalException(current: Current) throws {} + func unknownLocalException(current _: Current) throws {} - func unknownException(current: Current) throws {} + func unknownException(current _: Current) throws {} - func localException(current: Current) throws {} + func localException(current _: Current) throws {} - func userException(current: Current) throws {} + func userException(current _: Current) throws {} - func stdException(current: Current) throws {} + func stdException(current _: Current) throws {} - func cppException(current: Current) throws {} + func cppException(current _: Current) throws {} func unknownExceptionWithServantException(current: Current) throws { throw ObjectNotExistException(id: current.id, @@ -29,7 +29,7 @@ class TestI: TestIntf { operation: current.operation) } - func impossibleException(throw t: Bool, current: Current) throws -> String { + func impossibleException(throw t: Bool, current _: Current) throws -> String { if t { throw TestImpossibleException() } @@ -40,7 +40,7 @@ class TestI: TestIntf { return "Hello" } - func intfUserException(throw t: Bool, current: Current) throws -> String { + func intfUserException(throw t: Bool, current _: Current) throws -> String { if t { throw TestIntfUserException() } @@ -51,13 +51,13 @@ class TestI: TestIntf { return "Hello" } - func asyncResponse(current: Current) throws { + func asyncResponse(current _: Current) throws { // // Only relevant for AMD. // } - func asyncException(current: Current) throws { + func asyncException(current _: Current) throws { // // Only relevant for AMD. // @@ -66,11 +66,9 @@ class TestI: TestIntf { func shutdown(current: Current) throws { current.adapter!.deactivate() } - } class TestActivationI: TestActivation { - var _helper: TestHelper init(_ helper: TestHelper) { diff --git a/swift/test/Ice/slicing/exceptions/AllTests.swift b/swift/test/Ice/slicing/exceptions/AllTests.swift index b4bf991b378..c7496600de7 100644 --- a/swift/test/Ice/slicing/exceptions/AllTests.swift +++ b/swift/test/Ice/slicing/exceptions/AllTests.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { @@ -37,21 +37,21 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.baseAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let b = e as? Base { - try test(b.b == "Base.b") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let b = e as? Base { + try test(b.b == "Base.b") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of unknown derived... ") @@ -67,21 +67,21 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.unknownDerivedAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let b = e as? Base { - try test(b.b == "UnknownDerived.b") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let b = e as? Base { + try test(b.b == "UnknownDerived.b") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("non-slicing of known derived as base... ") @@ -98,22 +98,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownDerivedAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let k = e as? KnownDerived { - try test(k.b == "KnownDerived.b") - try test(k.kd == "KnownDerived.kd") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let k = e as? KnownDerived { + try test(k.b == "KnownDerived.b") + try test(k.kd == "KnownDerived.kd") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("non-slicing of known derived as derived... ") @@ -130,22 +130,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownDerivedAsKnownDerivedAsync() - }.done { - try test(false) - }.catch { e in - do { - if let k = e as? KnownDerived { - try test(k.b == "KnownDerived.b") - try test(k.kd == "KnownDerived.kd") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let k = e as? KnownDerived { + try test(k.b == "KnownDerived.b") + try test(k.kd == "KnownDerived.kd") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of unknown intermediate as base... ") @@ -161,21 +161,21 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.unknownIntermediateAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let b = e as? Base { - try test(b.b == "UnknownIntermediate.b") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let b = e as? Base { + try test(b.b == "UnknownIntermediate.b") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of known intermediate as base... ") @@ -192,22 +192,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownIntermediateAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let ki = e as? KnownIntermediate { - try test(ki.b == "KnownIntermediate.b") - try test(ki.ki == "KnownIntermediate.ki") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let ki = e as? KnownIntermediate { + try test(ki.b == "KnownIntermediate.b") + try test(ki.ki == "KnownIntermediate.ki") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of known most derived as base... ") @@ -225,23 +225,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownMostDerivedAsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let kmd = e as? KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let kmd = e as? KnownMostDerived { + try test(kmd.b == "KnownMostDerived.b") + try test(kmd.ki == "KnownMostDerived.ki") + try test(kmd.kmd == "KnownMostDerived.kmd") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("non-slicing of known intermediate as intermediate... ") @@ -258,22 +258,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownIntermediateAsKnownIntermediateAsync() - }.done { - try test(false) - }.catch { e in - do { - if let ki = e as? KnownIntermediate { - try test(ki.b == "KnownIntermediate.b") - try test(ki.ki == "KnownIntermediate.ki") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let ki = e as? KnownIntermediate { + try test(ki.b == "KnownIntermediate.b") + try test(ki.ki == "KnownIntermediate.ki") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("non-slicing of known most derived as intermediate... ") @@ -291,23 +291,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownMostDerivedAsKnownIntermediateAsync() - }.done { - try test(false) - }.catch { e in - do { - if let kmd = e as? KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let kmd = e as? KnownMostDerived { + try test(kmd.b == "KnownMostDerived.b") + try test(kmd.ki == "KnownMostDerived.ki") + try test(kmd.kmd == "KnownMostDerived.kmd") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("non-slicing of known most derived as most derived... ") @@ -325,23 +325,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.knownMostDerivedAsKnownMostDerivedAsync() - }.done { - try test(false) - }.catch { e in - do { - if let kmd = e as? KnownMostDerived { - try test(kmd.b == "KnownMostDerived.b") - try test(kmd.ki == "KnownMostDerived.ki") - try test(kmd.kmd == "KnownMostDerived.kmd") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let kmd = e as? KnownMostDerived { + try test(kmd.b == "KnownMostDerived.b") + try test(kmd.ki == "KnownMostDerived.ki") + try test(kmd.kmd == "KnownMostDerived.kmd") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of unknown most derived, known intermediate as base... ") @@ -358,22 +358,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.unknownMostDerived1AsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let ki = e as? KnownIntermediate { - try test(ki.b == "UnknownMostDerived1.b") - try test(ki.ki == "UnknownMostDerived1.ki") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let ki = e as? KnownIntermediate { + try test(ki.b == "UnknownMostDerived1.b") + try test(ki.ki == "UnknownMostDerived1.ki") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of unknown most derived, known intermediate as intermediate... ") @@ -390,22 +390,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.unknownMostDerived1AsKnownIntermediateAsync() - }.done { - try test(false) - }.catch { e in - do { - if let ki = e as? KnownIntermediate { - try test(ki.b == "UnknownMostDerived1.b") - try test(ki.ki == "UnknownMostDerived1.ki") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let ki = e as? KnownIntermediate { + try test(ki.b == "UnknownMostDerived1.b") + try test(ki.ki == "UnknownMostDerived1.ki") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("slicing of unknown most derived, unknown intermediate thrown as base... ") @@ -421,21 +421,21 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.unknownMostDerived2AsBaseAsync() - }.done { - try test(false) - }.catch { e in - do { - if let b = e as? Base { - try test(b.b == "UnknownMostDerived2.b") - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { e in + do { + if let b = e as? Base { + try test(b.b == "UnknownMostDerived2.b") + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("unknown most derived in compact format... ") @@ -453,8 +453,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // most-derived type is unknown and the exception cannot be sliced. // try test(testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0) - } catch is Ice.OperationNotExistException { - } + } catch is Ice.OperationNotExistException {} output.writeLine("ok") output.write("preserved exceptions... ") @@ -564,19 +563,19 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { } class RelayI: Relay { - func knownPreservedAsBase(current: Current) throws { + func knownPreservedAsBase(current _: Current) throws { throw KnownPreservedDerived(b: "base", kp: "preserved", kpd: "derived") } - func knownPreservedAsKnownPreserved(current: Current) throws { + func knownPreservedAsKnownPreserved(current _: Current) throws { throw KnownPreservedDerived(b: "base", kp: "preserved", kpd: "derived") } - func unknownPreservedAsBase(current: Current) throws { + func unknownPreservedAsBase(current _: Current) throws { let ex = Preserved2() ex.b = "base" ex.kp = "preserved" @@ -586,7 +585,7 @@ class RelayI: Relay { throw ex } - func unknownPreservedAsKnownPreserved(current: Current) throws { + func unknownPreservedAsKnownPreserved(current _: Current) throws { let ex = Preserved2() ex.b = "base" ex.kp = "preserved" diff --git a/swift/test/Ice/slicing/exceptions/Client.swift b/swift/test/Ice/slicing/exceptions/Client.swift index 99fb1d99c59..2c371b8bc10 100644 --- a/swift/test/Ice/slicing/exceptions/Client.swift +++ b/swift/test/Ice/slicing/exceptions/Client.swift @@ -3,15 +3,15 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon public class Client: TestHelperI { public override func run(args: [String]) throws { var initData = Ice.InitializationData() initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceSlicingExceptions", "IceSlicingExceptionsClient"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/exceptions/Server.swift b/swift/test/Ice/slicing/exceptions/Server.swift index ef5e7e12313..47682c37419 100644 --- a/swift/test/Ice/slicing/exceptions/Server.swift +++ b/swift/test/Ice/slicing/exceptions/Server.swift @@ -12,7 +12,7 @@ class Server: TestHelperI { var initData = InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceSlicingExceptions", "IceSlicingExceptionsServer"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/exceptions/ServerAMD.swift b/swift/test/Ice/slicing/exceptions/ServerAMD.swift index a61d252bebc..e8a946f1316 100644 --- a/swift/test/Ice/slicing/exceptions/ServerAMD.swift +++ b/swift/test/Ice/slicing/exceptions/ServerAMD.swift @@ -12,7 +12,7 @@ class ServerAMD: TestHelperI { var initData = InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceSlicingExceptionsAMD", "IceSlicingExceptionsServerAMD"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/exceptions/TestAMDI.swift b/swift/test/Ice/slicing/exceptions/TestAMDI.swift index fa24988e866..58c3465d056 100644 --- a/swift/test/Ice/slicing/exceptions/TestAMDI.swift +++ b/swift/test/Ice/slicing/exceptions/TestAMDI.swift @@ -3,8 +3,8 @@ // import Ice +import PromiseKit import TestCommon -import PromiseKit class TestI: TestIntf { var _helper: TestHelper @@ -13,61 +13,61 @@ class TestI: TestIntf { _helper = helper } - func baseAsBaseAsync(current: Current) -> Promise<Void> { + func baseAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw Base(b: "Base.b") } } - func unknownDerivedAsBaseAsync(current: Current) -> Promise<Void> { + func unknownDerivedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownDerived(b: "UnknownDerived.b", ud: "UnknownDerived.ud") } } - func knownDerivedAsBaseAsync(current: Current) -> Promise<Void> { + func knownDerivedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd") } } - func knownDerivedAsKnownDerivedAsync(current: Current) -> Promise<Void> { + func knownDerivedAsKnownDerivedAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd") } } - func unknownIntermediateAsBaseAsync(current: Current) -> Promise<Void> { + func unknownIntermediateAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownIntermediate(b: "UnknownIntermediate.b", ui: "UnknownIntermediate.ui") } } - func knownIntermediateAsBaseAsync(current: Current) -> Promise<Void> { + func knownIntermediateAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") } } - func knownMostDerivedAsBaseAsync(current: Current) -> Promise<Void> { + func knownMostDerivedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd") } } - func knownIntermediateAsKnownIntermediateAsync(current: Current) -> Promise<Void> { + func knownIntermediateAsKnownIntermediateAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in - throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") + throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") } } - func knownMostDerivedAsKnownIntermediateAsync(current: Current) -> Promise<Void> { + func knownMostDerivedAsKnownIntermediateAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd") } } - func knownMostDerivedAsKnownMostDerivedAsync(current: Current) -> Promise<Void> { + func knownMostDerivedAsKnownMostDerivedAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", @@ -75,7 +75,7 @@ class TestI: TestIntf { } } - func unknownMostDerived1AsBaseAsync(current: Current) -> Promise<Void> { + func unknownMostDerived1AsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownMostDerived1(b: "UnknownMostDerived1.b", ki: "UnknownMostDerived1.ki", @@ -83,7 +83,7 @@ class TestI: TestIntf { } } - func unknownMostDerived1AsKnownIntermediateAsync(current: Current) -> Promise<Void> { + func unknownMostDerived1AsKnownIntermediateAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownMostDerived1(b: "UnknownMostDerived1.b", ki: "UnknownMostDerived1.ki", @@ -91,7 +91,7 @@ class TestI: TestIntf { } } - func unknownMostDerived2AsBaseAsync(current: Current) -> Promise<Void> { + func unknownMostDerived2AsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownMostDerived2(b: "UnknownMostDerived2.b", ui: "UnknownMostDerived2.ui", @@ -99,7 +99,7 @@ class TestI: TestIntf { } } - func unknownMostDerived2AsBaseCompactAsync(current: Current) -> Promise<Void> { + func unknownMostDerived2AsBaseCompactAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw UnknownMostDerived2(b: "UnknownMostDerived2.b", ui: "UnknownMostDerived2.ui", @@ -107,7 +107,7 @@ class TestI: TestIntf { } } - func knownPreservedAsBaseAsync(current: Current) -> Promise<Void> { + func knownPreservedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownPreservedDerived(b: "base", kp: "preserved", @@ -115,7 +115,7 @@ class TestI: TestIntf { } } - func knownPreservedAsKnownPreservedAsync(current: Current) -> Promise<Void> { + func knownPreservedAsKnownPreservedAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in throw KnownPreservedDerived(b: "base", kp: "preserved", @@ -141,7 +141,7 @@ class TestI: TestIntf { } } - func unknownPreservedAsBaseAsync(current: Current) -> Promise<Void> { + func unknownPreservedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let ex = SPreserved2() ex.b = "base" @@ -153,7 +153,7 @@ class TestI: TestIntf { } } - func unknownPreservedAsKnownPreservedAsync(current: Current) -> Promise<Void> { + func unknownPreservedAsKnownPreservedAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let ex = SPreserved2() ex.b = "base" diff --git a/swift/test/Ice/slicing/exceptions/TestI.swift b/swift/test/Ice/slicing/exceptions/TestI.swift index b84d6d994cd..ac4bf2b25c7 100644 --- a/swift/test/Ice/slicing/exceptions/TestI.swift +++ b/swift/test/Ice/slicing/exceptions/TestI.swift @@ -6,86 +6,85 @@ import Ice import TestCommon class TestI: TestIntf { - var _helper: TestHelper init(_ helper: TestHelper) { _helper = helper } - func baseAsBase(current: Current) throws { + func baseAsBase(current _: Current) throws { throw Base(b: "Base.b") } - func unknownDerivedAsBase(current: Current) throws { + func unknownDerivedAsBase(current _: Current) throws { throw UnknownDerived(b: "UnknownDerived.b", ud: "UnknownDerived.ud") } - func knownDerivedAsBase(current: Current) throws { + func knownDerivedAsBase(current _: Current) throws { throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd") } - func knownDerivedAsKnownDerived(current: Current) throws { + func knownDerivedAsKnownDerived(current _: Current) throws { throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd") } - func unknownIntermediateAsBase(current: Current) throws { + func unknownIntermediateAsBase(current _: Current) throws { throw UnknownIntermediate(b: "UnknownIntermediate.b", ui: "UnknownIntermediate.ui") } - func knownIntermediateAsBase(current: Current) throws { + func knownIntermediateAsBase(current _: Current) throws { throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") } - func knownMostDerivedAsBase(current: Current) throws { + func knownMostDerivedAsBase(current _: Current) throws { throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd") } - func knownIntermediateAsKnownIntermediate(current: Current) throws { - throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") + func knownIntermediateAsKnownIntermediate(current _: Current) throws { + throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki") } - func knownMostDerivedAsKnownIntermediate(current: Current) throws { + func knownMostDerivedAsKnownIntermediate(current _: Current) throws { throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd") } - func knownMostDerivedAsKnownMostDerived(current: Current) throws { + func knownMostDerivedAsKnownMostDerived(current _: Current) throws { throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd") } - func unknownMostDerived1AsBase(current: Current) throws { + func unknownMostDerived1AsBase(current _: Current) throws { throw UnknownMostDerived1(b: "UnknownMostDerived1.b", ki: "UnknownMostDerived1.ki", umd1: "UnknownMostDerived1.umd1") } - func unknownMostDerived1AsKnownIntermediate(current: Current) throws { + func unknownMostDerived1AsKnownIntermediate(current _: Current) throws { throw UnknownMostDerived1(b: "UnknownMostDerived1.b", ki: "UnknownMostDerived1.ki", umd1: "UnknownMostDerived1.umd1") } - func unknownMostDerived2AsBase(current: Current) throws { + func unknownMostDerived2AsBase(current _: Current) throws { throw UnknownMostDerived2(b: "UnknownMostDerived2.b", ui: "UnknownMostDerived2.ui", umd2: "UnknownMostDerived2.umd2") } - func unknownMostDerived2AsBaseCompact(current: Current) throws { + func unknownMostDerived2AsBaseCompact(current _: Current) throws { throw UnknownMostDerived2(b: "UnknownMostDerived2.b", ui: "UnknownMostDerived2.ui", umd2: "UnknownMostDerived2.umd2") } - func knownPreservedAsBase(current: Current) throws { + func knownPreservedAsBase(current _: Current) throws { throw KnownPreservedDerived(b: "base", kp: "preserved", kpd: "derived") } - func knownPreservedAsKnownPreserved(current: Current) throws { + func knownPreservedAsKnownPreserved(current _: Current) throws { throw KnownPreservedDerived(b: "base", kp: "preserved", kpd: "derived") @@ -105,7 +104,7 @@ class TestI: TestIntf { try _helper.test(false) } - func unknownPreservedAsBase(current: Current) throws { + func unknownPreservedAsBase(current _: Current) throws { let ex = SPreserved2() ex.b = "base" ex.kp = "preserved" @@ -115,7 +114,7 @@ class TestI: TestIntf { throw ex } - func unknownPreservedAsKnownPreserved(current: Current) throws { + func unknownPreservedAsKnownPreserved(current _: Current) throws { let ex = SPreserved2() ex.b = "base" ex.kp = "preserved" diff --git a/swift/test/Ice/slicing/objects/AllTests.swift b/swift/test/Ice/slicing/objects/AllTests.swift index 418e6efa1db..2810ea46bd9 100644 --- a/swift/test/Ice/slicing/objects/AllTests.swift +++ b/swift/test/Ice/slicing/objects/AllTests.swift @@ -2,11 +2,11 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import Ice -import TestCommon -import Foundation import Dispatch +import Foundation +import Ice import PromiseKit +import TestCommon public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { @@ -38,15 +38,15 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBaseAsObjectAsync() - }.map { o in - let sb = o as! SBase - try test(sb.ice_id() == "::Test::SBase") - try test(sb.sb == "SBase.sb") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.map { o in + let sb = o as! SBase + try test(sb.ice_id() == "::Test::SBase") + try test(sb.sb == "SBase.sb") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("base as base... ") @@ -60,13 +60,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBaseAsSBaseAsync() - }.done { sb in - try test(sb!.sb == "SBase.sb") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { sb in + try test(sb!.sb == "SBase.sb") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("base with known derived as base... ") @@ -82,15 +82,15 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBSKnownDerivedAsSBaseAsync() - }.done { sb in - try test(sb!.sb == "SBSKnownDerived.sb") - let sbskd = sb as! SBSKnownDerived - try test(sbskd.sbskd == "SBSKnownDerived.sbskd") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { sb in + try test(sb!.sb == "SBSKnownDerived.sb") + let sbskd = sb as! SBSKnownDerived + try test(sbskd.sbskd == "SBSKnownDerived.sbskd") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("base with known derived as known derived... ") @@ -104,13 +104,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBSKnownDerivedAsSBSKnownDerivedAsync() - }.done { sbskd in - try test(sbskd!.sbskd == "SBSKnownDerived.sbskd") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { sbskd in + try test(sbskd!.sbskd == "SBSKnownDerived.sbskd") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("base with unknown derived as base... ") @@ -141,13 +141,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBSUnknownDerivedAsSBaseAsync() - }.done { sb in - try test(sb!.sb == "SBSUnknownDerived.sb") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { sb in + try test(sb!.sb == "SBSUnknownDerived.sb") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { // @@ -156,13 +156,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBSUnknownDerivedAsSBaseCompactAsync() - }.done { sb in - try test(sb!.sb == "SBSUnknownDerived.sb") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { sb in + try test(sb!.sb == "SBSUnknownDerived.sb") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() } else { // // This test fails when using the compact format because the instance cannot @@ -171,17 +171,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SBSUnknownDerivedAsSBaseCompactAsync() - }.done { _ in - try test(false) - }.catch { ex in - do { - try test(ex is Ice.NoValueFactoryException) - seal.fulfill(()) - } catch { - seal.reject(error) - } + }.done { _ in + try test(false) + }.catch { ex in + do { + try test(ex is Ice.NoValueFactoryException) + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() } output.writeLine("ok") @@ -203,32 +203,32 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.SUnknownAsObjectAsync() - }.done { _ in - try test(false) - }.catch { ex in - do { - try test(ex is Ice.NoValueFactoryException) - seal.fulfill(()) - } catch { - seal.reject(error) - } + }.done { _ in + try test(false) + }.catch { ex in + do { + try test(ex is Ice.NoValueFactoryException) + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() } else { try Promise<Void> { seal in firstly { testPrx.SUnknownAsObjectAsync() - }.done { o in - if let unknown = o as? Ice.UnknownSlicedValue { - try test(unknown.ice_id() == "::Test::SUnknown") - } else { - try test(false) - } - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { o in + if let unknown = o as? Ice.UnknownSlicedValue { + try test(unknown.ice_id() == "::Test::SUnknown") + } else { + try test(false) + } + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() } output.writeLine("ok") @@ -245,15 +245,15 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.oneElementCycleAsync() - }.done { b in - try test(b!.ice_id() == "::Test::B") - try test(b!.sb == "B1.sb") - try test(b!.pb === b) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { b in + try test(b!.ice_id() == "::Test::B") + try test(b!.sb == "B1.sb") + try test(b!.pb === b) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("two-element cycle... ") @@ -272,20 +272,20 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.twoElementCycleAsync() - }.done { o in - let b1 = o! - try test(b1.ice_id() == "::Test::B") - try test(b1.sb == "B1.sb") - - let b2 = b1.pb! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "B2.sb") - try test(b2.pb === b1) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { o in + let b1 = o! + try test(b1.ice_id() == "::Test::B") + try test(b1.sb == "B1.sb") + + let b2 = b1.pb! + try test(b2.ice_id() == "::Test::B") + try test(b2.sb == "B2.sb") + try test(b2.pb === b1) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("known derived pointer slicing as base... ") @@ -315,32 +315,32 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.D1AsBAsync() - }.done { o in - let b1 = o! + }.done { o in + let b1 = o! - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb !== nil) - try test(b1.pb !== b1) - - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 !== nil) - try test(d1.pd1 !== b1) - try test(b1.pb === d1.pd1) - } else { - try test(false) - } + try test(b1.ice_id() == "::Test::D1") + try test(b1.sb == "D1.sb") + try test(b1.pb !== nil) + try test(b1.pb !== b1) - let b2 = b1.pb! - try test(b2.pb === b1) - try test(b2.sb == "D2.sb") - try test(b2.ice_id() == "::Test::B") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + if let d1 = b1 as? D1 { + try test(d1.sd1 == "D1.sd1") + try test(d1.pd1 !== nil) + try test(d1.pd1 !== b1) + try test(b1.pb === d1.pd1) + } else { + try test(false) + } + + let b2 = b1.pb! + try test(b2.pb === b1) + try test(b2.sb == "D2.sb") + try test(b2.ice_id() == "::Test::B") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("known derived pointer slicing as derived... ") @@ -362,23 +362,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.D1AsD1Async() - }.done { o in - let d1 = o! - try test(d1.ice_id() == "::Test::D1") - try test(d1.sb == "D1.sb") - try test(d1.pb !== nil) - try test(d1.pb !== d1) - - let b2 = d1.pb! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb === d1) - - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { o in + let d1 = o! + try test(d1.ice_id() == "::Test::D1") + try test(d1.sb == "D1.sb") + try test(d1.pb !== nil) + try test(d1.pb !== d1) + + let b2 = d1.pb! + try test(b2.ice_id() == "::Test::B") + try test(b2.sb == "D2.sb") + try test(b2.pb === d1) + + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("unknown derived pointer slicing as base... ") @@ -406,31 +406,31 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.D2AsBAsync() - }.done { o in - let b2 = o! + }.done { o in + let b2 = o! - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb !== nil) - try test(b2.pb !== b2) + try test(b2.ice_id() == "::Test::B") + try test(b2.sb == "D2.sb") + try test(b2.pb !== nil) + try test(b2.pb !== b2) - let b1 = b2.pb! + let b1 = b2.pb! - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb === b2) + try test(b1.ice_id() == "::Test::D1") + try test(b1.sb == "D1.sb") + try test(b1.pb === b2) - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - } else { - try test(false) - } - seal.fulfill(()) - }.catch { e in - seal.reject(e) + if let d1 = b1 as? D1 { + try test(d1.sd1 == "D1.sd1") + try test(d1.pd1 === b2) + } else { + try test(false) + } + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("param ptr slicing with known first... ") @@ -456,25 +456,25 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.paramTest1Async() - }.done { o1, o2 in - try test(o1 != nil && o2 != nil) - let b1 = o1! - let b2 = o2! - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb === b2) - let d1 = b1 as! D1 - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - // No factory, must be sliced - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb === b1) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { o1, o2 in + try test(o1 != nil && o2 != nil) + let b1 = o1! + let b2 = o2! + try test(b1.ice_id() == "::Test::D1") + try test(b1.sb == "D1.sb") + try test(b1.pb === b2) + let d1 = b1 as! D1 + try test(d1.sd1 == "D1.sd1") + try test(d1.pd1 === b2) + // No factory, must be sliced + try test(b2.ice_id() == "::Test::B") + try test(b2.sb == "D2.sb") + try test(b2.pb === b1) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("param ptr slicing with unknown first... ") @@ -506,29 +506,29 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.paramTest2Async() - }.done { o2, o1 in - try test(o2 != nil && o1 != nil) - let b1 = o1! - let b2 = o2! - - try test(b1.ice_id() == "::Test::D1") - try test(b1.sb == "D1.sb") - try test(b1.pb === b2) - if let d1 = b1 as? D1 { - try test(d1.sd1 == "D1.sd1") - try test(d1.pd1 === b2) - } else { - try test(false) - } - // No factory, must be sliced - try test(b2.ice_id() == "::Test::B") - try test(b2.sb == "D2.sb") - try test(b2.pb === b1) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { o2, o1 in + try test(o2 != nil && o1 != nil) + let b1 = o1! + let b2 = o2! + + try test(b1.ice_id() == "::Test::D1") + try test(b1.sb == "D1.sb") + try test(b1.pb === b2) + if let d1 = b1 as? D1 { + try test(d1.sd1 == "D1.sd1") + try test(d1.pd1 === b2) + } else { + try test(false) + } + // No factory, must be sliced + try test(b2.ice_id() == "::Test::B") + try test(b2.sb == "D2.sb") + try test(b2.pb === b1) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("return value identity with known first... ") @@ -542,13 +542,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.returnTest1Async() - }.done { r, p1, _ in - try test(r === p1) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { r, p1, _ in + try test(r === p1) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("return value identity with unknown first... ") @@ -562,13 +562,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.returnTest2Async() - }.done { r, p1, _ in - try test(r === p1) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { r, p1, _ in + try test(r === p1) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("return value identity for input params known first... ") @@ -625,36 +625,36 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.returnTest3Async(p1: d1, p2: d3) - }.done { b in - try test(b != nil) - let b1 = b! + }.done { b in + try test(b != nil) + let b1 = b! - try test(b1.sb == "D1.sb") - try test(b1.ice_id() == "::Test::D1") + try test(b1.sb == "D1.sb") + try test(b1.ice_id() == "::Test::D1") - if let p1 = b1 as? D1 { - try test(p1.sd1 == "D1.sd1") - try test(p1.pd1 === b1.pb) - } else { - try test(false) - } + if let p1 = b1 as? D1 { + try test(p1.sd1 == "D1.sd1") + try test(p1.pd1 === b1.pb) + } else { + try test(false) + } - let b2 = b1.pb! - try test(b2.sb == "D3.sb") - // Sliced by server - try test(b2.ice_id() == "::Test::B") - try test(b2.pb === b1) - try test(!(b2 is D3)) - try test(b1 !== d1) - try test(b1 !== d3) - try test(b2 !== d1) - try test(b2 !== d3) + let b2 = b1.pb! + try test(b2.sb == "D3.sb") + // Sliced by server + try test(b2.ice_id() == "::Test::B") + try test(b2.pb === b1) + try test(!(b2 is D3)) + try test(b1 !== d1) + try test(b1 !== d3) + try test(b2 !== d1) + try test(b2 !== d3) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") } @@ -712,36 +712,36 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.returnTest3Async(p1: d3, p2: d1) - }.done { b in - try test(b != nil) + }.done { b in + try test(b != nil) - let b1 = b! + let b1 = b! - try test(b1.sb == "D3.sb") - try test(b1.ice_id() == "::Test::B") // Sliced by server + try test(b1.sb == "D3.sb") + try test(b1.ice_id() == "::Test::B") // Sliced by server - try test(!(b1 is D3)) + try test(!(b1 is D3)) - let b2 = b1.pb! - try test(b2.sb == "D1.sb") - try test(b2.ice_id() == "::Test::D1") - try test(b2.pb === b1) - if let p3 = b2 as? D1 { - try test(p3.sd1 == "D1.sd1") - try test(p3.pd1 === b1) - } else { - try test(false) - } + let b2 = b1.pb! + try test(b2.sb == "D1.sb") + try test(b2.ice_id() == "::Test::D1") + try test(b2.pb === b1) + if let p3 = b2 as? D1 { + try test(p3.sd1 == "D1.sd1") + try test(p3.pd1 === b1) + } else { + try test(false) + } - try test(b1 !== d1) - try test(b1 !== d3) - try test(b2 !== d1) - try test(b2 !== d3) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + try test(b1 !== d1) + try test(b1 !== d3) + try test(b2 !== d1) + try test(b2 !== d3) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("remainder unmarshaling (3 instances)... ") @@ -771,29 +771,29 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.paramTest3Async() - }.done { ret1, o1, o2 in - try test(o1 != nil) - let p1 = o1! - try test(p1.sb == "D2.sb (p1 1)") - try test(p1.pb == nil) - try test(p1.ice_id() == "::Test::B") - - try test(o2 != nil) - let p2 = o2! - try test(p2.sb == "D2.sb (p2 1)") - try test(p2.pb == nil) - try test(p2.ice_id() == "::Test::B") - - try test(ret1 != nil) - let ret = ret1! - try test(ret.sb == "D1.sb (p2 2)") - try test(ret.pb == nil) - try test(ret.ice_id() == "::Test::D1") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { ret1, o1, o2 in + try test(o1 != nil) + let p1 = o1! + try test(p1.sb == "D2.sb (p1 1)") + try test(p1.pb == nil) + try test(p1.ice_id() == "::Test::B") + + try test(o2 != nil) + let p2 = o2! + try test(p2.sb == "D2.sb (p2 1)") + try test(p2.pb == nil) + try test(p2.ice_id() == "::Test::B") + + try test(ret1 != nil) + let ret = ret1! + try test(ret.sb == "D1.sb (p2 2)") + try test(ret.pb == nil) + try test(ret.ice_id() == "::Test::D1") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("remainder unmarshaling (4 instances)... ") @@ -818,23 +818,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.paramTest4Async() - }.done {ret1, b1 in - try test(b1 != nil) - let b = b1! - try test(b.sb == "D4.sb (1)") - try test(b.pb == nil) - try test(b.ice_id() == "::Test::B") - - try test(ret1 != nil) - let ret = ret1! - try test(ret.sb == "B.sb (2)") - try test(ret.pb == nil) - try test(ret.ice_id() == "::Test::B") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { ret1, b1 in + try test(b1 != nil) + let b = b1! + try test(b.sb == "D4.sb (1)") + try test(b.pb == nil) + try test(b.ice_id() == "::Test::B") + + try test(ret1 != nil) + let ret = ret1! + try test(ret.sb == "B.sb (2)") + try test(ret.pb == nil) + try test(ret.ice_id() == "::Test::B") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("param ptr slicing, instance marshaled in unknown derived as base... ") @@ -879,17 +879,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.returnTest3Async(p1: d3, p2: b2) - }.done { r in - try test(r != nil) - let ret = r! - try test(ret.ice_id() == "::Test::B") - try test(ret.sb == "D3.sb") - try test(ret.pb === ret) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { r in + try test(r != nil) + let ret = r! + try test(ret.ice_id() == "::Test::B") + try test(ret.sb == "D3.sb") + try test(ret.pb === ret) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("param ptr slicing, instance marshaled in unknown derived as derived... ") @@ -939,17 +939,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.returnTest3Async(p1: d3, p2: d12) - }.done { r in - try test(r != nil) - let ret = r! - try test(ret.ice_id() == "::Test::B") - try test(ret.sb == "D3.sb") - try test(ret.pb === ret) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { r in + try test(r != nil) + let ret = r! + try test(ret.ice_id() == "::Test::B") + try test(ret.sb == "D3.sb") + try test(ret.pb === ret) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("sequence slicing... ") @@ -1069,45 +1069,45 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.sequenceTestAsync(p1: ss1, p2: ss2) - }.done { ss in - try test(ss.c1 != nil) - let ss1b2 = ss.c1!.s[0] - let ss1d2 = ss.c1!.s[1] - try test(ss.c2 != nil) - let ss1d4 = ss.c1!.s[2] - - try test(ss.c2 != nil) - let ss2b2 = ss.c2!.s[0] - let ss2d2 = ss.c2!.s[1] - let ss2d4 = ss.c2!.s[2] - - try test(ss1b2!.pb === ss1b2) - try test(ss1d2!.pb === ss1b2) - try test(ss1d4!.pb === ss1b2) - - try test(ss2b2!.pb === ss1b2) - try test(ss2d2!.pb === ss2b2) - try test(ss2d4!.pb === ss2b2) - - try test(ss1b2!.ice_id() == "::Test::B") - try test(ss1d2!.ice_id() == "::Test::D1") - try test(ss1d4!.ice_id() == "::Test::B") - - try test(ss2b2!.ice_id() == "::Test::B") - try test(ss2d2!.ice_id() == "::Test::D1") - try test(ss2d4!.ice_id() == "::Test::B") - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { ss in + try test(ss.c1 != nil) + let ss1b2 = ss.c1!.s[0] + let ss1d2 = ss.c1!.s[1] + try test(ss.c2 != nil) + let ss1d4 = ss.c1!.s[2] + + try test(ss.c2 != nil) + let ss2b2 = ss.c2!.s[0] + let ss2d2 = ss.c2!.s[1] + let ss2d4 = ss.c2!.s[2] + + try test(ss1b2!.pb === ss1b2) + try test(ss1d2!.pb === ss1b2) + try test(ss1d4!.pb === ss1b2) + + try test(ss2b2!.pb === ss1b2) + try test(ss2d2!.pb === ss2b2) + try test(ss2d4!.pb === ss2b2) + + try test(ss1b2!.ice_id() == "::Test::B") + try test(ss1d2!.ice_id() == "::Test::D1") + try test(ss1d4!.ice_id() == "::Test::B") + + try test(ss2b2!.ice_id() == "::Test::B") + try test(ss2d2!.ice_id() == "::Test::D1") + try test(ss2d4!.ice_id() == "::Test::B") + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("dictionary slicing... ") do { var bin = [Int32: B]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let s = "D1.\(i)" let d1 = D1() d1.sb = s @@ -1119,7 +1119,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { let (ret, bout) = try testPrx.dictionaryTest(bin) try test(bout.count == 10) - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let b = bout[i * 10]!! let s = "D1.\(i)" try test(b.sb == s) @@ -1130,7 +1130,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { } try test(ret.count == 10) - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let b = ret[i * 20]!! let s = "D1.\(i * 20)" try test(b.sb == s) @@ -1155,7 +1155,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in var bin = [Int32: B]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let s = "D1.\(i)" let d1 = D1() d1.sb = s @@ -1166,42 +1166,42 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.dictionaryTestAsync(bin) - }.done { ret, bout in - try test(bout.count == 10) - for i: Int32 in 0..<10 { - let b = bout[i * 10]!! - let s = "D1.\(i)" - try test(b.sb == s) - try test(b.pb !== nil) - try test(b.pb !== b) - try test(b.pb!.sb == s) - try test(b.pb!.pb === b.pb) - } + }.done { ret, bout in + try test(bout.count == 10) + for i: Int32 in 0 ..< 10 { + let b = bout[i * 10]!! + let s = "D1.\(i)" + try test(b.sb == s) + try test(b.pb !== nil) + try test(b.pb !== b) + try test(b.pb!.sb == s) + try test(b.pb!.pb === b.pb) + } - try test(ret.count == 10) - for i: Int32 in 0..<10 { - let b = ret[i * 20]!! - let s = "D1.\(i * 20)" - try test(b.sb == s) + try test(ret.count == 10) + for i: Int32 in 0 ..< 10 { + let b = ret[i * 20]!! + let s = "D1.\(i * 20)" + try test(b.sb == s) - if i == 0 { - try test(b.pb == nil) - } else { - try test(b.pb === ret[(i - 1) * 20]!) - } + if i == 0 { + try test(b.pb == nil) + } else { + try test(b.pb === ret[(i - 1) * 20]!) + } - if let d1 = b as? D1 { - try test(d1.sd1 == s) - try test(d1.pd1 === d1) - } else { - try test(false) - } + if let d1 = b as? D1 { + try test(d1.sd1 == s) + try test(d1.pd1 === d1) + } else { + try test(false) } - seal.fulfill(()) - }.catch { e in - seal.reject(e) + } + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("base exception thrown as base exception... ") @@ -1220,24 +1220,24 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.throwBaseAsBaseAsync() - }.done { - try test(false) - }.catch { ex in - do { - if let e = ex as? BaseException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb") - try test(e.pb!.pb === e.pb) - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { ex in + do { + if let e = ex as? BaseException { + try test(e.sbe == "sbe") + try test(e.pb != nil) + try test(e.pb!.sb == "sb") + try test(e.pb!.pb === e.pb) + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("derived exception thrown as base exception... ") @@ -1262,30 +1262,30 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.throwDerivedAsBaseAsync() - }.done { - try test(false) - }.catch { ex in - do { - if let e = ex as? DerivedException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb1") - try test(e.pb!.pb === e.pb) - try test(e.sde == "sde1") - try test(e.pd1 != nil) - try test(e.pd1!.sb == "sb2") - try test(e.pd1!.pb === e.pd1) - try test(e.pd1!.sd1 == "sd2") - try test(e.pd1!.pd1 === e.pd1) - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { ex in + do { + if let e = ex as? DerivedException { + try test(e.sbe == "sbe") + try test(e.pb != nil) + try test(e.pb!.sb == "sb1") + try test(e.pb!.pb === e.pb) + try test(e.sde == "sde1") + try test(e.pd1 != nil) + try test(e.pd1!.sb == "sb2") + try test(e.pd1!.pb === e.pd1) + try test(e.pd1!.sd1 == "sd2") + try test(e.pd1!.pd1 === e.pd1) + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("derived aexception thrown as derived exception... ") @@ -1310,30 +1310,30 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.throwDerivedAsDerivedAsync() - }.done { - try test(false) - }.catch { ex in - do { - if let e = ex as? DerivedException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb1") - try test(e.pb!.pb === e.pb) - try test(e.sde == "sde1") - try test(e.pd1 != nil) - try test(e.pd1!.sb == "sb2") - try test(e.pd1!.pb === e.pd1) - try test(e.pd1!.sd1 == "sd2") - try test(e.pd1!.pd1 === e.pd1) - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { ex in + do { + if let e = ex as? DerivedException { + try test(e.sbe == "sbe") + try test(e.pb != nil) + try test(e.pb!.sb == "sb1") + try test(e.pb!.pb === e.pb) + try test(e.sde == "sde1") + try test(e.pd1 != nil) + try test(e.pd1!.sb == "sb2") + try test(e.pd1!.pb === e.pd1) + try test(e.pd1!.sd1 == "sd2") + try test(e.pd1!.pd1 === e.pd1) + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("unknown derived exception thrown as base exception... ") @@ -1349,27 +1349,27 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.writeLine("ok") output.write("unknown derived exception thrown as base exception (AMI)... ") - try Promise <Void> { seal in + try Promise<Void> { seal in firstly { testPrx.throwUnknownDerivedAsBaseAsync() - }.done { - try test(false) - }.catch { ex in - do { - if let e = ex as? BaseException { - try test(e.sbe == "sbe") - try test(e.pb != nil) - try test(e.pb!.sb == "sb d2") - try test(e.pb!.pb === e.pb) - } else { - try test(false) - } - seal.fulfill(()) - } catch { - seal.reject(error) + }.done { + try test(false) + }.catch { ex in + do { + if let e = ex as? BaseException { + try test(e.sbe == "sbe") + try test(e.pb != nil) + try test(e.pb!.sb == "sb d2") + try test(e.pb!.pb === e.pb) + } else { + try test(false) } + seal.fulfill(()) + } catch { + seal.reject(error) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("forward-declared class... ") @@ -1383,13 +1383,13 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise<Void> { seal in firstly { testPrx.useForwardAsync() - }.done { f in - try test(f != nil) - seal.fulfill(()) - }.catch { e in - seal.reject(e) + }.done { f in + try test(f != nil) + seal.fulfill(()) + }.catch { e in + seal.reject(e) } - }.wait() + }.wait() output.writeLine("ok") output.write("preserved classes... ") @@ -1403,7 +1403,8 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // try communicator.getValueFactoryManager().add( factory: { id in Preserved.ice_staticId() == id ? PreservedI() : nil }, - id: Preserved.ice_staticId()) + id: Preserved.ice_staticId() + ) do { // // Server knows the most-derived class PDerived. @@ -1493,7 +1494,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // Sending more than 254 objects exercises the encoding for object ids. // pcd.pbs = [PBase]() - for i: Int32 in 0..<300 { + for i: Int32 in 0 ..< 300 { let p2 = PCDerived2() p2.pi = i p2.pbs = [nil] // Nil reference. This slice should not have an indirection table. @@ -1511,7 +1512,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { } else { if let p3 = r as? PCDerived3 { try test(p3.pi == 3) - for i in 0..<300 { + for i in 0 ..< 300 { if let p2 = p3.pbs[i] as? PCDerived2 { try test(p2.pi == i) try test(p2.pbs.count == 1) @@ -1567,23 +1568,23 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { pd.pb = pd firstly { testPrx.exchangePBaseAsync(pd) - }.done { r in - if let p2 = r as? PDerived { - try test(p2.pi == 3) - try test(p2.ps == "preserved") - try test(p2.pb === p2) - } else { - try test(false) - } + }.done { r in + if let p2 = r as? PDerived { + try test(p2.pi == 3) + try test(p2.ps == "preserved") + try test(p2.pb === p2) + } else { + try test(false) + } + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) - } else { - seal.reject(e) - } + } else { + seal.reject(e) + } } - }.wait() + }.wait() try Promise<Void> { seal in // @@ -1594,19 +1595,19 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { pu.pu = "preserved" firstly { testPrx.exchangePBaseAsync(pu) - }.done { ret in - let r = ret! - try test(!(r is PCUnknown)) - try test(r.pi == 3) + }.done { ret in + let r = ret! + try test(!(r is PCUnknown)) + try test(r.pi == 3) + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) - } else { - seal.reject(e) - } + } else { + seal.reject(e) + } } - }.wait() + }.wait() try Promise<Void> { seal in // @@ -1619,28 +1620,28 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.exchangePBaseAsync(pcd) - }.done { ret in - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is PCDerived)) - try test(r.pi == 3) + }.done { ret in + let r = ret! + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(r is PCDerived)) + try test(r.pi == 3) + } else { + if let p2 = r as? PCDerived { + try test(p2.pi == 3) + try test(p2.pbs[0] === p2) } else { - if let p2 = r as? PCDerived { - try test(p2.pi == 3) - try test(p2.pbs[0] === p2) - } else { - try test(false) - } + try test(false) } + } + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) - } else { - seal.reject(e) - } + } else { + seal.reject(e) + } } - }.wait() + }.wait() try Promise<Void> { seal in // @@ -1653,28 +1654,28 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.exchangePBaseAsync(pcd) - }.done { ret in - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is CompactPCDerived)) - try test(r.pi == 3) + }.done { ret in + let r = ret! + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(r is CompactPCDerived)) + try test(r.pi == 3) + } else { + if let p2 = r as? CompactPCDerived { + try test(p2.pi == 3) + try test(p2.pbs[0] === p2) } else { - if let p2 = r as? CompactPCDerived { - try test(p2.pi == 3) - try test(p2.pbs[0] === p2) - } else { - try test(false) - } + try test(false) } + } + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) - } else { - seal.reject(e) - } + } else { + seal.reject(e) + } } - }.wait() + }.wait() try Promise<Void> { seal in // @@ -1687,7 +1688,7 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // Sending more than 254 objects exercises the encoding for object ids. // pcd.pbs = [PBase]() - for i: Int32 in 0..<300 { + for i: Int32 in 0 ..< 300 { let p2 = PCDerived2() p2.pi = i p2.pbs = [nil] // Nil reference. This slice should not have an indirection table. @@ -1699,40 +1700,40 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { firstly { testPrx.exchangePBaseAsync(pcd) - }.done { ret in - let r = ret! - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(!(r is PCDerived3)) - try test(r is Preserved) - try test(r.pi == 3) - } else { - if let p3 = r as? PCDerived3 { - try test(p3.pi == 3) - for i in 0..<300 { - if let p2 = p3.pbs[i] as? PCDerived2 { - try test(p2.pi == i) - try test(p2.pbs.count == 1) - try test(p2.pbs[0] == nil) - try test(p2.pcd2 == i) - } else { - try test(false) - } + }.done { ret in + let r = ret! + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(r is PCDerived3)) + try test(r is Preserved) + try test(r.pi == 3) + } else { + if let p3 = r as? PCDerived3 { + try test(p3.pi == 3) + for i in 0 ..< 300 { + if let p2 = p3.pbs[i] as? PCDerived2 { + try test(p2.pi == i) + try test(p2.pbs.count == 1) + try test(p2.pbs[0] == nil) + try test(p2.pcd2 == i) + } else { + try test(false) } - try test(p3.pcd2 == p3.pi) - try test(p3.pcd3 === p3.pbs[10]) - } else { - try test(false) } - } - seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) + try test(p3.pcd2 == p3.pi) + try test(p3.pcd3 === p3.pbs[10]) } else { - seal.reject(e) + try test(false) } + } + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { + seal.fulfill(()) + } else { + seal.reject(e) + } } - }.wait() + }.wait() try Promise<Void> { seal in // @@ -1742,26 +1743,26 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // firstly { testPrx.PBSUnknownAsPreservedAsync() - }.done { p1 in - let p = p1! - try testPrx.checkPBSUnknown(p) - if testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0 { - let slicedData = p.ice_getSlicedData()! - try test(slicedData.slices.count == 1) - try test(slicedData.slices[0].typeId == "::Test::PSUnknown") - try testPrx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p) - } else { - try test(p.ice_getSlicedData() == nil) - } + }.done { p1 in + let p = p1! + try testPrx.checkPBSUnknown(p) + if testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0 { + let slicedData = p.ice_getSlicedData()! + try test(slicedData.slices.count == 1) + try test(slicedData.slices[0].typeId == "::Test::PSUnknown") + try testPrx.ice_encodingVersion(Ice.Encoding_1_0).checkPBSUnknown(p) + } else { + try test(p.ice_getSlicedData() == nil) + } + seal.fulfill(()) + }.catch { e in + if e is Ice.OperationNotExistException { seal.fulfill(()) - }.catch { e in - if e is Ice.OperationNotExistException { - seal.fulfill(()) - } else { - seal.reject(e) - } + } else { + seal.reject(e) + } } - }.wait() + }.wait() output.writeLine("ok") output.write("garbage collection for preserved classes... ") @@ -1772,7 +1773,8 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { // try communicator.getValueFactoryManager().add( factory: { id in id == PNode.ice_staticId() ? PNodeI() : nil }, - id: PNode.ice_staticId()) + id: PNode.ice_staticId() + ) // // Relay a graph through the server. diff --git a/swift/test/Ice/slicing/objects/Client.swift b/swift/test/Ice/slicing/objects/Client.swift index 4ca8ef8a30e..064ae04d975 100644 --- a/swift/test/Ice/slicing/objects/Client.swift +++ b/swift/test/Ice/slicing/objects/Client.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class PreservedI: Preserved { public required init() { @@ -29,7 +29,7 @@ public class Client: TestHelperI { var initData = InitializationData() initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceSlicingObjects", "IceSlicingObjectsClient"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/objects/Server.swift b/swift/test/Ice/slicing/objects/Server.swift index 256170c4df3..dcc929bcdb6 100644 --- a/swift/test/Ice/slicing/objects/Server.swift +++ b/swift/test/Ice/slicing/objects/Server.swift @@ -12,7 +12,7 @@ class Server: TestHelperI { var initData = InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceSlicingObjects", "IceSlicingObjectsServer"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/objects/ServerAMD.swift b/swift/test/Ice/slicing/objects/ServerAMD.swift index 18e972b6913..ae4a725871b 100644 --- a/swift/test/Ice/slicing/objects/ServerAMD.swift +++ b/swift/test/Ice/slicing/objects/ServerAMD.swift @@ -12,7 +12,7 @@ class ServerAMD: TestHelperI { var initData = InitializationData() initData.properties = properties initData.classResolverPrefix = ["IceSlicingObjectsAMD", "IceSlicingObjectsAMD"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/slicing/objects/TestAMDI.swift b/swift/test/Ice/slicing/objects/TestAMDI.swift index e1f0973acff..0d05c4df33d 100644 --- a/swift/test/Ice/slicing/objects/TestAMDI.swift +++ b/swift/test/Ice/slicing/objects/TestAMDI.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class TestI: TestIntf { var _helper: TestHelper @@ -13,43 +13,43 @@ class TestI: TestIntf { _helper = helper } - func SBaseAsObjectAsync(current: Current) -> Promise<Value?> { + func SBaseAsObjectAsync(current _: Current) -> Promise<Value?> { return Promise<Value?> { seal in seal.fulfill(SBase(sb: "SBase.sb")) } } - func SBaseAsSBaseAsync(current: Current) -> Promise<SBase?> { + func SBaseAsSBaseAsync(current _: Current) -> Promise<SBase?> { return Promise<SBase?> { seal in seal.fulfill(SBase(sb: "SBase.sb")) } } - func SBSKnownDerivedAsSBaseAsync(current: Current) -> Promise<SBase?> { + func SBSKnownDerivedAsSBaseAsync(current _: Current) -> Promise<SBase?> { return Promise<SBase?> { seal in seal.fulfill(SBSKnownDerived(sb: "SBSKnownDerived.sb", sbskd: "SBSKnownDerived.sbskd")) } } - func SBSKnownDerivedAsSBSKnownDerivedAsync(current: Current) -> Promise<SBSKnownDerived?> { + func SBSKnownDerivedAsSBSKnownDerivedAsync(current _: Current) -> Promise<SBSKnownDerived?> { return Promise<SBSKnownDerived?> { seal in seal.fulfill(SBSKnownDerived(sb: "SBSKnownDerived.sb", sbskd: "SBSKnownDerived.sbskd")) } } - func SBSUnknownDerivedAsSBaseAsync(current: Current) -> Promise<SBase?> { + func SBSUnknownDerivedAsSBaseAsync(current _: Current) -> Promise<SBase?> { return Promise<SBase?> { seal in seal.fulfill(SBSUnknownDerived(sb: "SBSUnknownDerived.sb", sbsud: "SBSUnknownDerived.sbsud")) } } - func SBSUnknownDerivedAsSBaseCompactAsync(current: Current) -> Promise<SBase?> { + func SBSUnknownDerivedAsSBaseCompactAsync(current _: Current) -> Promise<SBase?> { return Promise<SBase?> { seal in seal.fulfill(SBSUnknownDerived(sb: "SBSUnknownDerived.sb", sbsud: "SBSUnknownDerived.sbsud")) } } - func SUnknownAsObjectAsync(current: Current) -> Promise<Value?> { + func SUnknownAsObjectAsync(current _: Current) -> Promise<Value?> { return Promise<Value?> { seal in let su = SUnknown() su.su = "SUnknown.su" @@ -68,7 +68,7 @@ class TestI: TestIntf { } } - func oneElementCycleAsync(current: Current) -> Promise<B?> { + func oneElementCycleAsync(current _: Current) -> Promise<B?> { return Promise<B?> { seal in let b = B() b.sb = "B1.sb" @@ -77,7 +77,7 @@ class TestI: TestIntf { } } - func twoElementCycleAsync(current: Current) -> Promise<B?> { + func twoElementCycleAsync(current _: Current) -> Promise<B?> { return Promise<B?> { seal in let b1 = B() b1.sb = "B1.sb" @@ -89,7 +89,7 @@ class TestI: TestIntf { } } - func D1AsBAsync(current: Current) -> Promise<B?> { + func D1AsBAsync(current _: Current) -> Promise<B?> { return Promise<B?> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -105,7 +105,7 @@ class TestI: TestIntf { } } - func D1AsD1Async(current: Current) -> Promise<D1?> { + func D1AsD1Async(current _: Current) -> Promise<D1?> { return Promise<D1?> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -121,7 +121,7 @@ class TestI: TestIntf { } } - func D2AsBAsync(current: Current) -> Promise<B?> { + func D2AsBAsync(current _: Current) -> Promise<B?> { return Promise<B?> { seal in let d2 = D2() d2.sb = "D2.sb" @@ -137,7 +137,7 @@ class TestI: TestIntf { } } - func paramTest1Async(current: Current) -> Promise<(p1: B?, p2: B?)> { + func paramTest1Async(current _: Current) -> Promise<(p1: B?, p2: B?)> { return Promise<(p1: B?, p2: B?)> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -153,7 +153,7 @@ class TestI: TestIntf { } } - func paramTest2Async(current: Current) -> Promise<(p2: B?, p1: B?)> { + func paramTest2Async(current _: Current) -> Promise<(p2: B?, p1: B?)> { return Promise<(p2: B?, p1: B?)> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -169,7 +169,7 @@ class TestI: TestIntf { } } - func paramTest3Async(current: Current) -> Promise<(returnValue: B?, p1: B?, p2: B?)> { + func paramTest3Async(current _: Current) -> Promise<(returnValue: B?, p1: B?, p2: B?)> { return Promise<(returnValue: B?, p1: B?, p2: B?)> { seal in let d2 = D2() d2.sb = "D2.sb (p1 1)" @@ -199,7 +199,7 @@ class TestI: TestIntf { } } - func paramTest4Async(current: Current) -> Promise<(returnValue: B?, p: B?)> { + func paramTest4Async(current _: Current) -> Promise<(returnValue: B?, p: B?)> { return Promise<(returnValue: B?, p: B?)> { seal in let d4 = D4() d4.sb = "D4.sb (1)" @@ -213,7 +213,7 @@ class TestI: TestIntf { } } - func returnTest1Async(current: Current) -> Promise<(returnValue: B?, p1: B?, p2: B?)> { + func returnTest1Async(current _: Current) -> Promise<(returnValue: B?, p1: B?, p2: B?)> { return Promise<(returnValue: B?, p1: B?, p2: B?)> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -230,7 +230,7 @@ class TestI: TestIntf { } } - func returnTest2Async(current: Current) -> Promise<(returnValue: B?, p2: B?, p1: B?)> { + func returnTest2Async(current _: Current) -> Promise<(returnValue: B?, p2: B?, p1: B?)> { return Promise<(returnValue: B?, p2: B?, p1: B?)> { seal in let d1 = D1() d1.sb = "D1.sb" @@ -247,22 +247,22 @@ class TestI: TestIntf { } } - func returnTest3Async(p1: B?, p2: B?, current: Current) -> Promise<B?> { + func returnTest3Async(p1: B?, p2 _: B?, current _: Current) -> Promise<B?> { return Promise<B?> { seal in seal.fulfill(p1) } } - func sequenceTestAsync(p1: SS1?, p2: SS2?, current: Current) -> Promise<SS3> { + func sequenceTestAsync(p1: SS1?, p2: SS2?, current _: Current) -> Promise<SS3> { return Promise<SS3> { seal in seal.fulfill(SS3(c1: p1, c2: p2)) } } - func dictionaryTestAsync(bin: BDict, current: Current) -> Promise<(returnValue: BDict, bout: BDict)> { + func dictionaryTestAsync(bin: BDict, current _: Current) -> Promise<(returnValue: BDict, bout: BDict)> { return Promise<(returnValue: BDict, bout: BDict)> { seal in var bout = [Int32: B?]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let b = bin[i]!! let d2 = D2() d2.sb = b.sb @@ -273,7 +273,7 @@ class TestI: TestIntf { } var r = [Int32: B]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let s = "D1.\(i * 20)" let d1 = D1() d1.sb = s @@ -286,7 +286,7 @@ class TestI: TestIntf { } } - func exchangePBaseAsync(pb: PBase?, current: Current) -> Promise<PBase?> { + func exchangePBaseAsync(pb: PBase?, current _: Current) -> Promise<PBase?> { return Promise<PBase?> { seal in seal.fulfill(pb) } @@ -327,7 +327,7 @@ class TestI: TestIntf { } } - func PBSUnknownAsPreservedWithGraphAsync(current: Current) -> Promise<Preserved?> { + func PBSUnknownAsPreservedWithGraphAsync(current _: Current) -> Promise<Preserved?> { return Promise<Preserved?> { seal in let r = PSUnknown() r.pi = 5 @@ -359,7 +359,7 @@ class TestI: TestIntf { } } - func PBSUnknown2AsPreservedWithGraphAsync(current: Current) -> Promise<Preserved?> { + func PBSUnknown2AsPreservedWithGraphAsync(current _: Current) -> Promise<Preserved?> { return Promise<Preserved?> { seal in let r = PSUnknown2() r.pi = 5 @@ -384,13 +384,13 @@ class TestI: TestIntf { } } - func exchangePNodeAsync(pn: PNode?, current: Current) -> Promise<PNode?> { + func exchangePNodeAsync(pn: PNode?, current _: Current) -> Promise<PNode?> { return Promise<PNode?> { seal in seal.fulfill(pn) } } - func throwBaseAsBaseAsync(current: Current) -> Promise<Void> { + func throwBaseAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let be = BaseException() be.sbe = "sbe" @@ -401,7 +401,7 @@ class TestI: TestIntf { } } - func throwDerivedAsBaseAsync(current: Current) -> Promise<Void> { + func throwDerivedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let de = DerivedException() de.sbe = "sbe" @@ -418,7 +418,7 @@ class TestI: TestIntf { } } - func throwDerivedAsDerivedAsync(current: Current) -> Promise<Void> { + func throwDerivedAsDerivedAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let de = DerivedException() de.sbe = "sbe" @@ -435,7 +435,7 @@ class TestI: TestIntf { } } - func throwUnknownDerivedAsBaseAsync(current: Current) -> Promise<Void> { + func throwUnknownDerivedAsBaseAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let d2 = D2() d2.sb = "sb d2" @@ -452,7 +452,7 @@ class TestI: TestIntf { } } - func throwPreservedExceptionAsync(current: Current) -> Promise<Void> { + func throwPreservedExceptionAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let ue = PSUnknownException() ue.p = PSUnknown2() @@ -463,7 +463,7 @@ class TestI: TestIntf { } } - func useForwardAsync(current: Current) -> Promise<Forward?> { + func useForwardAsync(current _: Current) -> Promise<Forward?> { return Promise<Forward?> { seal in let f = Forward() f.h = Hidden() diff --git a/swift/test/Ice/slicing/objects/TestI.swift b/swift/test/Ice/slicing/objects/TestI.swift index 13f0eb42358..da69ad32e5e 100644 --- a/swift/test/Ice/slicing/objects/TestI.swift +++ b/swift/test/Ice/slicing/objects/TestI.swift @@ -3,8 +3,8 @@ // import Ice -import TestCommon import PromiseKit +import TestCommon class TestI: TestIntf { var _helper: TestHelper @@ -13,31 +13,31 @@ class TestI: TestIntf { _helper = helper } - func SBaseAsObject(current: Current) throws -> Value? { + func SBaseAsObject(current _: Current) throws -> Value? { return SBase(sb: "SBase.sb") } - func SBaseAsSBase(current: Current) throws -> SBase? { + func SBaseAsSBase(current _: Current) throws -> SBase? { return SBase(sb: "SBase.sb") } - func SBSKnownDerivedAsSBase(current: Current) throws -> SBase? { + func SBSKnownDerivedAsSBase(current _: Current) throws -> SBase? { return SBSKnownDerived(sb: "SBSKnownDerived.sb", sbskd: "SBSKnownDerived.sbskd") } - func SBSKnownDerivedAsSBSKnownDerived(current: Current) throws -> SBSKnownDerived? { + func SBSKnownDerivedAsSBSKnownDerived(current _: Current) throws -> SBSKnownDerived? { return SBSKnownDerived(sb: "SBSKnownDerived.sb", sbskd: "SBSKnownDerived.sbskd") } - func SBSUnknownDerivedAsSBase(current: Current) throws -> SBase? { + func SBSUnknownDerivedAsSBase(current _: Current) throws -> SBase? { return SBSUnknownDerived(sb: "SBSUnknownDerived.sb", sbsud: "SBSUnknownDerived.sbsud") } - func SBSUnknownDerivedAsSBaseCompact(current: Current) throws -> SBase? { + func SBSUnknownDerivedAsSBaseCompact(current _: Current) throws -> SBase? { return SBSUnknownDerived(sb: "SBSUnknownDerived.sb", sbsud: "SBSUnknownDerived.sbsud") } - func SUnknownAsObject(current: Current) throws -> Value? { + func SUnknownAsObject(current _: Current) throws -> Value? { let su = SUnknown() su.su = "SUnknown.su" su.cycle = su @@ -52,14 +52,14 @@ class TestI: TestIntf { } } - func oneElementCycle(current: Current) throws -> B? { + func oneElementCycle(current _: Current) throws -> B? { let b = B() b.sb = "B1.sb" b.pb = b return b } - func twoElementCycle(current: Current) throws -> B? { + func twoElementCycle(current _: Current) throws -> B? { let b1 = B() b1.sb = "B1.sb" let b2 = B() @@ -69,7 +69,7 @@ class TestI: TestIntf { return b1 } - func D1AsB(current: Current) throws -> B? { + func D1AsB(current _: Current) throws -> B? { let d1 = D1() d1.sb = "D1.sb" d1.sd1 = "D1.sd1" @@ -83,7 +83,7 @@ class TestI: TestIntf { return d1 } - func D1AsD1(current: Current) throws -> D1? { + func D1AsD1(current _: Current) throws -> D1? { let d1 = D1() d1.sb = "D1.sb" d1.sd1 = "D1.sd1" @@ -97,7 +97,7 @@ class TestI: TestIntf { return d1 } - func D2AsB(current: Current) throws -> B? { + func D2AsB(current _: Current) throws -> B? { let d2 = D2() d2.sb = "D2.sb" d2.sd2 = "D2.sd2" @@ -111,7 +111,7 @@ class TestI: TestIntf { return d2 } - func paramTest1(current: Current) throws -> (p1: B?, p2: B?) { + func paramTest1(current _: Current) throws -> (p1: B?, p2: B?) { let d1 = D1() d1.sb = "D1.sb" d1.sd1 = "D1.sd1" @@ -130,7 +130,7 @@ class TestI: TestIntf { return (ret.p2, ret.p1) } - func paramTest3(current: Current) throws -> (returnValue: B?, p1: B?, p2: B?) { + func paramTest3(current _: Current) throws -> (returnValue: B?, p1: B?, p2: B?) { let d2 = D2() d2.sb = "D2.sb (p1 1)" d2.pb = nil @@ -158,7 +158,7 @@ class TestI: TestIntf { return (d3, d2, d4) } - func paramTest4(current: Current) throws -> (returnValue: B?, p: B?) { + func paramTest4(current _: Current) throws -> (returnValue: B?, p: B?) { let d4 = D4() d4.sb = "D4.sb (1)" d4.pb = nil @@ -179,20 +179,20 @@ class TestI: TestIntf { return (ret.p1, ret.p1, ret.p2) } - func returnTest3(p1: B?, p2: B?, current: Current) throws -> B? { + func returnTest3(p1: B?, p2 _: B?, current _: Current) throws -> B? { return p1 } - func sequenceTest(p1: SS1?, p2: SS2?, current: Current) throws -> SS3 { + func sequenceTest(p1: SS1?, p2: SS2?, current _: Current) throws -> SS3 { let ss = SS3() ss.c1 = p1 ss.c2 = p2 return ss } - func dictionaryTest(bin: BDict, current: Current) throws -> (returnValue: BDict, bout: BDict) { + func dictionaryTest(bin: BDict, current _: Current) throws -> (returnValue: BDict, bout: BDict) { var bout = [Int32: B?]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let b = bin[i]!! let d2 = D2() d2.sb = b.sb @@ -203,7 +203,7 @@ class TestI: TestIntf { } var r = [Int32: B]() - for i: Int32 in 0..<10 { + for i: Int32 in 0 ..< 10 { let s = "D1.\(i * 20)" let d1 = D1() d1.sb = s @@ -215,7 +215,7 @@ class TestI: TestIntf { return (r, bout) } - func exchangePBase(pb: PBase?, current: Current) throws -> PBase? { + func exchangePBase(pb: PBase?, current _: Current) throws -> PBase? { return pb } @@ -250,7 +250,7 @@ class TestI: TestIntf { } } - func PBSUnknownAsPreservedWithGraphAsync(current: Current) -> Promise<Preserved?> { + func PBSUnknownAsPreservedWithGraphAsync(current _: Current) -> Promise<Preserved?> { return Promise<Preserved?> { seal in let r = PSUnknown() r.pi = 5 @@ -280,7 +280,7 @@ class TestI: TestIntf { } } - func PBSUnknown2AsPreservedWithGraphAsync(current: Current) -> Promise<Preserved?> { + func PBSUnknown2AsPreservedWithGraphAsync(current _: Current) -> Promise<Preserved?> { return Promise<Preserved?> { seal in let r = PSUnknown2() r.pi = 5 @@ -303,11 +303,11 @@ class TestI: TestIntf { } } - func exchangePNode(pn: PNode?, current: Current) throws -> PNode? { + func exchangePNode(pn: PNode?, current _: Current) throws -> PNode? { return pn } - func throwBaseAsBase(current: Current) throws { + func throwBaseAsBase(current _: Current) throws { let be = BaseException() be.sbe = "sbe" be.pb = B() @@ -316,7 +316,7 @@ class TestI: TestIntf { throw be } - func throwDerivedAsBase(current: Current) throws { + func throwDerivedAsBase(current _: Current) throws { let de = DerivedException() de.sbe = "sbe" de.pb = B() @@ -331,7 +331,7 @@ class TestI: TestIntf { throw de } - func throwDerivedAsDerived(current: Current) throws { + func throwDerivedAsDerived(current _: Current) throws { let de = DerivedException() de.sbe = "sbe" de.pb = B() @@ -346,7 +346,7 @@ class TestI: TestIntf { throw de } - func throwUnknownDerivedAsBase(current: Current) throws { + func throwUnknownDerivedAsBase(current _: Current) throws { let d2 = D2() d2.sb = "sb d2" d2.pb = d2 @@ -361,7 +361,7 @@ class TestI: TestIntf { throw ude } - func throwPreservedExceptionAsync(current: Current) -> Promise<Void> { + func throwPreservedExceptionAsync(current _: Current) -> Promise<Void> { return Promise<Void> { _ in let ue = PSUnknownException() ue.p = PSUnknown2() @@ -372,7 +372,7 @@ class TestI: TestIntf { } } - func useForward(current: Current) throws -> Forward? { + func useForward(current _: Current) throws -> Forward? { let f = Forward() f.h = Hidden() f.h!.f = f diff --git a/swift/test/Ice/stream/Client.swift b/swift/test/Ice/stream/Client.swift index 93e3c94627e..66b1ca21a3d 100644 --- a/swift/test/Ice/stream/Client.swift +++ b/swift/test/Ice/stream/Client.swift @@ -14,7 +14,7 @@ public class Client: TestHelperI { var initData = Ice.InitializationData() initData.properties = try createTestProperties(args) initData.classResolverPrefix = ["IceStrem"] - let communicator = try self.initialize(initData) + let communicator = try initialize(initData) defer { communicator.destroy() } diff --git a/swift/test/Ice/timeout/AllTests.swift b/swift/test/Ice/timeout/AllTests.swift index ae2687c4b61..6087c84a4e2 100644 --- a/swift/test/Ice/timeout/AllTests.swift +++ b/swift/test/Ice/timeout/AllTests.swift @@ -2,12 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation func connect(_ prx: Ice.ObjectPrx) throws -> Ice.Connection { - for _ in 0..<10 { + for _ in 0 ..< 10 { do { _ = try prx.ice_getConnection() break @@ -47,25 +47,25 @@ public func allTests(helper: TestHelper) throws { // Expected. } try controller.resumeAdapter() - try timeout.op(); // Ensure adapter is active. + try timeout.op() // Ensure adapter is active. } do { - // - // Expect success. - // - let to = timeout.ice_timeout(-1) - try controller.holdAdapter(100) - do { - try to.op() - } catch is Ice.ConnectTimeoutException { - try test(false) - } + // + // Expect success. + // + let to = timeout.ice_timeout(-1) + try controller.holdAdapter(100) + do { + try to.op() + } catch is Ice.ConnectTimeoutException { + try test(false) + } } output.writeLine("ok") // The sequence needs to be large enough to fill the write/recv buffers - let seq = ByteSeq(repeating: 0, count: 2000000) + let seq = ByteSeq(repeating: 0, count: 2_000_000) output.write("testing connection timeout... ") do { @@ -86,16 +86,16 @@ public func allTests(helper: TestHelper) throws { } do { - // - // Expect success. - // - let to = timeout.ice_timeout(2000) - try controller.holdAdapter(100) - do { - try to.sendData(ByteSeq(repeating: 0, count: 1000000)) - } catch is Ice.TimeoutException { - try test(false) - } + // + // Expect success. + // + let to = timeout.ice_timeout(2000) + try controller.holdAdapter(100) + do { + try to.sendData(ByteSeq(repeating: 0, count: 1_000_000)) + } catch is Ice.TimeoutException { + try test(false) + } } output.writeLine("ok") @@ -357,7 +357,7 @@ public func allTests(helper: TestHelper) throws { try batchTimeout.ice_ping() try batchTimeout.ice_ping() - _ = proxy.ice_invocationTimeout(-1).sleepAsync(300); // Keep the server thread pool busy. + _ = proxy.ice_invocationTimeout(-1).sleepAsync(300) // Keep the server thread pool busy. do { try batchTimeout.ice_flushBatchRequestsAsync().wait() try test(false) diff --git a/swift/test/Ice/timeout/Client.swift b/swift/test/Ice/timeout/Client.swift index 7f675d914af..94a5ffc4a64 100644 --- a/swift/test/Ice/timeout/Client.swift +++ b/swift/test/Ice/timeout/Client.swift @@ -8,7 +8,7 @@ import TestCommon class Client: TestHelperI { public override func run(args: [String]) throws { do { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/Ice/timeout/Server.swift b/swift/test/Ice/timeout/Server.swift index 37a5e37d939..635e38fe456 100644 --- a/swift/test/Ice/timeout/Server.swift +++ b/swift/test/Ice/timeout/Server.swift @@ -28,7 +28,7 @@ class Server: TestHelperI { // properties.setProperty(key: "Ice.TCP.RcvSize", value: "50000") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/timeout/TestI.swift b/swift/test/Ice/timeout/TestI.swift index d33a3b36ee2..bd98e8296ee 100644 --- a/swift/test/Ice/timeout/TestI.swift +++ b/swift/test/Ice/timeout/TestI.swift @@ -1,15 +1,15 @@ // +import Foundation // Copyright (c) ZeroC, Inc. All rights reserved. // import Ice -import Foundation class TimeoutI: Timeout { - func op(current: Current) throws {} + func op(current _: Current) throws {} - func sendData(seq: ByteSeq, current: Current) throws {} + func sendData(seq _: ByteSeq, current _: Current) throws {} - func sleep(to: Int32, current: Current) throws { + func sleep(to: Int32, current _: Current) throws { Thread.sleep(forTimeInterval: TimeInterval(to) / 1000) } } @@ -38,7 +38,7 @@ class ControllerI: Controller { } } - func resumeAdapter(current: Ice.Current) throws { + func resumeAdapter(current _: Ice.Current) throws { try _adapter.activate() } diff --git a/swift/test/Ice/udp/AllTests.swift b/swift/test/Ice/udp/AllTests.swift index 7c8a36c2804..425a44beb32 100644 --- a/swift/test/Ice/udp/AllTests.swift +++ b/swift/test/Ice/udp/AllTests.swift @@ -2,13 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Dispatch +import Foundation import Ice import TestCommon -import Foundation -import Dispatch class PingReplyI: PingReply { - var _replies: Int32 = 0 var _lock = os_unfair_lock() var _semaphore = DispatchSemaphore(value: 0) @@ -19,7 +18,7 @@ class PingReplyI: PingReply { } } - func reply(current: Current) throws { + func reply(current _: Current) throws { withLock(&_lock) { _replies += 1 _semaphore.signal() @@ -63,7 +62,7 @@ public func allTests(_ helper: TestHelper) throws { let obj = uncheckedCast(prx: base, type: TestIntfPrx.self) var ret = false - for _ in 0..<5 { + for _ in 0 ..< 5 { replyI.reset() try obj.ping(reply) try obj.ping(reply) @@ -133,7 +132,7 @@ public func allTests(_ helper: TestHelper) throws { base = try communicator.stringToProxy("test -d:\(endpoint)")! let objMcast = uncheckedCast(prx: base, type: TestIntfPrx.self) - for _ in 0..<5 { + for _ in 0 ..< 5 { replyI.reset() try objMcast.ping(reply) ret = replyI.waitReply(expectedReplies: 5, timeout: 5000) @@ -154,7 +153,7 @@ public func allTests(_ helper: TestHelper) throws { output.write("testing udp bi-dir connection... ") try obj.ice_getConnection()!.setAdapter(adapter) try objMcast.ice_getConnection()!.setAdapter(adapter) - for _ in 0..<5 { + for _ in 0 ..< 5 { replyI.reset() try obj.pingBiDir(reply.ice_getIdentity()) try obj.pingBiDir(reply.ice_getIdentity()) diff --git a/swift/test/Ice/udp/Client.swift b/swift/test/Ice/udp/Client.swift index f9d112b8251..d39b3f0767c 100644 --- a/swift/test/Ice/udp/Client.swift +++ b/swift/test/Ice/udp/Client.swift @@ -13,14 +13,14 @@ class Client: TestHelperI { properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.UDP.SndSize", value: "16384") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } try allTests(self) let num = restArgs.count == 1 ? Int(restArgs[0]) : 1 - for i in 0..<(num ?? 1) { + for i in 0 ..< (num ?? 1) { let prx = try communicator.stringToProxy("control:\(getTestEndpoint(num: Int32(i), prot: "tcp"))")! try uncheckedCast(prx: prx, type: TestIntfPrx.self).shutdown() } diff --git a/swift/test/Ice/udp/Server.swift b/swift/test/Ice/udp/Server.swift index 0efc312436e..343b5c68e19 100644 --- a/swift/test/Ice/udp/Server.swift +++ b/swift/test/Ice/udp/Server.swift @@ -14,7 +14,7 @@ class Server: TestHelperI { properties.setProperty(key: "Ice.Warn.Connections", value: "0") properties.setProperty(key: "Ice.UDP.RcvSize", value: "16384") - let communicator = try self.initialize(properties) + let communicator = try initialize(properties) defer { communicator.destroy() } diff --git a/swift/test/Ice/udp/TestI.swift b/swift/test/Ice/udp/TestI.swift index cb78e7222a4..e19020a1d35 100644 --- a/swift/test/Ice/udp/TestI.swift +++ b/swift/test/Ice/udp/TestI.swift @@ -5,7 +5,7 @@ import Ice class TestIntfI: TestIntf { - func ping(reply: PingReplyPrx?, current: Current) throws { + func ping(reply: PingReplyPrx?, current _: Current) throws { do { try reply!.reply() } catch { @@ -13,7 +13,7 @@ class TestIntfI: TestIntf { } } - func sendByteSeq(seq: ByteSeq, reply: PingReplyPrx?, current: Current) throws { + func sendByteSeq(seq _: ByteSeq, reply: PingReplyPrx?, current _: Current) throws { do { try reply!.reply() } catch { diff --git a/swift/test/IceSSL/configuration/AllTests.swift b/swift/test/IceSSL/configuration/AllTests.swift index 85393b3418a..118e0a66182 100644 --- a/swift/test/IceSSL/configuration/AllTests.swift +++ b/swift/test/IceSSL/configuration/AllTests.swift @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation var keychainN = 0 @@ -24,7 +24,7 @@ func createClientProps(_ defaultProperties: Ice.Properties) -> Ice.Properties { value: defaultProperties.getProperty("Ice.IPv6")) } properties.setProperty(key: "Ice.RetryIntervals", value: "-1") - //properties.setProperty("IceSSL.Trace.Security", "1") + // properties.setProperty("IceSSL.Trace.Security", "1") keychainN += 1 properties.setProperty(key: "IceSSL.Keychain", value: "client\(keychainN).keychain") @@ -41,7 +41,7 @@ func createServerProps(_ defaultProperties: Ice.Properties) -> [String: String] if defaultProperties.getProperty("Ice.IPv6") != "" { result["Ice.IPv6"] = defaultProperties.getProperty("Ice.IPv6") } - //result["IceSSL.Trace.Security"] = "1"; + // result["IceSSL.Trace.Security"] = "1"; keychainN += 1 result["IceSSL.Keychain"] = "client\(keychainN).keychain" @@ -494,7 +494,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe // properties = createClientProps(defaultProperties: defaultProperties, cert: "", ca: "cacert1") properties.setProperty(key: "IceSSL.VerifyPeer", value: "1") - //initData.properties->setProperty("IceSSL.VerifyDepthMax", "3"); + // initData.properties->setProperty("IceSSL.VerifyDepthMax", "3"); comm = try helper.initialize(properties) fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! @@ -815,8 +815,8 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe comm = try helper.initialize(properties) var count = 0 comm.setSslPasswordPrompt { - count += 1 - return "client" + count += 1 + return "client" } try comm.initializePlugins() try test(count == 1) @@ -897,7 +897,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe comm = try helper.initialize(properties) try test(false) } catch is Ice.PluginInitializationException { - //Expected when disabled all cipher suites. + // Expected when disabled all cipher suites. } // @@ -945,8 +945,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe do { try server.ice_ping() try test(false) - } catch is LocalException { - } + } catch is LocalException {} try fact.destroyServer(server) comm.destroy() @@ -1133,7 +1132,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)! d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1") - d["IceSSL.TrustOnly"] = "!CN=Client1"; // Should not match "Client" + d["IceSSL.TrustOnly"] = "!CN=Client1" // Should not match "Client" server = try fact.createServer(d)! try server.ice_ping() try fact.destroyServer(server) @@ -1346,7 +1345,7 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe d["IceSSL.TrustOnly.Server"] = "!CN=Client" server = try fact.createServer(d)! do { - try server.ice_ping() + try server.ice_ping() try test(false) } catch is LocalException {} try fact.destroyServer(server) diff --git a/swift/test/IceSSL/configuration/Client.swift b/swift/test/IceSSL/configuration/Client.swift index f9d2b6eb5ca..7616dd195bb 100644 --- a/swift/test/IceSSL/configuration/Client.swift +++ b/swift/test/IceSSL/configuration/Client.swift @@ -2,22 +2,22 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class Client: TestHelperI { public override func run(args: [String]) throws { do { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } var path = Bundle.main.bundlePath #if os(iOS) || os(watchOS) || os(tvOS) - path += "/Frameworks/IceSSLConfiguration.bundle/certs" + path += "/Frameworks/IceSSLConfiguration.bundle/certs" #else - path += "/Contents/Frameworks/IceSSLConfiguration.bundle/Contents/Resources/certs" + path += "/Contents/Frameworks/IceSSLConfiguration.bundle/Contents/Resources/certs" #endif let factory = try allTests(self, path) diff --git a/swift/test/IceSSL/configuration/Server.swift b/swift/test/IceSSL/configuration/Server.swift index 1fdbf3286e9..cbfdf870b4b 100644 --- a/swift/test/IceSSL/configuration/Server.swift +++ b/swift/test/IceSSL/configuration/Server.swift @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class Server: TestHelperI { public override func run(args: [String]) throws { @@ -16,9 +16,9 @@ class Server: TestHelperI { var path = Bundle.main.bundlePath #if os(iOS) || os(watchOS) || os(tvOS) - path += "/Frameworks/IceSSLConfiguration.bundle/certs" + path += "/Frameworks/IceSSLConfiguration.bundle/certs" #else - path += "/Contents/Frameworks/IceSSLConfiguration.bundle/Contents/Resources/certs" + path += "/Contents/Frameworks/IceSSLConfiguration.bundle/Contents/Resources/certs" #endif communicator.getProperties().setProperty(key: "TestAdapter.Endpoints", value: getTestEndpoint(num: 0, prot: "tcp")) diff --git a/swift/test/IceSSL/configuration/TestI.swift b/swift/test/IceSSL/configuration/TestI.swift index f453c63f78a..37f9bbd58ce 100644 --- a/swift/test/IceSSL/configuration/TestI.swift +++ b/swift/test/IceSSL/configuration/TestI.swift @@ -6,11 +6,10 @@ import Ice import TestCommon class ServerI: SSLServer { - var _communicator: Ice.Communicator var _helper: TestHelper - init (communicator: Ice.Communicator, helper: TestHelper) { + init(communicator: Ice.Communicator, helper: TestHelper) { _communicator = communicator _helper = helper } @@ -24,7 +23,7 @@ class ServerI: SSLServer { } } - func checkCert(subjectDN: String, issuerDN: String, current: Ice.Current) throws { + func checkCert(subjectDN _: String, issuerDN _: String, current: Ice.Current) throws { do { let info = try current.con!.getInfo() as! SSLConnectionInfo try _helper.test(info.verified) @@ -49,7 +48,6 @@ class ServerI: SSLServer { } class ServerFactoryI: SSLServerFactory { - var _defaultDir: String var _helper: TestHelper var _servers: [Identity: ServerI] @@ -60,7 +58,7 @@ class ServerFactoryI: SSLServerFactory { _servers = [:] } - func createServer(props: [String: String], current: Ice.Current) throws -> SSLServerPrx? { + func createServer(props: [String: String], current _: Ice.Current) throws -> SSLServerPrx? { let properties = Ice.createProperties() for (key, value) in props { properties.setProperty(key: key, value: value) @@ -77,7 +75,7 @@ class ServerFactoryI: SSLServerFactory { return uncheckedCast(prx: obj, type: SSLServerPrx.self) } - func destroyServer(srv: SSLServerPrx?, current: Ice.Current) throws { + func destroyServer(srv: SSLServerPrx?, current _: Ice.Current) throws { if let srv = srv { if let server = _servers.removeValue(forKey: srv.ice_getIdentity()) { try server.destroy() diff --git a/swift/test/Slice/escape/Client.swift b/swift/test/Slice/escape/Client.swift index fdbda0b243e..32cc6cae0ec 100644 --- a/swift/test/Slice/escape/Client.swift +++ b/swift/test/Slice/escape/Client.swift @@ -2,33 +2,31 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import TestCommon import Ice import PromiseKit +import TestCommon class breakI: `break` { - func caseAsync(catch: Int32, current: Current) -> Promise<Int32> { + func caseAsync(catch _: Int32, current _: Current) -> Promise<Int32> { return Promise.value(0) } } class funcI: `func` { - func `public`(current: Current) throws { - } + func `public`(current _: Current) throws {} } class doI: `do` { - func `public`(current: Current) throws { - } + func `public`(current _: Current) throws {} - func caseAsync(catch: Int32, current: Current) -> Promise<Int32> { + func caseAsync(catch _: Int32, current _: Current) -> Promise<Int32> { return Promise.value(0) } } public class Client: TestHelperI { public override func run(args: [String]) throws { - let communicator = try self.initialize(args) + let communicator = try initialize(args) defer { communicator.destroy() } diff --git a/swift/test/TestCommon/TestCommon.swift b/swift/test/TestCommon/TestCommon.swift index 5dd9f34cf31..2f8b6f01a8a 100644 --- a/swift/test/TestCommon/TestCommon.swift +++ b/swift/test/TestCommon/TestCommon.swift @@ -133,6 +133,7 @@ open class TestHelperI: TestHelper { remainingArgs = try properties.parseCommandLineOptions(prefix: "Test", options: remainingArgs) return properties } + public func createTestProperties(_ args: inout [String]) throws -> Ice.Properties { let properties = try Ice.createProperties(&args) args = try properties.parseCommandLineOptions(prefix: "Test", options: args) diff --git a/swift/test/TestDriver/iOS/AppDelegate.swift b/swift/test/TestDriver/iOS/AppDelegate.swift index bc6a93cb659..175cda70307 100644 --- a/swift/test/TestDriver/iOS/AppDelegate.swift +++ b/swift/test/TestDriver/iOS/AppDelegate.swift @@ -8,24 +8,19 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + func application(_: UIApplication, + didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } - func applicationWillResignActive(_ application: UIApplication) { - } + func applicationWillResignActive(_: UIApplication) {} - func applicationDidEnterBackground(_ application: UIApplication) { - } + func applicationDidEnterBackground(_: UIApplication) {} - func applicationWillEnterForeground(_ application: UIApplication) { - } + func applicationWillEnterForeground(_: UIApplication) {} - func applicationDidBecomeActive(_ application: UIApplication) { - } + func applicationDidBecomeActive(_: UIApplication) {} - func applicationWillTerminate(_ application: UIApplication) { - } + func applicationWillTerminate(_: UIApplication) {} } diff --git a/swift/test/TestDriver/iOS/ControllerI.swift b/swift/test/TestDriver/iOS/ControllerI.swift index 5f6dcd39239..f0fb232c643 100644 --- a/swift/test/TestDriver/iOS/ControllerI.swift +++ b/swift/test/TestDriver/iOS/ControllerI.swift @@ -66,13 +66,13 @@ class ProcessControllerI: CommonProcessController { // For a Client test reuse the Server or ServerAMD bundle // if it has been loaded. // - _bundleName = testsuite.split(separator: "/").map({ + _bundleName = testsuite.split(separator: "/").map { if let c = $0.first { return c.uppercased() + $0.dropFirst() } else { return String($0) } - }).joined(separator: "") + }.joined(separator: "") if exe == "ServerAMD" { _bundleName += "AMD" diff --git a/swift/test/TestDriver/iOS/ViewController.swift b/swift/test/TestDriver/iOS/ViewController.swift index 1f7161434d9..3493bb98beb 100644 --- a/swift/test/TestDriver/iOS/ViewController.swift +++ b/swift/test/TestDriver/iOS/ViewController.swift @@ -2,14 +2,13 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -import UIKit import Darwin +import UIKit class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate { - - @IBOutlet weak var interfaceIPv4: UIPickerView! - @IBOutlet weak var interfaceIPv6: UIPickerView! - @IBOutlet weak var output: UITextView! + @IBOutlet var interfaceIPv4: UIPickerView! + @IBOutlet var interfaceIPv6: UIPickerView! + @IBOutlet var output: UITextView! var interfacesIPv4: [String]! var interfacesIPv6: [String]! @@ -27,9 +26,8 @@ class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDele if getifaddrs(&ifap) == 0 { for curr in sequence(first: ifap!, next: { $0.pointee.ifa_next }) { - if (curr.pointee.ifa_flags & UInt32(IFF_UP)) != 0 && + if (curr.pointee.ifa_flags & UInt32(IFF_UP)) != 0, (curr.pointee.ifa_flags & UInt32(IFF_LOOPBACK)) == 0 { - if curr.pointee.ifa_addr!.pointee.sa_family == UInt32(AF_INET) { var buf = [Int8](repeating: 0, count: Int(INET_ADDRSTRLEN)) curr.pointee.ifa_addr!.withMemoryRebound(to: sockaddr_in.self, capacity: 1) { addr in @@ -75,11 +73,11 @@ class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDele print("\(msg)\n") } - func numberOfComponents(in pickerView: UIPickerView) -> Int { + func numberOfComponents(in _: UIPickerView) -> Int { return 1 } - func pickerView(_ view: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + func pickerView(_ view: UIPickerView, numberOfRowsInComponent _: Int) -> Int { if view === interfaceIPv4 { return interfacesIPv4.count } else { @@ -87,7 +85,7 @@ class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDele } } - func pickerView(_ view: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + func pickerView(_ view: UIPickerView, titleForRow row: Int, forComponent _: Int) -> String? { if view === interfaceIPv4 { return interfacesIPv4[row] } else { @@ -95,7 +93,7 @@ class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDele } } - func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + func pickerView(_: UIPickerView, didSelectRow _: Int, inComponent _: Int) { do { ControllerI.stopController() try ControllerI.startController(view: self, diff --git a/swift/test/TestDriver/macOS/main.swift b/swift/test/TestDriver/macOS/main.swift index 11e0f5e9f09..067669642c0 100644 --- a/swift/test/TestDriver/macOS/main.swift +++ b/swift/test/TestDriver/macOS/main.swift @@ -3,8 +3,8 @@ // import Foundation -import TestCommon import PromiseKit +import TestCommon PromiseKit.conf.Q.map = .global() PromiseKit.conf.Q.return = .global() @@ -17,13 +17,13 @@ if args.count < 3 { } do { - var bundleName = args[1].split(separator: ".").map({ + var bundleName = args[1].split(separator: ".").map { if let c = $0.first { return c.uppercased() + $0.dropFirst() } else { return String($0) } - }).joined(separator: "") + }.joined(separator: "") let exe = args[2] if exe == "ServerAMD" { |