@@ -126,7 +126,10 @@ SetTests.test("insert<Hashable>(_:)") {
126
126
expectEqual ( expected, s)
127
127
}
128
128
129
- SetTests . test ( " insert<Hashable>(_:)/FormerCastTrap " ) {
129
+ SetTests . test ( " insert<Hashable>(_:)/CastTrap " )
130
+ . crashOutputMatches ( " Could not cast value of type 'main.TestHashableDerivedA' " )
131
+ . crashOutputMatches ( " to 'main.TestHashableDerivedB' " )
132
+ . code {
130
133
var s : Set < AnyHashable > = [
131
134
AnyHashable ( TestHashableDerivedA ( 1010 , identity: 1 ) ) ,
132
135
]
@@ -138,6 +141,7 @@ SetTests.test("insert<Hashable>(_:)/FormerCastTrap") {
138
141
expectEqual ( 1 , memberAfterInsert. identity)
139
142
}
140
143
144
+ expectCrashLater ( )
141
145
_ = s. insert ( TestHashableDerivedB ( 1010 , identity: 3 ) )
142
146
}
143
147
@@ -177,7 +181,10 @@ SetTests.test("update<Hashable>(with:)") {
177
181
expectEqual ( expected, s)
178
182
}
179
183
180
- SetTests . test ( " update<Hashable>(with:)/FormerCastTrap " ) {
184
+ SetTests . test ( " update<Hashable>(with:)/CastTrap " )
185
+ . crashOutputMatches ( " Could not cast value of type 'main.TestHashableDerivedA' " )
186
+ . crashOutputMatches ( " to 'main.TestHashableDerivedB' " )
187
+ . code {
181
188
var s : Set < AnyHashable > = [
182
189
AnyHashable ( TestHashableDerivedA ( 1010 , identity: 1 ) ) ,
183
190
]
@@ -187,6 +194,7 @@ SetTests.test("update<Hashable>(with:)/FormerCastTrap") {
187
194
expectEqual ( 1 , old. identity)
188
195
}
189
196
197
+ expectCrashLater ( )
190
198
s. update ( with: TestHashableDerivedB ( 1010 , identity: 3 ) )
191
199
}
192
200
@@ -220,7 +228,10 @@ SetTests.test("remove<Hashable>(_:)") {
220
228
}
221
229
}
222
230
223
- SetTests . test ( " remove<Hashable>(_:)/FormerCastTrap " ) {
231
+ SetTests . test ( " remove<Hashable>(_:)/CastTrap " )
232
+ . crashOutputMatches ( " Could not cast value of type 'main.TestHashableDerivedA' " )
233
+ . crashOutputMatches ( " to 'main.TestHashableDerivedB' " )
234
+ . code {
224
235
var s : Set < AnyHashable > = [
225
236
AnyHashable ( TestHashableDerivedA ( 1010 , identity: 1 ) ) ,
226
237
AnyHashable ( TestHashableDerivedA ( 2020 , identity: 1 ) ) ,
@@ -232,6 +243,7 @@ SetTests.test("remove<Hashable>(_:)/FormerCastTrap") {
232
243
expectEqual ( 1 , old. identity)
233
244
}
234
245
246
+ expectCrashLater ( )
235
247
s. remove ( TestHashableDerivedB ( 2020 , identity: 2 ) )
236
248
}
237
249
0 commit comments