Skip to content

Commit 4832e0e

Browse files
committed
[test] Fix leak and reenable getObjects:andKeys:count: tests
1 parent d1fd33f commit 4832e0e

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

validation-test/stdlib/Dictionary.swift

+15-13
Original file line numberDiff line numberDiff line change
@@ -3385,13 +3385,19 @@ func checkGetObjectsAndKeys(
33853385
values[\(i)] was left unchanged
33863386
""",
33873387
file: file, line: line)
3388-
expectTrue(
3389-
value === dictionary.object(forKey: key) as AnyObject,
3390-
"""
3391-
Inconsistency at offset \(i) with count \(count):
3392-
values[\(i)] does not match value for keys[\(i)]
3393-
""",
3394-
file: file, line: line)
3388+
if key !== canary, value !== canary {
3389+
autoreleasepoolIfUnoptimizedReturnAutoreleased {
3390+
// We need an autorelease pool because objectForKey returns
3391+
// autoreleased values.
3392+
expectTrue(
3393+
value === dictionary.object(forKey: key) as AnyObject,
3394+
"""
3395+
Inconsistency at offset \(i) with count \(count):
3396+
values[\(i)] does not match value for keys[\(i)]
3397+
""",
3398+
file: file, line: line)
3399+
}
3400+
}
33953401
} else {
33963402
expectTrue(
33973403
key === canary,
@@ -3416,9 +3422,7 @@ func checkGetObjectsAndKeys(
34163422
withExtendedLifetime(canary) {}
34173423
}
34183424

3419-
DictionaryTestSuite.test("BridgedToObjC.Verbatim.getObjects:andKeys:count:")
3420-
.skip(.always("rdar://problem/41871587"))
3421-
.code {
3425+
DictionaryTestSuite.test("BridgedToObjC.Verbatim.getObjects:andKeys:count:") {
34223426
let d = getBridgedNSDictionaryOfRefTypesBridgedVerbatim()
34233427
for count in 0 ..< d.count + 2 {
34243428
checkGetObjectsAndKeys(d, count: count)
@@ -3523,9 +3527,7 @@ DictionaryTestSuite.test("BridgedToObjC.Custom.FastEnumeration_Empty") {
35233527
{ ($0 as! TestObjCValueTy).value })
35243528
}
35253529

3526-
DictionaryTestSuite.test("BridgedToObjC.Custom.getObjects:andKeys:count:")
3527-
.skip(.always("rdar://problem/41871587"))
3528-
.code {
3530+
DictionaryTestSuite.test("BridgedToObjC.Custom.getObjects:andKeys:count:") {
35293531
let d = getBridgedNSDictionaryOfKeyValue_ValueTypesCustomBridged()
35303532
for count in 0 ..< d.count + 2 {
35313533
checkGetObjectsAndKeys(d, count: count)

0 commit comments

Comments
 (0)