@@ -48,15 +48,15 @@ final class ListCommandsTests: XCTestCase {
48
48
49
49
element = try connection. lindex ( 0 , from: #function) . wait ( )
50
50
XCTAssertFalse ( element. isNull)
51
- XCTAssertEqual ( Int ( element) , 10 )
51
+ XCTAssertEqual ( Int ( fromRESP : element) , 10 )
52
52
}
53
53
54
54
func test_lset( ) throws {
55
55
XCTAssertThrowsError ( try connection. lset ( index: 0 , to: 30 , in: #function) . wait ( ) )
56
56
_ = try connection. lpush ( [ 10 ] , into: #function) . wait ( )
57
57
XCTAssertNoThrow ( try connection. lset ( index: 0 , to: 30 , in: #function) . wait ( ) )
58
58
let element = try connection. lindex ( 0 , from: #function) . wait ( )
59
- XCTAssertEqual ( Int ( element) , 30 )
59
+ XCTAssertEqual ( Int ( fromRESP : element) , 30 )
60
60
}
61
61
62
62
func test_lrem( ) throws {
@@ -75,8 +75,8 @@ final class ListCommandsTests: XCTestCase {
75
75
76
76
elements = try connection. lrange ( within: ( 0 , 4 ) , from: #function) . wait ( )
77
77
XCTAssertEqual ( elements. count, 5 )
78
- XCTAssertEqual ( Int ( elements [ 0 ] ) , 1 )
79
- XCTAssertEqual ( Int ( elements [ 4 ] ) , 5 )
78
+ XCTAssertEqual ( Int ( fromRESP : elements [ 0 ] ) , 1 )
79
+ XCTAssertEqual ( Int ( fromRESP : elements [ 4 ] ) , 5 )
80
80
81
81
elements = try connection. lrange ( within: ( 2 , 0 ) , from: #function) . wait ( )
82
82
XCTAssertEqual ( elements. count, 0 )
@@ -93,20 +93,20 @@ final class ListCommandsTests: XCTestCase {
93
93
_ = try connection. lpush ( [ 30 ] , into: " second " ) . wait ( )
94
94
95
95
var element = try connection. rpoplpush ( from: " first " , to: " second " ) . wait ( )
96
- XCTAssertEqual ( Int ( element) , 10 )
96
+ XCTAssertEqual ( Int ( fromRESP : element) , 10 )
97
97
XCTAssertEqual ( try connection. llen ( of: " first " ) . wait ( ) , 0 )
98
98
XCTAssertEqual ( try connection. llen ( of: " second " ) . wait ( ) , 2 )
99
99
100
100
element = try connection. rpoplpush ( from: " second " , to: " first " ) . wait ( )
101
- XCTAssertEqual ( Int ( element) , 30 )
101
+ XCTAssertEqual ( Int ( fromRESP : element) , 30 )
102
102
XCTAssertEqual ( try connection. llen ( of: " second " ) . wait ( ) , 1 )
103
103
}
104
104
105
105
func test_brpoplpush( ) throws {
106
106
_ = try connection. lpush ( [ 10 ] , into: " first " ) . wait ( )
107
107
108
108
let element = try connection. brpoplpush ( from: " first " , to: " second " ) . wait ( ) ?? . null
109
- XCTAssertEqual ( Int ( element) , 10 )
109
+ XCTAssertEqual ( Int ( fromRESP : element) , 10 )
110
110
111
111
let blockingConnection = try Redis . makeConnection ( ) . wait ( )
112
112
let expectation = XCTestExpectation ( description: " brpoplpush should never return " )
@@ -123,13 +123,13 @@ final class ListCommandsTests: XCTestCase {
123
123
124
124
_ = try connection. linsert ( 20 , into: #function, after: 10 ) . wait ( )
125
125
var elements = try connection. lrange ( within: ( 0 , 1 ) , from: #function)
126
- . map { response in response. compactMap { Int ( $0) } }
126
+ . map { response in response. compactMap { Int ( fromRESP : $0) } }
127
127
. wait ( )
128
128
XCTAssertEqual ( elements, [ 10 , 20 ] )
129
129
130
130
_ = try connection. linsert ( 30 , into: #function, before: 10 ) . wait ( )
131
131
elements = try connection. lrange ( within: ( 0 , 2 ) , from: #function)
132
- . map { response in response. compactMap { Int ( $0) } }
132
+ . map { response in response. compactMap { Int ( fromRESP : $0) } }
133
133
. wait ( )
134
134
XCTAssertEqual ( elements, [ 30 , 10 , 20 ] )
135
135
}
@@ -142,7 +142,7 @@ final class ListCommandsTests: XCTestCase {
142
142
143
143
element = try connection. lpop ( from: #function) . wait ( )
144
144
XCTAssertFalse ( element. isNull)
145
- XCTAssertEqual ( Int ( element) , 30 )
145
+ XCTAssertEqual ( Int ( fromRESP : element) , 30 )
146
146
}
147
147
148
148
func test_blpop( ) throws {
@@ -151,7 +151,7 @@ final class ListCommandsTests: XCTestCase {
151
151
152
152
_ = try connection. lpush ( [ 10 , 20 , 30 ] , into: " first " ) . wait ( )
153
153
let pop1 = try connection. blpop ( from: " first " ) . wait ( ) ?? . null
154
- XCTAssertEqual ( Int ( pop1) , 30 )
154
+ XCTAssertEqual ( Int ( fromRESP : pop1) , 30 )
155
155
156
156
let pop2 = try connection. blpop ( from: [ " fake " , " first " ] ) . wait ( )
157
157
XCTAssertEqual ( pop2? . 0 , " first " )
@@ -172,7 +172,7 @@ final class ListCommandsTests: XCTestCase {
172
172
let size = try connection. lpush ( [ 100 ] , into: #function) . wait ( )
173
173
let element = try connection. lindex ( 0 , from: #function) . wait ( )
174
174
XCTAssertEqual ( size, 4 )
175
- XCTAssertEqual ( Int ( element) , 100 )
175
+ XCTAssertEqual ( Int ( fromRESP : element) , 100 )
176
176
}
177
177
178
178
func test_lpushx( ) throws {
@@ -184,7 +184,7 @@ final class ListCommandsTests: XCTestCase {
184
184
size = try connection. lpushx ( 30 , into: #function) . wait ( )
185
185
XCTAssertEqual ( size, 2 )
186
186
let element = try connection. rpop ( from: #function)
187
- . map { return Int ( $0) }
187
+ . map { return Int ( fromRESP : $0) }
188
188
. wait ( )
189
189
XCTAssertEqual ( element, 10 )
190
190
}
@@ -194,7 +194,7 @@ final class ListCommandsTests: XCTestCase {
194
194
195
195
let element = try connection. rpop ( from: #function) . wait ( )
196
196
XCTAssertNotNil ( element)
197
- XCTAssertEqual ( Int ( element) , 10 )
197
+ XCTAssertEqual ( Int ( fromRESP : element) , 10 )
198
198
199
199
_ = try connection. delete ( [ #function] ) . wait ( )
200
200
@@ -208,7 +208,7 @@ final class ListCommandsTests: XCTestCase {
208
208
209
209
_ = try connection. lpush ( [ 10 , 20 , 30 ] , into: " first " ) . wait ( )
210
210
let pop1 = try connection. brpop ( from: " first " ) . wait ( ) ?? . null
211
- XCTAssertEqual ( Int ( pop1) , 10 )
211
+ XCTAssertEqual ( Int ( fromRESP : pop1) , 10 )
212
212
213
213
let pop2 = try connection. brpop ( from: [ " fake " , " first " ] ) . wait ( )
214
214
XCTAssertEqual ( pop2? . 0 , " first " )
@@ -229,7 +229,7 @@ final class ListCommandsTests: XCTestCase {
229
229
let size = try connection. rpush ( [ 100 ] , into: #function) . wait ( )
230
230
let element = try connection. lindex ( 3 , from: #function) . wait ( )
231
231
XCTAssertEqual ( size, 4 )
232
- XCTAssertEqual ( Int ( element) , 100 )
232
+ XCTAssertEqual ( Int ( fromRESP : element) , 100 )
233
233
}
234
234
235
235
func test_rpushx( ) throws {
@@ -241,7 +241,7 @@ final class ListCommandsTests: XCTestCase {
241
241
size = try connection. rpushx ( 30 , into: #function) . wait ( )
242
242
XCTAssertEqual ( size, 2 )
243
243
let element = try connection. lpop ( from: #function)
244
- . map { return Int ( $0) }
244
+ . map { return Int ( fromRESP : $0) }
245
245
. wait ( )
246
246
XCTAssertEqual ( element, 10 )
247
247
}
0 commit comments