Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence #file/#filePath warnings in XCTest #228

Merged
merged 1 commit into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/NIOSSLTests/NIOSSLIntegrationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public func assertNoThrowWithValue<T>(_ body: @autoclosure () throws -> T, defau
do {
return try body()
} catch {
XCTFail("unexpected error \(error) thrown", file: file, line: line)
XCTFail("unexpected error \(error) thrown", file: (file), line: line)
if let defaultValue = defaultValue {
return defaultValue
} else {
Expand Down
16 changes: 8 additions & 8 deletions Tests/NIOSSLTests/TLSConfigurationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class TLSConfigurationTest: XCTestCase {
switch eventHandler.errors[0] {
case .handshakeFailed(.sslError(let errs)):
let correctError: Bool = messages.map { errs[0].description.contains($0) }.reduce(false) { $0 || $1 }
XCTAssert(correctError, errs[0].description, file: file, line: line)
XCTAssert(correctError, errs[0].description, file: (file), line: line)
default:
XCTFail("Unexpected error: \(eventHandler.errors[0])", file: file, line: line)
XCTFail("Unexpected error: \(eventHandler.errors[0])", file: (file), line: line)
}

XCTAssertFalse(handshakeHandler.handshakeSucceeded, file: file, line: line)
XCTAssertFalse(handshakeHandler.handshakeSucceeded, file: (file), line: line)
}
try clientChannel.closeFuture.wait()
}
Expand All @@ -159,18 +159,18 @@ class TLSConfigurationTest: XCTestCase {

// We expect the channel to be closed fairly swiftly as the handshake should fail.
clientChannel.closeFuture.whenComplete { _ in
XCTAssertEqual(eventHandler.errors.count, 1, file: file, line: line)
XCTAssertEqual(eventHandler.errors.count, 1, file: (file), line: line)

switch eventHandler.errors[0] {
case .sslError(let errs):
XCTAssertEqual(errs.count, 1, file: file, line: line)
XCTAssertEqual(errs.count, 1, file: (file), line: line)
let correctError: Bool = messages.map { errs[0].description.contains($0) }.reduce(false) { $0 || $1 }
XCTAssert(correctError, errs[0].description, file: file, line: line)
XCTAssert(correctError, errs[0].description, file: (file), line: line)
default:
XCTFail("Unexpected error: \(eventHandler.errors[0])", file: file, line: line)
XCTFail("Unexpected error: \(eventHandler.errors[0])", file: (file), line: line)
}

XCTAssertTrue(handshakeHandler.handshakeSucceeded, file: file, line: line)
XCTAssertTrue(handshakeHandler.handshakeSucceeded, file: (file), line: line)
}
try clientChannel.closeFuture.wait()
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/NIOSSLTests/UnwrappingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ extension ChannelPipeline {
do {
_ = try self.context(handler: handler).wait()
} catch {
XCTFail("Handler \(handler) missing from \(self)", file: file, line: line)
XCTFail("Handler \(handler) missing from \(self)", file: (file), line: line)
}
}

func assertDoesNotContain(handler: ChannelHandler, file: StaticString = #file, line: UInt = #line) {
do {
_ = try self.context(handler: handler).wait()
XCTFail("Handler \(handler) present in \(self)", file: file, line: line)
XCTFail("Handler \(handler) present in \(self)", file: (file), line: line)
} catch {
// Expected
}
Expand Down