Skip to content

Commit c54f804

Browse files
committed
Remove deprecation warnings for Data.init(bytes:)
1 parent 7609a84 commit c54f804

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Tests/NIORedisTests/ChannelHandlers/RESPDecoder+ParsingTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ final class RESPDecoderParsingTests: XCTestCase {
4343
XCTAssertEqual(parseTest_singleValue(input: "$0\r\n\r\n")?.string, "")
4444
XCTAssertEqual(parseTest_singleValue(input: "$1\r\n!\r\n")?.string, "!")
4545
XCTAssertEqual(
46-
parseTest_singleValue(input: "$1\r\n".convertedToData() + Data(bytes: [0xa3]) + "\r\n".convertedToData())?.data,
47-
Data(bytes: [0xa3])
46+
parseTest_singleValue(input: "$1\r\n".convertedToData() + Data([0xa3]) + "\r\n".convertedToData())?.data,
47+
Data([0xa3])
4848
)
4949
XCTAssertEqual(
50-
parseTest_singleValue(input: "$1\r\n".convertedToData() + Data(bytes: [0xba]) + "\r\n".convertedToData())?.data,
51-
Data(bytes: [0xba])
50+
parseTest_singleValue(input: "$1\r\n".convertedToData() + Data([0xba]) + "\r\n".convertedToData())?.data,
51+
Data([0xba])
5252
)
5353
}
5454

@@ -59,8 +59,8 @@ final class RESPDecoderParsingTests: XCTestCase {
5959

6060
let t2 = try parseTest_twoValues(withChunks: [
6161
"$3\r".convertedToData(),
62-
"\n".convertedToData() + Data(bytes: [0xAA, 0xA3, 0xFF]) + "\r\n$".convertedToData(),
63-
"4\r\n".convertedToData() + Data(bytes: [0xbb, 0x3a, 0xba, 0xFF]) + "\r\n".convertedToData()
62+
"\n".convertedToData() + Data([0xAA, 0xA3, 0xFF]) + "\r\n$".convertedToData(),
63+
"4\r\n".convertedToData() + Data([0xbb, 0x3a, 0xba, 0xFF]) + "\r\n".convertedToData()
6464
])
6565
XCTAssertTrue(t2.0?.data?.count == 3)
6666
XCTAssertTrue(t2.1?.data?.count == 4)
@@ -277,7 +277,7 @@ extension RESPDecoderParsingTests {
277277

278278
func testParsing_bulkString_handlesRawBytes() throws {
279279
let bytes: [UInt8] = [0x00, 0x01, 0x02, 0x03, 0x0A, 0xFF]
280-
let data = "$\(bytes.count)\r\n".convertedToData() + Data(bytes: bytes) + "\r\n".convertedToData()
280+
let data = "$\(bytes.count)\r\n".convertedToData() + Data(bytes) + "\r\n".convertedToData()
281281

282282
let result = parseTestBulkString(data)
283283

Tests/NIORedisTests/ChannelHandlers/RESPDecoderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class RESPDecoderTests: XCTestCase {
6767
XCTAssertEqual(multiBulkString.0?.isNull, true)
6868
XCTAssertEqual(multiBulkString.1?.string, "")
6969

70-
let rawBytes = Data(bytes: [0x00, 0x01, 0x02, 0x03, 0x0A, 0xff])
70+
let rawBytes = Data([0x00, 0x01, 0x02, 0x03, 0x0A, 0xff])
7171
let rawByteInput = "$\(rawBytes.count)\r\n".convertedToData() + rawBytes + "\r\n".convertedToData()
7272
XCTAssertEqual(try runTest(rawByteInput)?.data, rawBytes)
7373
}

Tests/NIORedisTests/ChannelHandlers/RESPEncoder+ParsingTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class RESPEncoderParsingTests: XCTestCase {
1818
}
1919

2020
func testBulkStrings() {
21-
let t1 = Data(bytes: [0x01, 0x02, 0x0a, 0x1b, 0xaa])
21+
let t1 = Data([0x01, 0x02, 0x0a, 0x1b, 0xaa])
2222
XCTAssertEqual(
2323
encoder.encode(.bulkString(t1)),
2424
"$5\r\n".convertedToData() + t1 + "\r\n".convertedToData()
@@ -56,7 +56,7 @@ final class RESPEncoderParsingTests: XCTestCase {
5656
encoder.encode(a1),
5757
"*2\r\n:3\r\n+foo\r\n".convertedToData()
5858
)
59-
let bytes = Data(bytes: [ 0x0a, 0x1a, 0x1b, 0xff ])
59+
let bytes = Data([ 0x0a, 0x1a, 0x1b, 0xff ])
6060
let a2: RESPValue = .array([.array([
6161
.integer(3),
6262
.bulkString(bytes)

Tests/NIORedisTests/ChannelHandlers/RESPEncoderTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class RESPEncoderTests: XCTestCase {
3333
}
3434

3535
func testBulkStrings() throws {
36-
let bs1 = RESPValue.bulkString(Data(bytes: [0x01, 0x02, 0x0a, 0x1b, 0xaa]))
36+
let bs1 = RESPValue.bulkString(Data([0x01, 0x02, 0x0a, 0x1b, 0xaa]))
3737
try runEncodePass(with: bs1) { XCTAssertEqual($0.readableBytes, 11) }
3838
XCTAssertNoThrow(try channel.writeOutbound(bs1))
3939

@@ -65,7 +65,7 @@ final class RESPEncoderTests: XCTestCase {
6565
try runEncodePass(with: a2) { XCTAssertEqual($0.readableBytes, 14) }
6666
XCTAssertNoThrow(try channel.writeOutbound(a2))
6767

68-
let bytes = Data(bytes: [ 0x0a, 0x1a, 0x1b, 0xff ])
68+
let bytes = Data([ 0x0a, 0x1a, 0x1b, 0xff ])
6969
let a3: RESPValue = .array([.array([
7070
.integer(3),
7171
.bulkString(bytes)

0 commit comments

Comments
 (0)