@@ -12,22 +12,17 @@ func checkMatch<S: Collection, T: Collection>(_ x: S, _ y: T, _ i: S.Index)
12
12
expectEqual ( x [ i] , y [ i] )
13
13
}
14
14
15
- func checkMatchContiguousStorage< S: Collection , T: Collection > ( _ x: S , _ y: T , expected : Bool )
15
+ func checkMatchContiguousStorage< S: Collection , T: Collection > ( _ x: S , _ y: T )
16
16
where S. Element == T . Element , S. Element: Equatable
17
17
{
18
18
let xElement = x. withContiguousStorageIfAvailable { $0. first }
19
19
let yElement = y. withContiguousStorageIfAvailable { $0. first }
20
20
21
- if expected {
22
- expectEqual ( xElement, yElement)
23
- } else {
24
- expectNotEqual ( xElement, yElement)
25
- }
21
+ expectEqual ( xElement, yElement)
26
22
}
27
23
28
- func checkHasContiguousStorage< S: Collection > ( _ x: S , expected: Bool ) {
29
- let hasStorage = x. withContiguousStorageIfAvailable { _ in true } ?? false
30
- expectEqual ( hasStorage, expected)
24
+ func checkHasContiguousStorage< S: Collection > ( _ x: S ) {
25
+ expectTrue ( x. withContiguousStorageIfAvailable { _ in true } ?? false )
31
26
}
32
27
33
28
func checkHasContiguousStorageSubstring( _ x: Substring . UTF8View ) {
@@ -252,21 +247,21 @@ SubstringTests.test("UTF8View") {
252
247
expectEqual ( " " , String ( u. dropFirst ( 100 ) ) !)
253
248
expectEqual ( " " , String ( u. dropLast ( 100 ) ) !)
254
249
255
- checkHasContiguousStorage ( s. utf8, expected: true ) // Strings always do
250
+
251
+ checkHasContiguousStorage ( s. utf8) // Strings always do
256
252
checkHasContiguousStorageSubstring ( t)
257
253
checkHasContiguousStorageSubstring ( u)
258
- checkMatchContiguousStorage ( Array ( s. utf8) , s. utf8, expected : true )
254
+ checkMatchContiguousStorage ( Array ( s. utf8) , s. utf8)
259
255
260
256
// The specialization for Substring.withContiguousStorageIfAvailable was
261
257
// added in https://github.com/apple/swift/pull/29146.
262
258
guard #available( macOS 9999 , iOS 9999 , watchOS 9999 , tvOS 9999 , * ) else {
263
259
return
264
260
}
265
-
266
- checkHasContiguousStorage ( t, expected: true )
267
- checkHasContiguousStorage ( u, expected: true )
268
- checkMatchContiguousStorage ( Array ( t) , t, expected: true )
269
- checkMatchContiguousStorage ( Array ( u) , u, expected: true )
261
+ checkHasContiguousStorage ( t)
262
+ checkHasContiguousStorage ( u)
263
+ checkMatchContiguousStorage ( Array ( t) , t)
264
+ checkMatchContiguousStorage ( Array ( u) , u)
270
265
}
271
266
}
272
267
0 commit comments