fix crash
This commit is contained in:
parent
1b08411ed4
commit
f0b4f077d4
@ -37,10 +37,11 @@
|
|||||||
</BuildActionEntries>
|
</BuildActionEntries>
|
||||||
</BuildAction>
|
</BuildAction>
|
||||||
<TestAction
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
buildConfiguration = "Debug">
|
codeCoverageEnabled = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
@ -62,15 +63,18 @@
|
|||||||
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
|
<AdditionalOptions>
|
||||||
|
</AdditionalOptions>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
buildConfiguration = "Debug"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
@ -85,10 +89,10 @@
|
|||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
savedToolIdentifier = ""
|
savedToolIdentifier = ""
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
buildConfiguration = "Release"
|
|
||||||
debugDocumentVersioning = "YES">
|
debugDocumentVersioning = "YES">
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class AbstractSocketTest: XCTestCase {
|
class AbstractSocketTest: XCTestCase {
|
||||||
static let TEST_TIMEOUT = 4.0
|
static let TEST_TIMEOUT = 8.0
|
||||||
var socket:SocketIOClient!
|
var socket:SocketIOClient!
|
||||||
var testKind:TestKind?
|
var testKind:TestKind?
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class AbstractSocketTest: XCTestCase {
|
|||||||
}
|
}
|
||||||
socket.connect()
|
socket.connect()
|
||||||
XCTAssertTrue(socket.connecting)
|
XCTAssertTrue(socket.connecting)
|
||||||
waitForExpectationsWithTimeout(5, handler: nil)
|
waitForExpectationsWithTimeout(AbstractSocketTest.TEST_TIMEOUT, handler: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateTestName(rawTestName:String) ->String {
|
func generateTestName(rawTestName:String) ->String {
|
||||||
@ -42,11 +42,13 @@ class AbstractSocketTest: XCTestCase {
|
|||||||
|
|
||||||
func socketMultipleEmit(testName:String, emitData:Array<AnyObject>, callback:NormalCallback){
|
func socketMultipleEmit(testName:String, emitData:Array<AnyObject>, callback:NormalCallback){
|
||||||
let finalTestname = generateTestName(testName)
|
let finalTestname = generateTestName(testName)
|
||||||
let expection = self.expectationWithDescription(finalTestname)
|
weak var expection = self.expectationWithDescription(finalTestname)
|
||||||
func didGetEmit(result:NSArray?, ack:AckEmitter?) {
|
func didGetEmit(result:NSArray?, ack:AckEmitter?) {
|
||||||
callback(result, ack)
|
callback(result, ack)
|
||||||
|
if let expection = expection {
|
||||||
expection.fulfill()
|
expection.fulfill()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
socket.emit(finalTestname, withItems: emitData)
|
socket.emit(finalTestname, withItems: emitData)
|
||||||
socket.on(finalTestname + "Return", callback: didGetEmit)
|
socket.on(finalTestname + "Return", callback: didGetEmit)
|
||||||
@ -56,12 +58,15 @@ class AbstractSocketTest: XCTestCase {
|
|||||||
|
|
||||||
func socketEmit(testName:String, emitData:AnyObject?, callback:NormalCallback){
|
func socketEmit(testName:String, emitData:AnyObject?, callback:NormalCallback){
|
||||||
let finalTestname = generateTestName(testName)
|
let finalTestname = generateTestName(testName)
|
||||||
let expection = self.expectationWithDescription(finalTestname)
|
weak var expection = self.expectationWithDescription(finalTestname)
|
||||||
func didGetEmit(result:NSArray?, ack:AckEmitter?) {
|
func didGetEmit(result:NSArray?, ack:AckEmitter?) {
|
||||||
callback(result, ack)
|
callback(result, ack)
|
||||||
|
if let expection = expection {
|
||||||
expection.fulfill()
|
expection.fulfill()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
socket.on(finalTestname + "Return", callback: didGetEmit)
|
socket.on(finalTestname + "Return", callback: didGetEmit)
|
||||||
if let emitData = emitData {
|
if let emitData = emitData {
|
||||||
socket.emit(finalTestname, emitData)
|
socket.emit(finalTestname, emitData)
|
||||||
@ -74,11 +79,13 @@ class AbstractSocketTest: XCTestCase {
|
|||||||
|
|
||||||
func socketAcknwoledgeMultiple(testName:String, Data:Array<AnyObject>, callback:NormalCallback){
|
func socketAcknwoledgeMultiple(testName:String, Data:Array<AnyObject>, callback:NormalCallback){
|
||||||
let finalTestname = generateTestName(testName)
|
let finalTestname = generateTestName(testName)
|
||||||
let expection = self.expectationWithDescription(finalTestname)
|
weak var expection = self.expectationWithDescription(finalTestname)
|
||||||
func didGetResult(result:NSArray?) {
|
func didGetResult(result:NSArray?) {
|
||||||
callback(result, nil)
|
callback(result, nil)
|
||||||
|
if let expection = expection {
|
||||||
expection.fulfill()
|
expection.fulfill()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
socket.emitWithAck(finalTestname, withItems: Data)(timeoutAfter: 5, callback: didGetResult)
|
socket.emitWithAck(finalTestname, withItems: Data)(timeoutAfter: 5, callback: didGetResult)
|
||||||
waitForExpectationsWithTimeout(SocketEmitTest.TEST_TIMEOUT, handler: nil)
|
waitForExpectationsWithTimeout(SocketEmitTest.TEST_TIMEOUT, handler: nil)
|
||||||
@ -86,11 +93,13 @@ class AbstractSocketTest: XCTestCase {
|
|||||||
|
|
||||||
func socketAcknwoledge(testName:String, Data:AnyObject?, callback:NormalCallback){
|
func socketAcknwoledge(testName:String, Data:AnyObject?, callback:NormalCallback){
|
||||||
let finalTestname = generateTestName(testName)
|
let finalTestname = generateTestName(testName)
|
||||||
let expection = self.expectationWithDescription(finalTestname)
|
weak var expection = self.expectationWithDescription(finalTestname)
|
||||||
func didGet(result:NSArray?) {
|
func didGet(result:NSArray?) {
|
||||||
callback(result, nil)
|
callback(result, nil)
|
||||||
|
if let expection = expection {
|
||||||
expection.fulfill()
|
expection.fulfill()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var ack:OnAckCallback!
|
var ack:OnAckCallback!
|
||||||
if let Data = Data {
|
if let Data = Data {
|
||||||
ack = socket.emitWithAck(finalTestname, Data)
|
ack = socket.emitWithAck(finalTestname, Data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user