|
12 | 12 | // RUN: %target-run %t/a.out RemoveInvalidIndex2 2>&1 | FileCheck %s -check-prefix=CHECK
|
13 | 13 | // RUN: %target-run %t/a.out RemoveInvalidIndex3 2>&1 | FileCheck %s -check-prefix=CHECK
|
14 | 14 | // RUN: %target-run %t/a.out RemoveInvalidIndex4 2>&1 | FileCheck %s -check-prefix=CHECK
|
| 15 | +// RUN: %target-run %t/a.out BridgedKeyIsNotNSCopyable1 2>&1 | FileCheck %s -check-prefix=CHECK-UNRECOGNIZED-SELECTOR |
| 16 | +// RUN: %target-run %t/a.out BridgedKeyIsNotNSCopyable2 2>&1 | FileCheck %s -check-prefix=CHECK |
15 | 17 |
|
16 | 18 | // CHECK: OK
|
17 |
| -// CHECK: CRASHED: SIG{{ILL|TRAP}} |
| 19 | +// CHECK: CRASHED: SIG{{ILL|TRAP|ABRT}} |
| 20 | + |
| 21 | +// CHECK-UNRECOGNIZED-SELECTOR: OK |
| 22 | +// CHECK-UNRECOGNIZED-SELECTOR: unrecognized selector sent to instance |
| 23 | +// CHECK-UNRECOGNIZED-SELECTOR: CRASHED: SIGABRT |
18 | 24 |
|
19 | 25 | import Foundation
|
20 | 26 |
|
@@ -123,6 +129,42 @@ if arg == "RemoveInvalidIndex4" {
|
123 | 129 | d.removeAtIndex(index)
|
124 | 130 | }
|
125 | 131 |
|
| 132 | +class TestObjCKeyTy : NSObject { |
| 133 | + init(_ value: Int) { |
| 134 | + self.value = value |
| 135 | + } |
| 136 | + |
| 137 | + override func isEqual(object: AnyObject!) -> Bool { |
| 138 | + if let other: AnyObject = object { |
| 139 | + if let otherObjcKey = other as TestObjCKeyTy { |
| 140 | + return self.value == otherObjcKey.value |
| 141 | + } |
| 142 | + } |
| 143 | + return false |
| 144 | + } |
| 145 | + |
| 146 | + override var hash : Int { |
| 147 | + return value |
| 148 | + } |
| 149 | + |
| 150 | + var value: Int |
| 151 | +} |
| 152 | + |
| 153 | +if arg == "BridgedKeyIsNotNSCopyable1" { |
| 154 | + // This Dictionary is bridged in O(1). |
| 155 | + var d = [ TestObjCKeyTy(10): NSObject() ] |
| 156 | + var nsd: NSDictionary = d |
| 157 | + println("OK") |
| 158 | + nsd.mutableCopy() |
| 159 | +} |
| 160 | + |
| 161 | +if arg == "BridgedKeyIsNotNSCopyable2" { |
| 162 | + // This Dictionary is bridged in O(N). |
| 163 | + var d = [ TestObjCKeyTy(10): 10 ] |
| 164 | + println("OK") |
| 165 | + var nsd: NSDictionary = d |
| 166 | +} |
| 167 | + |
126 | 168 | println("BUSTED: should have crashed already")
|
127 | 169 | exit(1)
|
128 | 170 |
|
0 commit comments