@@ -3429,6 +3429,12 @@ DictionaryTestSuite.test("BridgedToObjC.Verbatim.getObjects:andKeys:count:") {
3429
3429
}
3430
3430
}
3431
3431
3432
+ DictionaryTestSuite . test ( " BridgedToObjC.Verbatim.getObjects:andKeys:count:/InvalidCount " ) {
3433
+ expectCrashLater ( )
3434
+ let d = getBridgedNSDictionaryOfRefTypesBridgedVerbatim ( )
3435
+ checkGetObjectsAndKeys ( d, count: - 1 )
3436
+ }
3437
+
3432
3438
//===---
3433
3439
// Dictionary -> NSDictionary bridging tests.
3434
3440
//
@@ -3534,6 +3540,12 @@ DictionaryTestSuite.test("BridgedToObjC.Custom.getObjects:andKeys:count:") {
3534
3540
}
3535
3541
}
3536
3542
3543
+ DictionaryTestSuite . test ( " BridgedToObjC.Custom.getObjects:andKeys:count:/InvalidCount " ) {
3544
+ expectCrashLater ( )
3545
+ let d = getBridgedNSDictionaryOfKeyValue_ValueTypesCustomBridged ( )
3546
+ checkGetObjectsAndKeys ( d, count: - 1 )
3547
+ }
3548
+
3537
3549
func getBridgedNSDictionaryOfKey_ValueTypeCustomBridged( ) -> NSDictionary {
3538
3550
assert ( !_isBridgedVerbatimToObjectiveC( TestBridgedKeyTy . self) )
3539
3551
assert ( _isBridgedVerbatimToObjectiveC ( TestObjCValueTy . self) )
@@ -4749,6 +4761,22 @@ DictionaryTestSuite.test("Hashable") {
4749
4761
}
4750
4762
4751
4763
DictionaryTestSuite . setUp {
4764
+ #if _runtime(_ObjC)
4765
+ // Exercise ARC's autoreleased return value optimization in Foundation.
4766
+ //
4767
+ // On some platforms, when a new process is started, the optimization is
4768
+ // expected to fail the first time it is used in each linked
4769
+ // dylib. StdlibUnittest takes care of warming up ARC for the stdlib
4770
+ // (libswiftCore.dylib), but for this particular test we also need to do it
4771
+ // for Foundation, or there will be spurious leaks reported for tests
4772
+ // immediately following a crash test.
4773
+ //
4774
+ // <rdar://problem/42069800> stdlib tests: expectCrashLater() interferes with
4775
+ // counting autoreleased live objects
4776
+ let d = NSDictionary ( objects: [ 1 as NSNumber ] , forKeys: [ 1 as NSNumber ] )
4777
+ _ = d. object ( forKey: 1 as NSNumber )
4778
+ #endif
4779
+
4752
4780
resetLeaksOfDictionaryKeysValues ( )
4753
4781
#if _runtime(_ObjC)
4754
4782
resetLeaksOfObjCDictionaryKeysValues ( )
0 commit comments