Skip to content

Commit c9041be

Browse files
committed
Migrate callsites from 'expectNotEmpty()' to 'expectNotNil()'
1 parent 243a35c commit c9041be

30 files changed

+134
-134
lines changed

test/Interpreter/SDK/Foundation_test.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ FoundationTestSuite.test("NSKeyedUnarchiver/decodeObjectOfClass(_:forKey:)") {
278278
expectType((NSPredicate?).self, &missing)
279279

280280
var decoded = KU.decodeObject(of: NSPredicate.self, forKey: KEY)
281-
expectNotEmpty(decoded)
281+
expectNotNil(decoded)
282282
expectType((NSPredicate?).self, &decoded)
283283

284284
var wrongType = KU.decodeObject(of: DateFormatter.self, forKey: KEY)

test/Interpreter/SDK/cf_extensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ CFTestSuite.test("protocols/downcast")
7070
components: [1.0, 0.5, 0.25, 1.0])
7171
let opaquePink: AnyObject = pink
7272
let downcasted = opaquePink as? SwiftProto
73-
expectNotEmpty(downcasted)
73+
expectNotNil(downcasted)
7474
expectTrue(pink === downcasted!.doTheThing())
7575
}
7676

test/Interpreter/SDK/object_literals.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LiteralsTestSuite.test("file") {
1515
// This is what requires the proper bundle folder structure.
1616
let resource = #fileLiteral(resourceName: "testData.plist")
1717
let contents = NSDictionary(contentsOf: resource) as! [String: NSObject]?
18-
_ = expectNotEmpty(contents)
18+
_ = expectNotNil(contents)
1919
expectEqual(["test": true as NSObject], contents!)
2020
}
2121

test/Interpreter/objc_class_properties.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ ClassProperties.test("optionalProp") {
158158
expectNil(noProp.optionalClassProp)
159159

160160
let hasProp: ProtoWithClassProperty.Type = Subclass.self
161-
expectNotEmpty(hasProp.optionalClassProp)
161+
expectNotNil(hasProp.optionalClassProp)
162162
expectEqual(true, hasProp.optionalClassProp!)
163163

164164
let hasOwnProp: ProtoWithClassProperty.Type = SwiftClass.self
165-
expectNotEmpty(hasOwnProp.optionalClassProp)
165+
expectNotNil(hasOwnProp.optionalClassProp)
166166
expectEqual(true, hasOwnProp.optionalClassProp!)
167167

168168
let hasPropObjC: ProtoWithClassProperty.Type = ObjCSubclassWithClassProperty.self
169-
expectNotEmpty(hasPropObjC.optionalClassProp)
169+
expectNotNil(hasPropObjC.optionalClassProp)
170170
expectEqual(true, hasPropObjC.optionalClassProp!)
171171
}
172172

@@ -183,8 +183,8 @@ ClassProperties.test("namingConflict") {
183183

184184
let sub = NamingConflictSubclass()
185185
expectNil(sub.prop)
186-
expectNotEmpty(type(of: sub).prop)
187-
expectNotEmpty(NamingConflictSubclass.prop)
186+
expectNotNil(type(of: sub).prop)
187+
expectNotNil(NamingConflictSubclass.prop)
188188
}
189189

190190
extension NamingConflictSubclass : PropertyNamingConflictProto {

test/Interpreter/objc_class_properties_runtime.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ ClassProperties.test("runtime")
7474
.code {
7575
let theClass: AnyObject = SwiftClass.self
7676
let prop = class_getProperty(object_getClass(theClass), "value")
77-
expectNotEmpty(prop)
77+
expectNotNil(prop)
7878

7979
let nameAsCString = property_getName(prop)!
80-
expectNotEmpty(nameAsCString)
80+
expectNotNil(nameAsCString)
8181
expectEqual("value", String(cString: nameAsCString))
8282
}
8383

test/Interpreter/objc_runtime_visible.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ObjCRuntimeVisibleTestSuite.test("downcast") {
4747
let obj = HiddenClass.create()
4848
let opaque: AnyObject = obj
4949
let downcasted = opaque as? HiddenClass
50-
expectNotEmpty(downcasted)
50+
expectNotNil(downcasted)
5151
expectTrue(obj === downcasted)
5252
}
5353

@@ -67,7 +67,7 @@ ObjCRuntimeVisibleTestSuite.test("protocols/downcast")
6767
let obj = HiddenClass.create()
6868
let opaque: AnyObject = obj
6969
let downcasted = opaque as? SwiftProto
70-
expectNotEmpty(downcasted)
70+
expectNotNil(downcasted)
7171
expectTrue(obj === downcasted!.doTheThing())
7272
}
7373

test/stdlib/ArrayBridge.swift.gyb

+7-7
Original file line numberDiff line numberDiff line change
@@ -259,28 +259,28 @@ tests.test("Another/${Any}") {
259259
let subclass2 = subclassInBaseBuffer
260260

261261
// Explicit downcast-ability is based on element type, not buffer type
262-
expectNotEmpty(subclassInBaseBuffer as? [Subclass])
262+
expectNotNil(subclassInBaseBuffer as? [Subclass])
263263

264264
// We can up-cast to array of Any
265265
let subclassAsAnyArray: [${Any}] = subclassInBaseBuffer
266266
expectEqual(subclass2, subclassAsAnyArray.map { $0 as! Base })
267267

268268
let downcastBackToBase = subclassAsAnyArray as? [Base]
269-
expectNotEmpty(downcastBackToBase)
269+
expectNotNil(downcastBackToBase)
270270

271-
if let downcastBackToSubclass = expectNotEmpty(subclassAsAnyArray as? [Subclass]) {
271+
if let downcastBackToSubclass = expectNotNil(subclassAsAnyArray as? [Subclass]) {
272272
expectEqual(subclass2, downcastBackToSubclass)
273273
}
274274

275-
if let downcastToProtocols = expectNotEmpty(subclassAsAnyArray as? [Fooable]) {
275+
if let downcastToProtocols = expectNotNil(subclassAsAnyArray as? [Fooable]) {
276276
expectEqual(subclass2, downcastToProtocols.map { $0 as! Subclass })
277277
}
278278

279-
if let downcastToProtocols = expectNotEmpty(subclassAsAnyArray as? [Barable]) {
279+
if let downcastToProtocols = expectNotNil(subclassAsAnyArray as? [Barable]) {
280280
expectEqual(subclass2, downcastToProtocols.map { $0 as! Subclass })
281281
}
282282

283-
if let downcastToProtocols = expectNotEmpty(subclassAsAnyArray as? [Barable & Fooable]) {
283+
if let downcastToProtocols = expectNotNil(subclassAsAnyArray as? [Barable & Fooable]) {
284284
expectEqual(subclass2, downcastToProtocols.map { $0 as! Subclass })
285285
}
286286

@@ -364,7 +364,7 @@ tests.test("testExplicitlyBridged/${Any}") {
364364
}
365365

366366
// Downcasts of up-casted arrays.
367-
if let downcasted = expectNotEmpty(
367+
if let downcasted = expectNotNil(
368368
bridgeableValuesAsAnys as? [Subclass]
369369
) {
370370
expectEqualSequence(expectedSubclasses, downcasted)

test/stdlib/Builtins.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ class C : B {}
164164
tests.test("_getSuperclass") {
165165
expectNil(_getSuperclass(A.self))
166166
expectNil(_getSuperclass(Classy.self))
167-
expectNotEmpty(_getSuperclass(B.self))
168-
expectNotEmpty(_getSuperclass(C.self))
167+
expectNotNil(_getSuperclass(B.self))
168+
expectNotNil(_getSuperclass(C.self))
169169
expectTrue(_getSuperclass(B.self)! == A.self)
170170
expectTrue(_getSuperclass(C.self)! == B.self)
171171
}

test/stdlib/Dispatch.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ DispatchAPI.test("OS_OBJECT support") {
2626
expectTrue(mainQueue is DispatchQueue)
2727

2828
// This should not be optimized out, and should succeed.
29-
expectNotEmpty(mainQueue as? DispatchQueue)
29+
expectNotNil(mainQueue as? DispatchQueue)
3030
}
3131

3232
DispatchAPI.test("DispatchGroup creation") {
3333
let group = DispatchGroup()
34-
expectNotEmpty(group)
34+
expectNotNil(group)
3535
}
3636

3737
DispatchAPI.test("dispatch_block_t conversions") {

test/stdlib/Inputs/DictionaryKeyValueTypesObjC.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ import SlurpFastEnumeration
526526
with: &state, objects: AutoreleasingUnsafeMutablePointer(stackBuf.baseAddress),
527527
count: stackBufLength)
528528
expectNotEqual(0, state.state)
529-
expectNotEmpty(state.mutationsPtr)
529+
expectNotNil(state.mutationsPtr)
530530
if returnedCount == 0 {
531531
break
532532
}
@@ -545,7 +545,7 @@ import SlurpFastEnumeration
545545
with: &state, objects: AutoreleasingUnsafeMutablePointer(stackBuf.baseAddress),
546546
count: stackBufLength)
547547
expectNotEqual(0, state.state)
548-
expectNotEmpty(state.mutationsPtr)
548+
expectNotNil(state.mutationsPtr)
549549
expectEqual(0, returnedCount)
550550
}
551551
}
@@ -568,7 +568,7 @@ typealias AnyObjectTuple2 = (AnyObject, AnyObject)
568568
with: &state, objects: AutoreleasingUnsafeMutablePointer(stackBuf.baseAddress),
569569
count: stackBufLength)
570570
expectNotEqual(0, state.state)
571-
expectNotEmpty(state.mutationsPtr)
571+
expectNotNil(state.mutationsPtr)
572572
if returnedCount == 0 {
573573
break
574574
}
@@ -778,7 +778,7 @@ typealias AnyObjectTuple2 = (AnyObject, AnyObject)
778778
with: &state, objects: AutoreleasingUnsafeMutablePointer(stackBuf.baseAddress),
779779
count: stackBufLength)
780780
expectNotEqual(0, state.state)
781-
expectNotEmpty(state.mutationsPtr)
781+
expectNotNil(state.mutationsPtr)
782782
if returnedCount == 0 {
783783
break
784784
}
@@ -797,7 +797,7 @@ typealias AnyObjectTuple2 = (AnyObject, AnyObject)
797797
with: &state, objects: AutoreleasingUnsafeMutablePointer(stackBuf.baseAddress),
798798
count: stackBufLength)
799799
expectNotEqual(0, state.state)
800-
expectNotEmpty(state.mutationsPtr)
800+
expectNotNil(state.mutationsPtr)
801801
expectEqual(0, returnedCount)
802802
}
803803
}

0 commit comments

Comments
 (0)