Skip to content

Commit

Permalink
fix more warnings in newer compilers (#1178)
Browse files Browse the repository at this point in the history
Motivation:

Newer Swift compilers have more diagnostics which cause warnings in NIO.

Modifications:

Fix those warnings.

Result:

Fewer warnings.
  • Loading branch information
weissi authored and Lukasa committed Oct 22, 2019
1 parent 4761f96 commit 63458d4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Tests/NIOWebSocketTests/WebSocketFrameDecoderTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,10 @@ public final class WebSocketFrameDecoderTest: XCTestCase {
let wrongFrame: [UInt8] = [0x81, 0xFE, 0x40, 0x01]
self.buffer.writeBytes(wrongFrame)
XCTAssertThrowsError(try self.decoderChannel.writeInbound(self.buffer)) { error in
if case .some(.dataReceivedInErrorState(let data)) = error as? ByteToMessageDecoderError {
if case .some(.dataReceivedInErrorState(let innerError, let data)) = error as? ByteToMessageDecoderError {
// ok
XCTAssertEqual(wrongFrame, Array(data.1.readableBytesView))
XCTAssertEqual(.fragmentedControlFrame, innerError as? NIOWebSocketError)
XCTAssertEqual(wrongFrame, Array(data.readableBytesView))
} else {
XCTFail("unexpected error: \(error)")
}
Expand Down Expand Up @@ -458,9 +459,10 @@ public final class WebSocketFrameDecoderTest: XCTestCase {
let wrongFrame: [UInt8] = [0x81, 0xFE, 0x40, 0x01]
self.buffer.writeBytes(wrongFrame)
XCTAssertThrowsError(try self.decoderChannel.writeInbound(self.buffer)) { error in
if case .some(.dataReceivedInErrorState(let data)) = error as? ByteToMessageDecoderError {
if case .some(.dataReceivedInErrorState(let innerError, let data)) = error as? ByteToMessageDecoderError {
// ok
XCTAssertEqual(wrongFrame, Array(data.1.readableBytesView))
XCTAssertEqual(.fragmentedControlFrame, innerError as? NIOWebSocketError)
XCTAssertEqual(wrongFrame, Array(data.readableBytesView))
} else {
XCTFail("unexpected error: \(error)")
}
Expand Down Expand Up @@ -569,9 +571,10 @@ public final class WebSocketFrameDecoderTest: XCTestCase {
let wrongFrame: [UInt8] = [0x81, 0xFE, 0x40, 0x01]
self.buffer.writeBytes(wrongFrame)
XCTAssertThrowsError(try self.decoderChannel.writeInbound(self.buffer)) { error in
if case .some(.dataReceivedInErrorState(let data)) = error as? ByteToMessageDecoderError {
if case .some(.dataReceivedInErrorState(let innerError, let data)) = error as? ByteToMessageDecoderError {
// ok
XCTAssertEqual(wrongFrame, Array(data.1.readableBytesView))
XCTAssertEqual(.fragmentedControlFrame, innerError as? NIOWebSocketError)
XCTAssertEqual(wrongFrame, Array(data.readableBytesView))
} else {
XCTFail("unexpected error: \(error)")
}
Expand Down

0 comments on commit 63458d4

Please sign in to comment.